<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>طلب إذن جديد<?php $__template->endSection(); ?>

<?php $__template->section('content'); ?>
<form method="POST" action="/hr/permissions" style="max-width:600px;">
    <?= csrf_field() ?>

    <div class="card" style="margin-bottom:20px;">
        <div style="padding:16px;border-bottom:1px solid #E5E7EB;font-weight:600;">بيانات الإذن</div>
        <div style="padding:20px;display:grid;grid-template-columns:1fr 1fr;gap:16px;">
            <div style="grid-column:1/-1;">
                <label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">الموظف <span style="color:#DC2626;">*</span></label>
                <select name="employee_id" class="form-control" required>
                    <option value="">— اختر موظف —</option>
                    <?php foreach ($employees as $emp): ?>
                    <option value="<?= (int) $emp['id'] ?>"><?= e($emp['full_name_ar']) ?> (<?= e($emp['employee_number']) ?>)</option>
                    <?php endforeach; ?>
                </select>
            </div>
            <div>
                <label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">تاريخ الإذن <span style="color:#DC2626;">*</span></label>
                <input type="date" name="permission_date" value="<?= date('Y-m-d') ?>" class="form-control" required>
            </div>
            <div></div>
            <div>
                <label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">من الساعة <span style="color:#DC2626;">*</span></label>
                <input type="time" name="start_time" class="form-control" required>
            </div>
            <div>
                <label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">إلى الساعة <span style="color:#DC2626;">*</span></label>
                <input type="time" name="end_time" class="form-control" required>
            </div>
            <div style="grid-column:1/-1;">
                <label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">السبب <span style="color:#DC2626;">*</span></label>
                <textarea name="reason" class="form-control" rows="3" required placeholder="سبب طلب الإذن..."></textarea>
            </div>
        </div>
    </div>

    <div style="display:flex;gap:12px;">
        <button type="submit" class="btn btn-primary">تقديم الطلب</button>
        <a href="/hr/permissions" class="btn btn-secondary">إلغاء</a>
    </div>
</form>
<?php $__template->endSection(); ?>
