<?php $__template->layout('Layout.main'); ?>
<?php $isEdit = $structure !== null; ?>
<?php $__template->section('title'); ?><?= $isEdit ? 'تعديل هيكل الرواتب' : 'إضافة هيكل رواتب' ?><?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?><a href="/hr/salary-structures" class="btn btn-secondary">رجوع</a><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<form method="POST" action="<?= $isEdit ? '/hr/salary-structures/' . (int) $structure->id : '/hr/salary-structures' ?>">
    <?= 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 ? $structure->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 ? $structure->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="text" name="code" value="<?= e(old('code') ?? ($isEdit ? $structure->code : '')) ?>" class="form-control" required></div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;">الوصف</label><input type="text" name="description" value="<?= e(old('description') ?? ($isEdit ? $structure->description : '')) ?>" class="form-control"></div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_default" value="1" <?= (old('is_default') ?? ($isEdit ? $structure->is_default : 0)) ? 'checked' : '' ?>> هيكل افتراضي</label></div>
            <div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?? ($isEdit ? $structure->is_active : 1)) ? 'checked' : '' ?>> فعال</label></div>
        </div>
    </div>
    <div style="display:flex;gap:10px;justify-content:flex-end;">
        <a href="/hr/salary-structures" class="btn btn-secondary">إلغاء</a>
        <button type="submit" class="btn btn-primary"><?= $isEdit ? 'تحديث' : 'حفظ' ?></button>
    </div>
</form>
<?php $__template->endSection(); ?>
