<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>تعديل بيانات الابن: <?= e($child->full_name_ar) ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<form method="POST" action="/members/<?= (int) $member['id'] ?>/children/<?= (int) $child->id ?>" enctype="multipart/form-data">
    <?= csrf_field() ?>
    <div class="card" style="padding:20px;margin-bottom:20px;">
        <h3 style="color:#0D7377;margin-bottom:15px;">البيانات الأساسية (للقراءة فقط)</h3>
        <div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;">
            <div class="form-group"><label class="form-label">الاسم</label><input type="text" value="<?= e($child->full_name_ar) ?>" class="form-input" disabled style="background:#F3F4F6;"></div>
            <div class="form-group"><label class="form-label">الرقم القومي</label><input type="text" value="<?= e($child->national_id ?: '—') ?>" class="form-input" disabled style="background:#F3F4F6;direction:ltr;text-align:left;"></div>
            <div class="form-group"><label class="form-label">تاريخ الميلاد</label><input type="text" value="<?= e($child->date_of_birth) ?>" class="form-input" disabled style="background:#F3F4F6;"></div>
            <div class="form-group"><label class="form-label">السن</label><input type="text" value="<?= (int) $child->age_years ?> سنة" class="form-input" disabled style="background:#F3F4F6;"></div>
            <div class="form-group"><label class="form-label">النوع</label><input type="text" value="<?= $child->gender === 'male' ? 'ذكر' : 'أنثى' ?>" class="form-input" disabled style="background:#F3F4F6;"></div>
            <div class="form-group"><label class="form-label">نوع القرابة</label><input type="text" value="<?= e($child->getRelationshipLabel()) ?>" class="form-input" disabled style="background:#F3F4F6;"></div>
            <div class="form-group"><label class="form-label">التصنيف</label><input type="text" value="<?= e($child->getClassificationLabel()) ?>" class="form-input" disabled style="background:#F3F4F6;"></div>
        </div>
    </div>
    <div class="card" style="padding:20px;margin-bottom:20px;">
        <h3 style="color:#0D7377;margin-bottom:15px;">البيانات القابلة للتعديل</h3>
        <div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;">
            <div class="form-group"><label class="form-label">الاسم بالإنجليزي</label><input type="text" name="full_name_en" value="<?= e($child->full_name_en ?? '') ?>" class="form-input"></div>
            <div class="form-group"><label class="form-label">الكلية / المدرسة</label><input type="text" name="school_faculty" value="<?= e($child->school_faculty ?? '') ?>" class="form-input"></div>
            <div class="form-group" style="grid-column:1/-1;"><label class="form-label">ملاحظات</label><textarea name="remarks" class="form-textarea" rows="2"><?= e($child->remarks ?? '') ?></textarea></div>
        </div>
    </div>
    <!-- Profile Photo -->
    <div class="card" style="padding:20px;margin-bottom:20px;border-right:4px solid #7C3AED;">
        <h3 style="color:#7C3AED;margin-bottom:15px;">الصورة الشخصية</h3>
        <?php $currentPhoto = $child->photo_path ?? null; $required = false; $fieldName = 'photo'; $label = 'الصورة الشخصية'; include \App\Core\App::getInstance()->basePath() . '/app/Shared/Components/photo-upload-field.php'; ?>
    </div>

    <button type="submit" class="btn btn-primary">حفظ التعديلات</button>
    <a href="/members/<?= (int) $member['id'] ?>" class="btn btn-outline">إلغاء</a>
</form>
<?php $__template->endSection(); ?>