<?php $__template->layout('Layout.main'); ?>
<?php $isEdit = $holiday !== null; ?>
<?php $__template->section('title'); ?><?= $isEdit ? 'تعديل العطلة' : 'إضافة عطلة' ?><?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?><a href="/hr/holidays" class="btn btn-secondary">رجوع</a><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<form method="POST" action="<?= $isEdit ? '/hr/holidays/' . (int) $holiday->id : '/hr/holidays' ?>">
    <?= csrf_field() ?>
    <div class="card" style="margin-bottom:20px;">
        <div style="padding:16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px;">
            <div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالعربي <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?? ($isEdit ? $holiday->name_ar : '')) ?>" class="form-control" required></div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالإنجليزي</label><input type="text" name="name_en" value="<?= e(old('name_en') ?? ($isEdit ? $holiday->name_en : '')) ?>" class="form-control"></div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;">التاريخ <span style="color:#DC2626;">*</span></label><input type="date" name="date" value="<?= e(old('date') ?? ($isEdit ? $holiday->date : '')) ?>" class="form-control" required></div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;">المدة (أيام)</label><input type="number" name="duration_days" value="<?= e(old('duration_days') ?? ($isEdit ? $holiday->duration_days : '1')) ?>" class="form-control" min="1"></div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;">النوع</label>
                <select name="holiday_type" class="form-control">
                    <option value="national" <?= (old('holiday_type') ?? ($isEdit ? $holiday->holiday_type : '')) === 'national' ? 'selected' : '' ?>>وطنية</option>
                    <option value="religious" <?= (old('holiday_type') ?? ($isEdit ? $holiday->holiday_type : '')) === 'religious' ? 'selected' : '' ?>>دينية</option>
                    <option value="company" <?= (old('holiday_type') ?? ($isEdit ? $holiday->holiday_type : '')) === 'company' ? 'selected' : '' ?>>خاصة بالشركة</option>
                </select>
            </div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;">الديانة (للعطل الدينية)</label>
                <select name="religion" class="form-control"><option value="">-- الكل --</option>
                    <option value="muslim" <?= (old('religion') ?? ($isEdit ? $holiday->religion : '')) === 'muslim' ? 'selected' : '' ?>>مسلم</option>
                    <option value="christian" <?= (old('religion') ?? ($isEdit ? $holiday->religion : '')) === 'christian' ? 'selected' : '' ?>>مسيحي</option>
                </select>
            </div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_recurring" value="1" <?= (old('is_recurring') ?? ($isEdit ? $holiday->is_recurring : 0)) ? 'checked' : '' ?>> متكررة سنوياً</label></div>
        </div>
    </div>
    <div style="display:flex;gap:10px;justify-content:flex-end;">
        <a href="/hr/holidays" class="btn btn-secondary">إلغاء</a>
        <button type="submit" class="btn btn-primary"><?= $isEdit ? 'تحديث' : 'حفظ' ?></button>
    </div>
</form>
<?php $__template->endSection(); ?>
