<?php // components/forms/employee_details.php ?>
<div class="bg-white border border-slate-300/80 rounded-xl shadow-sm overflow-hidden">
    <div class="px-4 py-3 bg-stone-50/50 border-b border-slate-300/80">
        <h3 class="text-xs font-black text-slate-950 uppercase tracking-tight">2. Employment Allocation</h3>
    </div>
    
    <div class="p-4 sm:p-5 space-y-4">
        <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
            <div class="space-y-1.5">
                <label class="block text-[9px] font-black text-slate-500 uppercase tracking-wider px-0.5">Employee ID Code</label>
                <input type="text" 
                       name="employee_no" 
                       value="<?= htmlspecialchars((string)($employee['employee_no'] ?? '')) ?>" 
                       placeholder="e.g., BWP-YEN-042" 
                       class="w-full bg-stone-50/40 border border-slate-300 p-2 rounded text-xs font-mono font-black text-slate-950 focus:outline-none focus:border-indigo-700 focus:bg-white transition">
            </div>
            
            <div class="space-y-1.5">
                <label class="block text-[9px] font-black text-slate-500 uppercase tracking-wider px-0.5">Functional Enterprise Department</label>
                <select name="department_id" class="w-full bg-stone-50/40 border border-slate-300 p-2 rounded text-xs font-bold text-slate-950 focus:outline-none focus:border-indigo-700 focus:bg-white transition">
                    <option value="0">Unassigned Base</option>
                    <?php foreach ($departments as $id => $deptName): ?>
                        <option value="<?= $id ?>" <?= ($employee['department_id'] ?? 0) == $id ? 'selected' : '' ?>><?= htmlspecialchars($deptName) ?></option>
                    <?php endforeach; ?>
                </select>
            </div>
            
            <div class="space-y-1.5">
                <label class="block text-[9px] font-black text-slate-500 uppercase tracking-wider px-0.5">Corporate Designation Title</label>
                <select name="designation" class="w-full bg-stone-50/40 border border-slate-300 p-2 rounded text-xs font-bold text-slate-950 focus:outline-none focus:border-indigo-700 focus:bg-white transition">
                    <option value="">Unassigned Designation</option>
                    <?php foreach ($designationsList as $desgName): ?>
                        <option value="<?= htmlspecialchars($desgName) ?>" <?= ($employee['designation'] ?? '') === $desgName ? 'selected' : '' ?>><?= htmlspecialchars($desgName) ?></option>
                    <?php endforeach; ?>
                </select>
            </div>
            
            <div class="space-y-1.5">
                <label class="block text-[9px] font-black text-slate-500 uppercase tracking-wider px-0.5">Functional System Position</label>
                <select name="position" class="w-full bg-stone-50/40 border border-slate-300 p-2 rounded text-xs font-bold text-slate-950 focus:outline-none focus:border-indigo-700 focus:bg-white transition">
                    <option value="">Unassigned Position</option>
                    <?php foreach ($positionsList as $posName): ?>
                        <option value="<?= htmlspecialchars($posName) ?>" <?= ($employee['position'] ?? '') === $posName ? 'selected' : '' ?>><?= htmlspecialchars($posName) ?></option>
                    <?php endforeach; ?>
                </select>
            </div>
            
            <div class="space-y-1.5">
                <label class="block text-[9px] font-black text-slate-500 uppercase tracking-wider px-0.5">Employment Date</label>
                <input type="date" name="hire_date" value="<?= !empty($employee['hire_date']) ? date('Y-m-d', strtotime($employee['hire_date'])) : '' ?>" class="w-full bg-stone-50/40 border border-slate-300 p-2 rounded text-xs font-bold text-slate-950 focus:outline-none focus:border-indigo-700 focus:bg-white transition">
            </div>
        </div>
        
        <div class="pt-4 border-t border-slate-200/80">
            <label class="inline-flex items-start gap-3 cursor-pointer select-none">
                <input type="checkbox" name="is_manager" value="1" <?= (!empty($employee['is_manager']) && $employee['is_manager'] == 1) ? 'checked' : '' ?> class="mt-0.5 w-3.5 h-3.5 rounded border-slate-300 text-indigo-700 focus:ring-indigo-700">
                <div>
                    <span class="text-xs font-black text-slate-700 uppercase tracking-wide block">Grant Leadership/Manager Privilege Flags</span>
                    <span class="text-[10px] text-slate-400 block font-semibold mt-0.5">Enables localized departmental performance reporting visibility.</span>
                </div>
            </label>
        </div>
    </div>
</div>