<div class="row justify-content-center"><div class="col-lg-10">
<div class="card"><div class="card-header"><h5 class="mb-0"><i class="fas fa-edit me-2"></i>Edit Class</h5></div>
<div class="card-body">
<form method="POST" action="/sports/classes/<?= $class['id'] ?>" data-ajax="true">
<?= csrf_field() ?>
<div class="row g-3">
    <div class="col-md-3"><label class="form-label">Code</label><input type="text" class="form-control" value="<?=e($class['class_code'])?>" disabled></div>
    <div class="col-md-3"><label class="form-label">Coach</label><select name="coach_id" class="form-select"><option value="">--</option><?php foreach($coaches as $c): ?><option value="<?=$c['id']?>" <?=selected($c['id'],$class['coach_id'])?>><?=e($c['name'])?></option><?php endforeach; ?></select></div>
    <div class="col-md-3"><label class="form-label">Facility</label><select name="facility_id" class="form-select"><option value="">--</option><?php foreach($facilities as $f): ?><option value="<?=$f['id']?>" <?=selected($f['id'],$class['facility_id'])?>><?=e($f['name_en'])?></option><?php endforeach; ?></select></div>
    <div class="col-md-3"><label class="form-label">Level</label><select name="class_type" class="form-select"><?php foreach(['all_levels','beginner','intermediate','advanced','kids','youth','adult','senior'] as $t): ?><option value="<?=$t?>" <?=selected($t,$class['class_type'])?>><?=ucfirst(str_replace('_',' ',$t))?></option><?php endforeach; ?></select></div>
    <div class="col-md-6"><label class="form-label">Name (EN) <span class="text-danger">*</span></label><input type="text" name="name_en" class="form-control" value="<?=e($class['name_en'])?>" required></div>
    <div class="col-md-6"><label class="form-label">Name (AR)</label><input type="text" name="name_ar" class="form-control" dir="rtl" value="<?=e($class['name_ar']??'')?>"></div>
    <div class="col-md-3"><label class="form-label">Max Participants</label><input type="number" name="max_participants" class="form-control" value="<?=$class['max_participants']?>" required></div>
    <div class="col-md-3"><label class="form-label">Fee/Month</label><input type="number" name="fee_per_month" class="form-control" step="0.01" value="<?=$class['fee_per_month']?>"></div>
    <div class="col-md-3"><label class="form-label">Status</label><select name="status" class="form-select"><?php foreach(['planned','enrollment_open','active','full','completed','cancelled'] as $st): ?><option value="<?=$st?>" <?=selected($st,$class['status'])?>><?=ucfirst(str_replace('_',' ',$st))?></option><?php endforeach; ?></select></div>
</div>
<div class="mt-4 d-flex gap-2"><button type="submit" class="btn btn-primary"><i class="fas fa-save me-1"></i>Save</button><a href="/sports/classes/<?=$class['id']?>" class="btn btn-secondary">Cancel</a></div>
</form></div></div></div></div>