<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>إضافة عضو مؤقت — <?= e($member['full_name_ar']) ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>

<div class="card" style="margin-bottom:15px;padding:15px;display:flex;justify-content:space-between;align-items:center;">
    <div><strong>العضو:</strong> <?= e($member['full_name_ar']) ?> &nbsp;|&nbsp; <strong>رقم العضوية:</strong> <?= e($member['membership_number'] ?? 'لم يُحدد') ?></div>
    <a href="/members/<?= (int) $member['id'] ?>" class="btn btn-outline">← العودة للعضو</a>
</div>

<form method="POST" action="/members/<?= (int) $member['id'] ?>/temporary">
    <?= csrf_field() ?>
    <div class="card" style="margin-bottom:20px;">
        <div style="padding:15px 20px;border-bottom:1px solid #E5E7EB;"><h3 style="margin:0;color:#0D7377;">بيانات العضو المؤقت</h3></div>
        <div style="padding:20px;display:grid;grid-template-columns:1fr 1fr;gap:15px;">
            <div class="form-group" style="grid-column:1/-1;">
                <label class="form-label">الاسم بالكامل (عربي) <span style="color:#DC2626;">*</span></label>
                <input type="text" name="full_name_ar" value="<?= e(old('full_name_ar')) ?>" class="form-input" required>
            </div>
            <div class="form-group">
                <label class="form-label">الاسم بالإنجليزي</label>
                <input type="text" name="full_name_en" value="<?= e(old('full_name_en')) ?>" class="form-input">
            </div>
            <div class="form-group">
                <label class="form-label">الفئة <span style="color:#DC2626;">*</span></label>
                <select name="category" class="form-select" required>
                    <option value="">-- اختر --</option>
                    <?php foreach ($categories as $code => $label): ?>
                        <option value="<?= e($code) ?>" <?= old('category') === $code ? 'selected' : '' ?>><?= e($label) ?></option>
                    <?php endforeach; ?>
                </select>
            </div>
            <div class="form-group">
                <label class="form-label">الرقم القومي</label>
                <input type="text" name="national_id" value="<?= e(old('national_id')) ?>" class="form-input" maxlength="14" style="direction:ltr;text-align:left;">
            </div>
            <div class="form-group">
                <label class="form-label">تاريخ الميلاد <span style="color:#DC2626;">*</span></label>
                <input type="date" name="date_of_birth" value="<?= e(old('date_of_birth')) ?>" class="form-input" required>
            </div>
            <div class="form-group">
                <label class="form-label">النوع <span style="color:#DC2626;">*</span></label>
                <select name="gender" class="form-select" required>
                    <option value="">-- اختر --</option>
                    <option value="male" <?= old('gender') === 'male' ? 'selected' : '' ?>>ذكر</option>
                    <option value="female" <?= old('gender') === 'female' ? 'selected' : '' ?>>أنثى</option>
                </select>
            </div>
            <div class="form-group">
                <label class="form-label">صلة القرابة</label>
                <input type="text" name="relationship_to_member" value="<?= e(old('relationship_to_member')) ?>" class="form-input">
            </div>
            <div class="form-group">
                <label class="form-label">&nbsp;</label>
                <label style="display:flex;align-items:center;gap:8px;cursor:pointer;">
                    <input type="checkbox" name="has_championship" value="1" <?= old('has_championship') ? 'checked' : '' ?>>
                    <span>حاصل على بطولات جمهورية (إعفاء من الرسوم)</span>
                </label>
            </div>
            <div class="form-group">
                <label class="form-label">&nbsp;</label>
                <label style="display:flex;align-items:center;gap:8px;cursor:pointer;">
                    <input type="checkbox" name="disability_documentation" value="1" <?= old('disability_documentation') ? 'checked' : '' ?>>
                    <span>لديه وثائق إعاقة</span>
                </label>
            </div>
            <div class="form-group" style="grid-column:1/-1;">
                <label class="form-label">ملاحظات</label>
                <textarea name="notes" class="form-textarea" rows="2"><?= e(old('notes')) ?></textarea>
            </div>
        </div>
    </div>
    <div style="display:flex;gap:10px;">
        <button type="submit" class="btn btn-primary">إضافة العضو المؤقت</button>
        <a href="/members/<?= (int) $member['id'] ?>" class="btn btn-outline">إلغاء</a>
    </div>
</form>
<?php $__template->endSection(); ?>