<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>تعديل الفرع: <?= e($branch->name_ar) ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<form method="POST" action="/branches/<?= (int) $branch->id ?>">
    <?= csrf_field() ?>
    <div class="card" style="padding:20px;">
        <div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;">
            <div class="form-group">
                <label class="form-label">كود الفرع</label>
                <input type="text" value="<?= e($branch->branch_code) ?>" class="form-input" disabled style="background:#f3f4f6;">
            </div>
            <div class="form-group">
                <label class="form-label">الاسم بالعربي <span style="color:#DC2626;">*</span></label>
                <input type="text" name="name_ar" value="<?= e($branch->name_ar) ?>" class="form-input" required>
            </div>
            <div class="form-group">
                <label class="form-label">الاسم بالإنجليزي</label>
                <input type="text" name="name_en" value="<?= e($branch->name_en ?? '') ?>" class="form-input">
            </div>
            <div class="form-group">
                <label class="form-label">الهاتف</label>
                <input type="text" name="phone" value="<?= e($branch->phone ?? '') ?>" class="form-input">
            </div>
            <div class="form-group">
                <label class="form-label">اسم المدير</label>
                <input type="text" name="manager_name" value="<?= e($branch->manager_name ?? '') ?>" class="form-input">
            </div>
            <div class="form-group">
                <label class="form-label">الحالة</label>
                <select name="is_active" class="form-select">
                    <option value="1" <?= $branch->is_active ? 'selected' : '' ?>>نشط</option>
                    <option value="0" <?= !$branch->is_active ? 'selected' : '' ?>>معطل</option>
                </select>
            </div>
            <div class="form-group" style="grid-column:1/-1;">
                <label class="form-label">العنوان</label>
                <textarea name="address" class="form-textarea" rows="3"><?= e($branch->address ?? '') ?></textarea>
            </div>
        </div>
    </div>
    <button type="submit" class="btn btn-primary" style="margin-top:20px;">حفظ التعديلات</button>
    <a href="/branches" class="btn btn-outline" style="margin-top:20px;">إلغاء</a>
</form>
<?php $__template->endSection(); ?>