<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<div class="page-header"><div><h1><i class="bi bi-person-plus me-2 text-primary"></i>Add Employee</h1></div></div>
<?= form_open(base_url('employees/store')) ?>
<div class="row g-3"><div class="col-lg-8"><div class="fm-form-section"><h6>Employee Information</h6><div class="row g-3">
<div class="col-md-6"><label class="form-label">Link to User Account</label><select name="user_id" class="form-select"><option value="">— No linked account —</option><?php foreach($users as $u): ?><option value="<?= $u['id'] ?>"><?= esc($u['name']) ?> (<?= esc($u['email']) ?>)</option><?php endforeach; ?></select></div>
<div class="col-md-6"><label class="form-label">Facility</label><select name="facility_id" class="form-select"><option value="">— None —</option><?php foreach($facilities as $f): ?><option value="<?= $f['id'] ?>"><?= esc($f['name']) ?></option><?php endforeach; ?></select></div>
<div class="col-md-6"><label class="form-label">Designation *</label><input type="text" name="designation" class="form-control" value="<?= old('designation') ?>" required></div>
<div class="col-md-6"><label class="form-label">Department *</label><input type="text" name="department" class="form-control" value="<?= old('department') ?>" required></div>
<div class="col-md-3"><label class="form-label">Shift Start</label><input type="time" name="shift_start" class="form-control" value="08:00"></div>
<div class="col-md-3"><label class="form-label">Shift End</label><input type="time" name="shift_end" class="form-control" value="17:00"></div>
<div class="col-md-3"><label class="form-label">Hourly Rate (<?= $currency ?>)</label><input type="number" name="hourly_rate" step="0.01" class="form-control" value="0"></div>
<div class="col-md-3"><label class="form-label">Hire Date</label><input type="date" name="hire_date" class="form-control"></div>
</div></div></div>
<div class="col-lg-4"><div class="fm-form-section"><h6>Actions</h6><button type="submit" class="btn btn-fm-primary w-100 mb-2">Add Employee</button><a href="<?= base_url('employees') ?>" class="btn btn-fm-outline w-100">Cancel</a></div></div></div>
<?= form_close() ?>
<?= $this->endSection() ?>
