39669-vm/approved_school.php
2026-04-16 13:19:21 +00:00

435 lines
32 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/includes/app.php';
$flash = consume_flash();
$applicationId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ?: 0;
$requestedCycleId = filter_input(INPUT_GET, 'cycle', FILTER_VALIDATE_INT) ?: 0;
$application = $applicationId > 0 ? get_application($applicationId) : null;
$cycleValues = school_cycle_defaults($application ?: null);
$cycleErrors = [];
$cycleRollover = school_cycle_rollover_defaults();
if (!$application) {
http_response_code(404);
render_page_start('صفحة المركز غير موجودة', 'approved', 'تعذر العثور على المركز المطلوب لعرض صفحة الهبوط بعد الاعتماد.');
render_flash($flash);
?>
<section class="py-5">
<div class="container-xxl">
<div class="row g-4 align-items-start">
<div class="col-lg-3">
<?php require __DIR__ . '/includes/sidebar.php'; ?>
</div>
<div class="col-lg-9">
<div class="app-card text-center py-5">
<div class="empty-title mb-2">المركز غير موجود</div>
<p class="text-muted mb-3">تحقق من رقم الطلب أو ارجع إلى قائمة المراكز المعتمدة.</p>
<a class="btn btn-dark" href="applications.php?status=approved">عرض المراكز المعتمدة</a>
</div>
</div>
</section>
<?php
render_page_end();
exit;
}
$isApproved = (string) $application['status'] === 'approved';
$cycleContext = ['cycles' => [], 'selected' => null, 'active' => null, 'read_only' => false];
$selectedCycle = null;
$selectedCycleId = 0;
$isCycleReadOnly = false;
$cycleLabel = 'لا توجد دورة بعد';
if ($isApproved) {
$cycleContext = resolve_school_cycle_context((int) $application['id'], $application, $requestedCycleId);
$selectedCycle = $cycleContext['selected'];
$selectedCycleId = $selectedCycle ? (int) ($selectedCycle['id'] ?? 0) : 0;
$isCycleReadOnly = (bool) $cycleContext['read_only'];
$cycleLabel = $selectedCycle ? (string) $selectedCycle['cycle_name'] : $cycleLabel;
$cycleRollover = school_cycle_rollover_defaults($selectedCycle);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $isApproved) {
$cycleAction = clean_text((string) ($_POST['cycle_action'] ?? ''), 30);
if ($cycleAction === 'create_cycle') {
[$cycleValues, $cycleErrors] = validate_school_cycle_input($_POST, $application);
$cycleRollover = school_cycle_rollover_input((int) $application['id'], $_POST, $selectedCycle);
$wantsRollover = !empty($cycleRollover['copy_teachers']) || !empty($cycleRollover['copy_assessments']) || !empty($cycleRollover['copy_students']);
if ($wantsRollover && (int) $cycleRollover['source_cycle_id'] <= 0) {
$cycleErrors['form'] = 'اختر دورة مصدر إذا كنت تريد نسخ الفريق أو التقييمات أو الطلاب إلى الدورة الجديدة.';
}
if ($cycleErrors === []) {
try {
$cycleCreation = create_school_cycle((int) $application['id'], $cycleValues, $cycleRollover);
$newCycleId = (int) ($cycleCreation['cycle_id'] ?? 0);
$rolloverSummary = (array) ($cycleCreation['rollover'] ?? []);
$flashMessage = 'تم إنشاء الدورة الموسمية الجديدة بنجاح. يمكنك الآن العمل داخل ' . format_school_cycle_name($cycleValues['season'], (int) $cycleValues['year']) . '.';
$rolloverParts = [];
if (!empty($rolloverSummary['teachers'])) {
$rolloverParts[] = 'ترحيل ' . (int) $rolloverSummary['teachers'] . ' من أعضاء الفريق';
}
if (!empty($rolloverSummary['assessments'])) {
$rolloverParts[] = 'نسخ ' . (int) $rolloverSummary['assessments'] . ' من بنود التقييم';
}
if (!empty($rolloverSummary['students'])) {
$rolloverParts[] = 'نقل ' . (int) $rolloverSummary['students'] . ' من الطلاب المستمرين';
}
if ($rolloverParts !== []) {
$sourceCycleName = (string) ($cycleCreation['source_cycle_name'] ?? 'الدورة السابقة');
$flashMessage .= ' تم أيضاً ' . implode('، ', $rolloverParts) . ' من ' . $sourceCycleName . '.';
}
set_flash('success', $flashMessage);
header('Location: ' . school_page_url('approved_school.php', (int) $application['id'], $newCycleId));
exit;
} catch (PDOException $exception) {
$duplicateCode = isset($exception->errorInfo[1]) && (int) $exception->errorInfo[1] === 1062;
if ($duplicateCode) {
$cycleErrors['year'] = 'هذه الدورة موجودة مسبقاً لهذا المركز. اختر موسماً أو سنة مختلفة.';
} else {
$cycleErrors['form'] = 'تعذر إنشاء الدورة حالياً. يرجى المحاولة مرة أخرى.';
}
} catch (InvalidArgumentException $exception) {
$cycleErrors['form'] = 'تعذر ترحيل البيانات من الدورة المحددة. اختر دورة صحيحة ثم حاول مرة أخرى.';
} catch (Throwable $exception) {
$cycleErrors['form'] = 'تعذر إنشاء الدورة حالياً. يرجى المحاولة مرة أخرى.';
}
}
} elseif ($cycleAction === 'archive_cycle') {
$postedCycleId = (int) ($_POST['cycle_id'] ?? 0);
$cycleToArchive = $postedCycleId > 0 ? get_school_cycle((int) $application['id'], $postedCycleId) : null;
if (!$cycleToArchive) {
$cycleErrors['form'] = 'تعذر العثور على الدورة المطلوب أرشفتها.';
} elseif ((string) $cycleToArchive['status'] === 'archived') {
$cycleErrors['form'] = 'هذه الدورة مؤرشفة بالفعل.';
} else {
archive_school_cycle((int) $application['id'], $postedCycleId);
set_flash('success', 'تمت أرشفة الدورة ' . (string) $cycleToArchive['cycle_name'] . ' بنجاح. يمكنك فتح دورة جديدة متى شئت.');
header('Location: ' . school_page_url('approved_school.php', (int) $application['id']));
exit;
}
}
$cycleContext = resolve_school_cycle_context((int) $application['id'], $application, $requestedCycleId);
$selectedCycle = $cycleContext['selected'];
$selectedCycleId = $selectedCycle ? (int) ($selectedCycle['id'] ?? 0) : 0;
$isCycleReadOnly = (bool) $cycleContext['read_only'];
$cycleLabel = $selectedCycle ? (string) $selectedCycle['cycle_name'] : $cycleLabel;
if ($cycleAction !== 'create_cycle') {
$cycleRollover = school_cycle_rollover_defaults($selectedCycle);
}
}
$scoreValue = $application['evaluation_score'] !== null ? max(0, min(100, (int) $application['evaluation_score'])) : null;
$durationDays = 0;
$startTs = strtotime((string) $application['start_date']);
$endTs = strtotime((string) $application['end_date']);
if ($startTs !== false && $endTs !== false && $endTs >= $startTs) {
$durationDays = (int) floor(($endTs - $startTs) / 86400) + 1;
}
$studentsUrl = school_page_url('students.php', (int) $application['id'], $selectedCycleId);
$teachersUrl = school_page_url('teachers.php', (int) $application['id'], $selectedCycleId);
$assessmentsUrl = school_page_url('assessments.php', (int) $application['id'], $selectedCycleId);
$attendanceUrl = school_page_url('attendance.php', (int) $application['id'], $selectedCycleId);
$approvedSchoolUrl = school_page_url('approved_school.php', (int) $application['id'], $selectedCycleId);
$studentCycleMetrics = $isApproved && $selectedCycleId > 0 ? school_student_metrics_by_cycle((int) $application['id'], $selectedCycleId) : ['total' => 0, 'active' => 0];
$teacherCycleMetrics = $isApproved && $selectedCycleId > 0 ? school_teacher_metrics_by_cycle((int) $application['id'], $selectedCycleId) : ['total' => 0, 'active' => 0];
$assessmentCycleMetrics = $isApproved && $selectedCycleId > 0 ? school_assessment_metrics_by_cycle((int) $application['id'], $selectedCycleId) : ['total' => 0, 'active' => 0, 'active_weight' => 0];
$attendanceCycleMetrics = $isApproved && $selectedCycleId > 0 ? school_attendance_metrics_by_cycle((int) $application['id'], $selectedCycleId) : ['total' => 0, 'today_count' => 0, 'latest_date' => ''];
$pageTitle = $isApproved ? 'صفحة المركز المعتمد: ' . (string) $application['center_name'] . ($selectedCycle ? ' — ' . $cycleLabel : '') : 'صفحة المركز بعد الاعتماد';
$pageDescription = $isApproved
? 'صفحة تشغيلية للمركز المعتمد تعرض الجاهزية، الدورات الموسمية، والخطوات التالية بعد الموافقة.'
: 'هذه الصفحة تصبح متاحة بعد اعتماد طلب المركز من المشرف العام.';
render_page_start($pageTitle, 'approved', $pageDescription, (string) ($application['favicon'] ?? ''));
render_flash($flash);
?>
<section class="py-4 py-lg-5">
<div class="container-xxl">
<?php if (!$isApproved): ?>
<div class="page-banner approved-hero mb-4 mb-lg-5">
<div class="row g-4 align-items-center">
<div class="col-lg-8">
<span class="approved-kicker mb-3">هذه الصفحة تُفتح بعد الاعتماد فقط</span>
<h1 class="page-title mb-3"><?= e((string) $application['center_name']) ?></h1>
<p class="page-copy mb-3">تم تجهيز صفحة الهبوط لهذا المركز، لكنها ستصبح الصفحة التشغيلية الرسمية فقط بعد تغيير الحالة إلى <strong>معتمد</strong>.</p>
<div class="hero-meta">
<span>الحالة الحالية: <?= e(status_meta((string) $application['status'])['label']) ?></span>
<span>مرجع الطلب #<?= e((string) $application['id']) ?></span>
</div>
<div class="cta-stack mt-4">
<a class="btn btn-dark" href="admin.php">لوحة الإدارة</a>
<a class="btn btn-outline-secondary" href="application_detail.php?id=<?= e((string) $application['id']) ?>">العودة لملف المراجعة</a>
<a class="btn btn-outline-secondary" href="applications.php">لوحة الطلبات</a>
</div>
</div>
</div>
</div>
<?php else: ?>
<div class="page-banner approved-hero mb-4 mb-lg-5">
<div class="row g-4 align-items-center">
<div class="col-lg-8">
<span class="approved-kicker mb-3">مركز معتمد وجاهز للانطلاق</span>
<h1 class="page-title mb-3"><?= e((string) $application['center_name']) ?></h1>
<p class="page-copy mb-3">هذه صفحة الهبوط الخاصة بالمركز بعد الاعتماد. يمكن استخدامها كنقطة دخول منظمة لبدء التشغيل، تجهيز التسجيل، ومشاركة المعلومات الأساسية مع فريق المدرسة.</p>
<div class="hero-meta">
<span><?= e((string) $application['city']) ?></span>
<span><?= e((string) $application['center_type']) ?> — <?= e((string) $application['gender_scope']) ?></span>
<span>من <?= e((string) $application['start_date']) ?> إلى <?= e((string) $application['end_date']) ?></span>
</div>
<div class="cta-stack mt-4">
<a class="btn btn-dark" href="admin.php">لوحة الإدارة</a>
<a class="btn btn-outline-secondary" href="application_detail.php?id=<?= e((string) $application['id']) ?>">فتح ملف الاعتماد</a>
<a class="btn btn-outline-secondary" href="center_profile.php?id=<?= e((string) $application['id']) ?>">إعدادات المركز</a>
<a class="btn btn-outline-secondary" href="<?= e($studentsUrl) ?>">تسجيل الطلاب</a>
<a class="btn btn-outline-secondary" href="<?= e($teachersUrl) ?>">فريق المعلمين</a>
<a class="btn btn-outline-secondary" href="<?= e($assessmentsUrl) ?>">التقييمات والأوزان</a>
<a class="btn btn-outline-secondary" href="<?= e($attendanceUrl) ?>">غياب الطلاب</a>
<a class="btn btn-outline-secondary" href="applications.php?status=approved">كل المراكز المعتمدة</a>
<a class="btn btn-outline-secondary" href="dashboard.php">لوحة القيادة</a>
</div>
</div>
<div class="col-lg-4">
<div class="app-card h-100 approved-note">
<div class="section-title mb-3">ملخص الجاهزية</div>
<?php if ($scoreValue !== null): ?>
<div class="score-display mb-3"><strong><?= e((string) $scoreValue) ?>%</strong><span>درجة التقييم</span></div>
<div class="score-bar mb-3" aria-label="درجة التقييم النهائية"><span style="width: <?= e((string) $scoreValue) ?>%"></span></div>
<?php endif; ?>
<div class="summary-stack">
<div class="summary-row"><span>مدير المركز</span><strong><?= e((string) $application['director_name']) ?></strong></div>
<div class="summary-row"><span>السعة المتوقعة</span><strong><?= e((string) $application['expected_students']) ?> طالب</strong></div>
<div class="summary-row"><span>مدة البرنامج</span><strong><?= e((string) ($durationDays > 0 ? $durationDays : '—')) ?> يوم</strong></div>
</div>
</div>
</div>
</div>
</div>
<div class="row g-4 mb-4">
<div class="col-md-6 col-xl-3"><div class="app-card stat-tile"><div class="mini-stat-label">حالة الاعتماد</div><div class="mini-stat-value">معتمد</div><div class="mini-stat-copy">تمت الموافقة الرسمية على تشغيل هذا المركز.</div></div></div>
<div class="col-md-6 col-xl-3"><div class="app-card stat-tile"><div class="mini-stat-label">المقاعد المتوقعة</div><div class="mini-stat-value"><?= e((string) $application['expected_students']) ?></div><div class="mini-stat-copy">الطاقة الاستيعابية المبدئية للتسجيل.</div></div></div>
<div class="col-md-6 col-xl-3"><div class="app-card stat-tile"><div class="mini-stat-label">مدة البرنامج</div><div class="mini-stat-value"><?= e((string) ($durationDays > 0 ? $durationDays : '—')) ?></div><div class="mini-stat-copy">عدد الأيام المخططة بين البداية والنهاية.</div></div></div>
<div class="col-md-6 col-xl-3"><div class="app-card stat-tile"><div class="mini-stat-label">مرجع التشغيل</div><div class="mini-stat-value">#<?= e((string) $application['id']) ?></div><div class="mini-stat-copy">استخدم هذا الرقم في أي متابعة إدارية لاحقة.</div></div></div>
</div>
<?php if ($selectedCycle): ?>
<div class="row g-4 mb-4" id="cycles">
<div class="col-lg-8">
<div class="app-card h-100">
<div class="section-head mb-3">
<div>
<div class="section-title">الدورات الموسمية والأرشفة</div>
<div class="section-copy">كل الطلاب والمعلمين والتقييمات والغياب أصبحت الآن مرتبطة بدورة مستقلة مثل <strong>Summer 2026</strong> أو <strong>Winter 2026</strong>. عند نهاية الموسم قم بأرشفة الدورة الحالية ثم ابدأ دورة جديدة للحفاظ على التاريخ بدون خلط السجلات.</div>
</div>
<?= school_cycle_status_badge((string) $selectedCycle['status']) ?>
</div>
<div class="row g-3 mb-3">
<div class="col-md-4"><div class="school-data-item"><strong>الدورة المحددة</strong><span><?= e($cycleLabel) ?></span></div></div>
<div class="col-md-4"><div class="school-data-item"><strong>الفترة</strong><span><?= e((string) $selectedCycle['start_date']) ?> → <?= e((string) $selectedCycle['end_date']) ?></span></div></div>
<div class="col-md-4"><div class="school-data-item"><strong>حالة الدورة</strong><span><?= e((string) school_cycle_status_map()[$selectedCycle['status']]['label']) ?></span></div></div>
<div class="col-md-3"><div class="school-data-item"><strong>الطلاب</strong><span><?= e((string) $studentCycleMetrics['total']) ?></span></div></div>
<div class="col-md-3"><div class="school-data-item"><strong>الفريق</strong><span><?= e((string) $teacherCycleMetrics['total']) ?></span></div></div>
<div class="col-md-3"><div class="school-data-item"><strong>التقييمات النشطة</strong><span><?= e((string) $assessmentCycleMetrics['active']) ?></span></div></div>
<div class="col-md-3"><div class="school-data-item"><strong>سجلات الغياب</strong><span><?= e((string) $attendanceCycleMetrics['total']) ?></span></div></div>
</div>
<div class="cta-stack">
<a class="btn btn-dark" href="<?= e($studentsUrl) ?>">طلاب هذه الدورة</a>
<a class="btn btn-outline-secondary" href="<?= e($teachersUrl) ?>">فريق هذه الدورة</a>
<a class="btn btn-outline-secondary" href="<?= e($assessmentsUrl) ?>">تقييمات هذه الدورة</a>
<a class="btn btn-outline-secondary" href="<?= e($attendanceUrl) ?>">غياب هذه الدورة</a>
<?php if (!$isCycleReadOnly): ?>
<form method="post" class="d-inline">
<input type="hidden" name="cycle_action" value="archive_cycle">
<input type="hidden" name="cycle_id" value="<?= e((string) $selectedCycleId) ?>">
<button class="btn btn-outline-danger" type="submit">أرشفة هذه الدورة</button>
</form>
<?php endif; ?>
</div>
<?php if ($isCycleReadOnly): ?>
<div class="alert alert-warning mt-3 mb-0">هذه الدورة مؤرشفة حالياً، لذلك كل الصفحات المرتبطة بها أصبحت للقراءة فقط. يمكنك فتح دورة جديدة من النموذج المجاور.</div>
<?php endif; ?>
</div>
</div>
<div class="col-lg-4">
<div class="app-card sidebar-card mb-4">
<div class="section-title mb-3">كل دورات المركز</div>
<div class="quick-link-stack">
<?php foreach ($cycleContext['cycles'] as $cycle): ?>
<a class="quick-link-item" href="<?= e(school_page_url('approved_school.php', (int) $application['id'], (int) $cycle['id'])) ?>#cycles"><strong><?= e((string) $cycle['cycle_name']) ?></strong><span><?= e((string) $cycle['start_date']) ?> → <?= e((string) $cycle['end_date']) ?> — <?= e((string) school_cycle_status_map()[$cycle['status']]['label']) ?></span></a>
<?php endforeach; ?>
</div>
</div>
<div class="app-card sidebar-card">
<div class="section-title mb-3">فتح دورة جديدة</div>
<p class="section-subtle mb-3">استخدم هذا النموذج عند نهاية الصيف أو الشتاء لبدء دورة جديدة باسم تلقائي مثل Summer 2026 أو Winter 2026.</p>
<?php if (isset($cycleErrors['form'])): ?><div class="alert alert-danger mb-3"><?= e($cycleErrors['form']) ?></div><?php endif; ?>
<form method="post" class="vstack gap-3" novalidate>
<input type="hidden" name="cycle_action" value="create_cycle">
<div>
<label class="form-label" for="season">الموسم</label>
<select class="form-select <?= isset($cycleErrors['season']) ? 'is-invalid' : '' ?>" id="season" name="season">
<?php foreach (school_cycle_season_options() as $seasonKey => $seasonMeta): ?>
<option value="<?= e($seasonKey) ?>" <?= $cycleValues['season'] === $seasonKey ? 'selected' : '' ?>><?= e((string) $seasonMeta['label']) ?></option>
<?php endforeach; ?>
</select>
<?php if (isset($cycleErrors['season'])): ?><div class="invalid-feedback"><?= e($cycleErrors['season']) ?></div><?php endif; ?>
</div>
<div>
<label class="form-label" for="year">السنة</label>
<input class="form-control <?= isset($cycleErrors['year']) ? 'is-invalid' : '' ?>" id="year" name="year" value="<?= e($cycleValues['year']) ?>" inputmode="numeric" placeholder="2026">
<?php if (isset($cycleErrors['year'])): ?><div class="invalid-feedback"><?= e($cycleErrors['year']) ?></div><?php endif; ?>
</div>
<div class="row g-3">
<div class="col-md-6">
<label class="form-label" for="start_date">تاريخ البداية</label>
<input class="form-control <?= isset($cycleErrors['start_date']) ? 'is-invalid' : '' ?>" id="start_date" name="start_date" type="date" value="<?= e($cycleValues['start_date']) ?>">
<?php if (isset($cycleErrors['start_date'])): ?><div class="invalid-feedback"><?= e($cycleErrors['start_date']) ?></div><?php endif; ?>
</div>
<div class="col-md-6">
<label class="form-label" for="end_date">تاريخ النهاية</label>
<input class="form-control <?= isset($cycleErrors['end_date']) ? 'is-invalid' : '' ?>" id="end_date" name="end_date" type="date" value="<?= e($cycleValues['end_date']) ?>">
<?php if (isset($cycleErrors['end_date'])): ?><div class="invalid-feedback"><?= e($cycleErrors['end_date']) ?></div><?php endif; ?>
</div>
</div>
<div>
<label class="form-label" for="status">حالة البداية</label>
<select class="form-select <?= isset($cycleErrors['status']) ? 'is-invalid' : '' ?>" id="status" name="status">
<option value="active" <?= $cycleValues['status'] === 'active' ? 'selected' : '' ?>>نشطة مباشرة</option>
<option value="upcoming" <?= $cycleValues['status'] === 'upcoming' ? 'selected' : '' ?>>قادمة</option>
</select>
<?php if (isset($cycleErrors['status'])): ?><div class="invalid-feedback"><?= e($cycleErrors['status']) ?></div><?php endif; ?>
</div>
<?php if (!empty($cycleContext['cycles'])): ?>
<div class="border rounded-3 p-3 bg-light-subtle">
<div class="fw-semibold mb-2">ترحيل البيانات من دورة سابقة</div>
<p class="small text-muted mb-3">اختر الدورة التي تريد النسخ منها. الغياب لا يُنقل أبداً، والطلاب المنقولون يقتصرون على الحالات المستمرة فقط.</p>
<div class="mb-3">
<label class="form-label" for="source_cycle_id">النسخ من دورة</label>
<select class="form-select" id="source_cycle_id" name="source_cycle_id">
<option value="0">بدون نسخ مسبق</option>
<?php foreach ($cycleContext['cycles'] as $cycle): ?>
<option value="<?= e((string) $cycle['id']) ?>" <?= (int) $cycleRollover['source_cycle_id'] === (int) $cycle['id'] ? 'selected' : '' ?>><?= e((string) $cycle['cycle_name']) ?> — <?= e((string) school_cycle_status_map()[$cycle['status']]['label']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="vstack gap-2">
<label class="form-check">
<input class="form-check-input" type="checkbox" name="copy_teachers" value="1" <?= !empty($cycleRollover['copy_teachers']) ? 'checked' : '' ?>>
<span class="form-check-label">نسخ الفريق التعليمي والوظائف الحالية</span>
</label>
<label class="form-check">
<input class="form-check-input" type="checkbox" name="copy_assessments" value="1" <?= !empty($cycleRollover['copy_assessments']) ? 'checked' : '' ?>>
<span class="form-check-label">نسخ خطة التقييم والأوزان</span>
</label>
<label class="form-check">
<input class="form-check-input" type="checkbox" name="copy_students" value="1" <?= !empty($cycleRollover['copy_students']) ? 'checked' : '' ?>>
<span class="form-check-label">نسخ الطلاب المستمرين فقط (نشط / انتظار)</span>
</label>
</div>
</div>
<?php endif; ?>
<button class="btn btn-dark" type="submit">إنشاء الدورة الجديدة</button>
</form>
</div>
</div>
</div>
<?php endif; ?>
<div class="row g-4 align-items-start">
<div class="col-lg-8">
<div class="app-card mb-4">
<div class="section-head mb-3">
<div>
<div class="section-title">نبذة المدرسة / المركز</div>
<div class="section-copy">الرسالة المختصرة التي تظهر مباشرة بعد الاعتماد لتلخيص هوية المركز وما يقدمه.</div>
</div>
</div>
<p class="mb-0 text-muted"><?= nl2br(e((string) ($application['notes'] ?: 'مركز صيفي معتمد لتقديم برنامج منظم يجمع بين الأنشطة التعليمية والتربوية والمهارية تحت إشراف الولاية.'))) ?></p>
</div>
<div class="app-card mb-4">
<div class="section-title mb-3">أسباب الجاهزية والاعتماد</div>
<div class="highlight-grid">
<div class="highlight-item">
<strong>ملف مكتمل</strong>
<p>تمت مراجعة البيانات الأساسية، المسؤول المباشر، وفترة التشغيل المقترحة قبل إصدار الاعتماد.</p>
</div>
<div class="highlight-item">
<strong>خطة تشغيل واضحة</strong>
<p>توجد سعة متوقعة وبرنامج زمني محدد يساعدان على بدء التسجيل وإسناد المهام بسرعة.</p>
</div>
<div class="highlight-item">
<strong>قابلية للإطلاق</strong>
<p>يمكن اعتماد هذه الصفحة كنقطة انتقال من المراجعة إلى الإدارة اليومية ثم التوسع لوحدات الطلاب والغياب والتقييم.</p>
</div>
</div>
</div>
<div class="app-card">
<div class="section-title mb-3">الخطوات التالية بعد الموافقة</div>
<div class="next-step-grid">
<div class="next-step-card">
<strong>1) فتح التسجيل</strong>
<p>المرحلة التالية المنطقية أصبحت جاهزة الآن: يمكن فتح صفحة مستقلة لتسجيل الطلاب وربطها مباشرة بالمركز المعتمد.</p>
</div>
<div class="next-step-card">
<strong>2) تجهيز الفريق</strong>
<p>صفحة الفريق أصبحت جاهزة الآن لإضافة المعلمين والمشرفين وربط أدوارهم التشغيلية مباشرة بالمركز المعتمد.</p>
</div>
<div class="next-step-card">
<strong>3) ضبط التقييمات</strong>
<p>صفحة التقييمات أصبحت جاهزة الآن لتحديد نوع التقييم، المقياس، والوزن قبل بدء الرصد والمتابعة.</p>
</div>
<div class="next-step-card">
<strong>4) متابعة الغياب</strong>
<p>صفحة غياب الطلاب أصبحت جاهزة الآن لتسجيل الغياب اليومي، الأعذار، وحالات التأخر لكل طالب داخل المركز.</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="app-card sidebar-card mb-4">
<div class="section-title mb-3">بيانات التواصل</div>
<div class="contact-stack">
<div class="contact-item"><strong>مدير المركز</strong><span><?= e((string) $application['director_name']) ?></span></div>
<div class="contact-item"><strong>الهاتف</strong><span><?= e((string) $application['phone']) ?></span></div>
<div class="contact-item"><strong>البريد الإلكتروني</strong><span><?= e((string) $application['email']) ?></span></div>
<div class="contact-item"><strong>المدينة</strong><span><?= e((string) $application['city']) ?></span></div>
</div>
</div>
<div class="app-card sidebar-card mb-4">
<div class="section-title mb-3">ملاحظات الاعتماد</div>
<p class="mb-0 text-muted"><?= nl2br(e((string) ($application['admin_notes'] ?: 'لا توجد ملاحظات إضافية. يمكن اعتبار هذه الصفحة النسخة الأولى من واجهة المركز بعد الاعتماد.'))) ?></p>
</div>
<div class="app-card sidebar-card">
<div class="section-title mb-3">روابط تشغيلية سريعة</div>
<div class="quick-link-stack">
<a class="quick-link-item" href="<?= e($studentsUrl) ?>"><strong>تسجيل الطلاب</strong><span>فتح صفحة القيد وكشف المدرسة لهذا المركز.</span></a>
<a class="quick-link-item" href="<?= e($teachersUrl) ?>"><strong>فريق المعلمين</strong><span>إدارة المعلمين والمشرفين والكوادر التشغيلية للمركز.</span></a>
<a class="quick-link-item" href="<?= e($assessmentsUrl) ?>"><strong>التقييمات والأوزان</strong><span>تعريف أنواع التقييم، المقاييس، والأوزان التشغيلية لهذا المركز.</span></a>
<a class="quick-link-item" href="<?= e($attendanceUrl) ?>"><strong>غياب الطلاب</strong><span>تسجيل الغياب اليومي، الأعذار، وحالات التأخر للطلاب المعتمدين.</span></a>
<a class="quick-link-item" href="application_detail.php?id=<?= e((string) $application['id']) ?>"><strong>ملف الاعتماد</strong><span>العودة إلى سجل القرار والتقييم.</span></a>
<a class="quick-link-item" href="center_profile.php?id=<?= e((string) $application['id']) ?>"><strong>إعدادات المركز</strong><span>تعديل الشعار والهوية وبيانات التواصل.</span></a>
<a class="quick-link-item" href="applications.php?status=approved"><strong>المراكز المعتمدة</strong><span>عرض بقية المراكز الجاهزة للتشغيل.</span></a>
<a class="quick-link-item" href="dashboard.php"><strong>لوحة القيادة</strong><span>الرجوع إلى المؤشرات العامة على مستوى الولاية.</span></a>
<a class="quick-link-item" href="admin.php"><strong>لوحة الإدارة</strong><span>الرجوع إلى البوابة المركزية لكل الشاشات الإدارية.</span></a>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</section>
<?php render_page_end();