<?php $s = $staff ?? null; ?>
<div class="row g-3">
    <div class="col-12 d-flex align-items-center gap-3 mb-1">
        <?php if($s && $s->photoUrl()): ?>
            <img src="<?php echo e($s->photoUrl()); ?>" class="avatar avatar-lg rounded-circle border" style="object-fit:cover" alt="photo">
        <?php else: ?>
            <div class="icon icon-lg icon-shape bg-gradient-primary rounded-circle d-flex align-items-center justify-content-center" style="width:64px;height:64px">
                <i class="bi bi-person-fill text-white h4 mb-0"></i></div>
        <?php endif; ?>
        <div class="flex-grow-1" style="max-width:340px">
            <label class="form-label text-xs">Staff Photo</label>
            <input type="file" name="photo" accept="image/*" class="form-control form-control-sm">
        </div>
    </div>

    <div class="col-md-3"><label class="form-label text-xs">Running No</label><input type="number" name="running_no" value="<?php echo e(old('running_no', $s->running_no ?? '')); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Worker Code</label><input name="worker_code" value="<?php echo e(old('worker_code', $s->worker_code ?? '')); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Site Ref</label><input name="site_ref" value="<?php echo e(old('site_ref', $s->site_ref ?? '')); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Status *</label>
        <select name="status" class="form-select form-select-sm" required>
            <?php $__currentLoopData = ['active','resign','inactive']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $st): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($st); ?>" <?php if(old('status', $s->status ?? 'active')===$st): echo 'selected'; endif; ?>><?php echo e(ucfirst($st)); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select></div>

    <div class="col-md-6"><label class="form-label text-xs">Full Name *</label><input name="name" value="<?php echo e(old('name', $s->name ?? '')); ?>" class="form-control form-control-sm" required></div>
    <div class="col-md-3"><label class="form-label text-xs">Passport No</label><input name="passport_no" value="<?php echo e(old('passport_no', $s->passport_no ?? '')); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Gender</label>
        <select name="gender" class="form-select form-select-sm">
            <option value="">—</option>
            <?php $__currentLoopData = ['male','female']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $g): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($g); ?>" <?php if(old('gender', $s->gender ?? '')===$g): echo 'selected'; endif; ?>><?php echo e(ucfirst($g)); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select></div>

    <div class="col-md-3"><label class="form-label text-xs">Nationality</label>
        <select name="nationality_id" class="form-select form-select-sm searchable">
            <option value="">—</option>
            <?php $__currentLoopData = $nationalities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $n): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($n->id); ?>" <?php if(old('nationality_id', $s->nationality_id ?? '')==$n->id): echo 'selected'; endif; ?>><?php echo e($n->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select></div>
    <div class="col-md-3"><label class="form-label text-xs">Site / Project</label>
        <select name="site_id" class="form-select form-select-sm searchable">
            <option value="">—</option>
            <?php $__currentLoopData = $sites; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $site): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($site->id); ?>" <?php if(old('site_id', $s->site_id ?? '')==$site->id): echo 'selected'; endif; ?>><?php echo e($site->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select></div>
    <div class="col-md-3"><label class="form-label text-xs">Designation</label><input name="designation" value="<?php echo e(old('designation', $s->designation ?? '')); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Department</label><input name="department" value="<?php echo e(old('department', $s->department ?? '')); ?>" class="form-control form-control-sm"></div>

    <div class="col-md-3"><label class="form-label text-xs">Passport Expiry</label><input type="date" name="passport_expiry" value="<?php echo e(old('passport_expiry', optional($s->passport_expiry ?? null)->format('Y-m-d'))); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Permit Expiry</label><input type="date" name="permit_expiry" value="<?php echo e(old('permit_expiry', optional($s->permit_expiry ?? null)->format('Y-m-d'))); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">FOMEMA Expiry</label><input type="date" name="fomema_expiry" value="<?php echo e(old('fomema_expiry', optional($s->fomema_expiry ?? null)->format('Y-m-d'))); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3 d-flex align-items-end gap-3">
        <div class="form-check form-switch"><input type="checkbox" role="switch" name="has_passport" value="1" class="form-check-input" <?php if(old('has_passport', $s->has_passport ?? false)): echo 'checked'; endif; ?>><label class="form-check-label text-xs">Passport held</label></div>
        <div class="form-check form-switch"><input type="checkbox" role="switch" name="has_epass" value="1" class="form-check-input" <?php if(old('has_epass', $s->has_epass ?? false)): echo 'checked'; endif; ?>><label class="form-check-label text-xs">E-Pass</label></div>
    </div>

    <div class="col-md-3"><label class="form-label text-xs">Basic Rate</label><input type="number" step="0.01" name="basic_rate" value="<?php echo e(old('basic_rate', $s->basic_rate ?? '')); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Pay Basis</label>
        <select name="pay_basis" class="form-select form-select-sm">
            <option value="">—</option>
            <?php $__currentLoopData = ['monthly','daily','hourly']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pb): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($pb); ?>" <?php if(old('pay_basis', $s->pay_basis ?? '')===$pb): echo 'selected'; endif; ?>><?php echo e(ucfirst($pb)); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select></div>
    <div class="col-md-3"><label class="form-label text-xs">Bank</label>
        <select name="bank_id" class="form-select form-select-sm">
            <option value="">—</option>
            <?php $__currentLoopData = $banks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($b->id); ?>" <?php if(old('bank_id', $s->bank_id ?? '')==$b->id): echo 'selected'; endif; ?>><?php echo e($b->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select></div>
    <div class="col-md-3"><label class="form-label text-xs">Account Number</label><input name="account_number" value="<?php echo e(old('account_number', $s->account_number ?? '')); ?>" class="form-control form-control-sm"></div>

    <div class="col-md-3"><label class="form-label text-xs">4-Digit Number</label><input name="account_last4" value="<?php echo e(old('account_last4', $s->account_last4 ?? '')); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Date of Join</label><input type="date" name="date_of_join" value="<?php echo e(old('date_of_join', optional($s->date_of_join ?? null)->format('Y-m-d'))); ?>" class="form-control form-control-sm"></div>
    <div class="col-md-3"><label class="form-label text-xs">Resign Date</label><input type="date" name="resign_date" value="<?php echo e(old('resign_date', optional($s->resign_date ?? null)->format('Y-m-d'))); ?>" class="form-control form-control-sm"></div>

    <?php if(!$s): ?>
    <div class="col-12"><hr class="horizontal dark my-1"><span class="text-xs text-uppercase text-muted">Initial Documents (optional)</span></div>
    <div class="col-md-6"><label class="form-label text-xs">Passport Scan</label><input type="file" name="passport_file" class="form-control form-control-sm"></div>
    <div class="col-md-6"><label class="form-label text-xs">Permit Scan</label><input type="file" name="permit_file" class="form-control form-control-sm"></div>
    <?php endif; ?>
</div>
<?php /**PATH /Users/kalaiarasen/projects/myindependent-worker-management/resources/views/staff/_form.blade.php ENDPATH**/ ?>