<?php $__env->startSection('title', 'General Settings'); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <?php if(session('success')): ?>
        <div class="alert alert-success alert-dismissible fade show mb-4 border-0 shadow-sm" role="alert">
            <i class="fas fa-check-circle me-2"></i> <?php echo e(session('success')); ?>

            <button type="button" class="btn-close" data-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>

    <div class="row">
        <div class="col-md-9">
            <div class="card card-primary card-outline">
                <div class="card-header">
                    <h3 class="card-title font-weight-bold"><i class="fas fa-cogs mr-1"></i> Application Configuration</h3>
                </div>
                <div class="card-body">
                    <form action="<?php echo e(route('settings.update')); ?>" method="POST" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <div class="row g-4">
                            <div class="col-md-6">
                                <label class="form-label">Company Name</label>
                                <input type="text" name="company_name" class="form-control" value="<?php echo e(old('company_name', $settings->company_name)); ?>" placeholder="Your Enterprise Name">
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">Contact Email</label>
                                <input type="email" name="contact_email" class="form-control" value="<?php echo e(old('contact_email', $settings->contact_email)); ?>" placeholder="contact@company.com">
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">Contact Number</label>
                                <input type="text" name="contact_number" class="form-control" value="<?php echo e(old('contact_number', $settings->contact_number)); ?>" placeholder="+1 234 567 890">
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">Website / Address</label>
                                <input type="text" name="address" class="form-control" value="<?php echo e(old('address', $settings->address)); ?>" placeholder="123 Corporate Way, City">
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">Primary Operating Country</label>
                                <select name="country" class="form-select">
                                    <option value="">Select Country</option>
                                    <option value="IN" <?php echo e(old('country', $settings->country) == 'IN' ? 'selected' : ''); ?>>India</option>
                                    <option value="US" <?php echo e(old('country', $settings->country) == 'US' ? 'selected' : ''); ?>>United States</option>
                                    <option value="GB" <?php echo e(old('country', $settings->country) == 'GB' ? 'selected' : ''); ?>>United Kingdom</option>
                                    <option value="AE" <?php echo e(old('country', $settings->country) == 'AE' ? 'selected' : ''); ?>>UAE</option>
                                    <option value="OTHER" <?php echo e(old('country', $settings->country) == 'OTHER' ? 'selected' : ''); ?>>Other</option>
                                </select>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">Currency Symbol</label>
                                <input type="text" name="currency_symbol" class="form-control" value="<?php echo e(old('currency_symbol', $settings->currency_symbol)); ?>" placeholder="e.g. ₹, $, £">
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">Minimum Working Hours</label>
                                <input type="number" name="minimum_working_hours" class="form-control" value="<?php echo e(old('minimum_working_hours', $settings->minimum_working_hours ?? 9)); ?>" min="1" max="24">
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label>Standard Punch-in Time</label>
                                    <input type="time" name="standard_punch_in_time" class="form-control" value="<?php echo e(old('standard_punch_in_time', $settings->standard_punch_in_time ? \Carbon\Carbon::parse($settings->standard_punch_in_time)->format('H:i') : '')); ?>">
                                </div>
                            </div>
                            <div class="col-12">
                                <label class="form-label">Company Profile / Bio</label>
                                <textarea name="company_profile" class="form-control" rows="4"><?php echo e(old('company_profile', $settings->company_profile)); ?></textarea>
                            </div>
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label>Company Logo</label>
                                    <div class="d-flex align-items-center">
                                    <?php if($settings->company_logo): ?>
                                        <div class="border rounded p-1 mr-3">
                                            <img src="<?php echo e(asset('storage/' . $settings->company_logo)); ?>" alt="Logo" style="height: 50px; object-fit: contain;">
                                        </div>
                                    <?php endif; ?>
                                    <input type="file" name="company_logo" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-12">
                                <label class="form-label">HR Policy Document</label>
                                <div class="d-flex align-items-center gap-3">
                                    <?php if($settings->hr_policy): ?>
                                        <a href="<?php echo e(asset('storage/' . $settings->hr_policy)); ?>" target="_blank" class="btn btn-outline-primary btn-sm"><i class="fas fa-file-pdf mr-1"></i> View Policy</a>
                                    <?php endif; ?>
                                    <input type="file" name="hr_policy" class="form-control">
                                </div>
                            </div>
                        </div>

                        <?php if(auth()->user()->canAccess('settings.general')): ?>
                        <div class="text-end mt-4">
                            <button type="submit" class="btn btn-primary">
                                <i class="fas fa-save me-2"></i> Save General Settings
                            </button>
                        </div>
                        <?php endif; ?>
                    </form>
                </div>
            </div>
        </div>

        <div class="col-md-3">
            <div class="info-box bg-light shadow-none border">
                <span class="info-box-icon text-primary"><i class="fas fa-info-circle"></i></span>
                <div class="info-box-content">
                    <span class="info-box-text font-weight-bold">System Info</span>
                    <span class="info-box-number small text-muted">Core identity and operational rules.</span>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\hrms\resources\views/admin/settings/general.blade.php ENDPATH**/ ?>