This commit is contained in:
@@ -14,6 +14,11 @@ $deadlineObj = (new DateTime($lastDayOfRegistration, new DateTimeZone($tz)))->se
|
||||
$nowObj = new DateTime('now', new DateTimeZone($tz));
|
||||
$deadlinePassed = $nowObj > $deadlineObj;
|
||||
$deadlineISO = $deadlineObj->format('Y-m-d\TH:i:sP'); // for JS
|
||||
$familyFinancialSummary = is_array($familyFinancialSummary ?? null) ? $familyFinancialSummary : [];
|
||||
$money = static function ($amount) use ($familyFinancialSummary): string {
|
||||
$currency = (string) ($familyFinancialSummary['currency'] ?? '$');
|
||||
return $currency . number_format((float) $amount, 2);
|
||||
};
|
||||
?>
|
||||
<!-- Registration Info -->
|
||||
<div class="alert alert-info mb-3">
|
||||
@@ -25,84 +30,46 @@ $deadlineISO = $deadlineObj->format('Y-m-d\TH:i:sP'); // for JS
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php if ($familyFinancialSummary !== []): ?>
|
||||
<div class="border rounded p-3 mb-3 bg-light">
|
||||
<div class="fw-semibold mb-2">Family Account Information</div>
|
||||
<div class="row g-2">
|
||||
<div class="col-md-4">
|
||||
<span class="text-muted">Previous-year carry-over balance:</span>
|
||||
<strong><?= esc($money($familyFinancialSummary['carry_over_balance'] ?? 0)) ?></strong>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span class="text-muted">Registration fee:</span>
|
||||
<strong><?= esc($money($familyFinancialSummary['registration_fee'] ?? 0)) ?></strong>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span class="text-muted">Tuition due now:</span>
|
||||
<strong><?= esc($money($familyFinancialSummary['tuition_due_at_registration'] ?? 0)) ?></strong>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span class="text-muted">Mandatory fees:</span>
|
||||
<strong><?= esc($money($familyFinancialSummary['mandatory_fees'] ?? 0)) ?></strong>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span class="text-muted">Current-year account balance:</span>
|
||||
<strong><?= esc($money($familyFinancialSummary['current_balance'] ?? 0)) ?></strong>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span class="text-muted">Total currently due:</span>
|
||||
<strong><?= esc($money($familyFinancialSummary['amount_due'] ?? 0)) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (!empty($familyFinancialSummary['policy_message'])): ?>
|
||||
<div class="small text-muted mt-2"><?= esc($familyFinancialSummary['policy_message']) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (session()->getFlashdata('error')): ?>
|
||||
<div class="alert alert-danger"><?= esc(session()->getFlashdata('error')) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $hasAcceptedSchoolPolicy = (bool) ($hasAcceptedSchoolPolicy ?? false); ?>
|
||||
<?php
|
||||
$fallMakeupExamLabel = !empty($fallMakeupExamOn) ? local_date($fallMakeupExamOn, 'm-d-Y') : null;
|
||||
$decisionMessageForStudent = static function (array $student) use ($fallMakeupExamLabel): array {
|
||||
$decisionRow = is_array($student['previous_year_decision'] ?? null) ? $student['previous_year_decision'] : [];
|
||||
$decision = trim((string) ($decisionRow['decision'] ?? ''));
|
||||
$source = strtolower(trim((string) ($decisionRow['source'] ?? '')));
|
||||
$decisionKey = strtolower($decision);
|
||||
$name = trim((string) ($student['firstname'] ?? 'Your child') . ' ' . (string) ($student['lastname'] ?? ''));
|
||||
$name = $name !== '' ? $name : 'Your child';
|
||||
$previousClass = trim((string) ($decisionRow['class_section_name'] ?? ''));
|
||||
$previousClass = $previousClass !== '' ? $previousClass : 'the same class';
|
||||
|
||||
if ($decisionKey === 'pass' || ($decisionKey === '' && $source !== 'pending')) {
|
||||
return ['message' => '', 'blocking' => false, 'level' => 'info'];
|
||||
}
|
||||
|
||||
if ($decisionKey === 'make-up exam in fall') {
|
||||
$dateText = $fallMakeupExamLabel !== null ? ' on ' . $fallMakeupExamLabel : '';
|
||||
return [
|
||||
'message' => $name . ' has a make-up exam decision. Enrollment can be completed only after the fall make-up exam' . $dateText . ' and after the result is finalized.',
|
||||
'blocking' => true,
|
||||
'level' => 'warning',
|
||||
];
|
||||
}
|
||||
|
||||
if ($decisionKey === 'deferred decision') {
|
||||
return [
|
||||
'message' => $name . ' has a deferred decision. Enrollment can be completed only after you visit the administration to discuss your child\'s situation.',
|
||||
'blocking' => true,
|
||||
'level' => 'warning',
|
||||
];
|
||||
}
|
||||
|
||||
if ($decisionKey === 'repeat class') {
|
||||
return [
|
||||
'message' => $name . ' has a repeat class decision and is accepted only in ' . $previousClass . '.',
|
||||
'blocking' => false,
|
||||
'level' => 'info',
|
||||
];
|
||||
}
|
||||
|
||||
if ($decisionKey === 'expel') {
|
||||
return [
|
||||
'message' => $name . ' has an expel decision. Enrollment cannot be completed online; please contact the administration.',
|
||||
'blocking' => true,
|
||||
'level' => 'danger',
|
||||
];
|
||||
}
|
||||
|
||||
if ($decisionKey === 'withdrawn') {
|
||||
return [
|
||||
'message' => $name . ' was marked withdrawn in the final decision. Please contact the administration before requesting enrollment.',
|
||||
'blocking' => true,
|
||||
'level' => 'warning',
|
||||
];
|
||||
}
|
||||
|
||||
if ($decisionKey === '' || $source === 'pending') {
|
||||
return [
|
||||
'message' => $name . ' does not have a final promotion decision yet. Enrollment can be completed only after the administration finalizes the decision.',
|
||||
'blocking' => true,
|
||||
'level' => 'warning',
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'message' => $name . ' has a "' . $decision . '" decision. Please contact the administration before requesting enrollment.',
|
||||
'blocking' => true,
|
||||
'level' => 'warning',
|
||||
];
|
||||
};
|
||||
?>
|
||||
|
||||
<?php if (!empty($students)): ?>
|
||||
<form action="<?= base_url('/parent/enroll_classes_handler') ?>" method="post">
|
||||
<?= csrf_field() ?>
|
||||
@@ -118,6 +85,8 @@ $decisionMessageForStudent = static function (array $student) use ($fallMakeupEx
|
||||
<th>Age</th>
|
||||
<th>Gender</th>
|
||||
<th>Grade</th>
|
||||
<th>Decision</th>
|
||||
<th>Required Action</th>
|
||||
<th>Enroll</th>
|
||||
<th>Withdraw</th>
|
||||
<th>Status</th>
|
||||
@@ -125,7 +94,7 @@ $decisionMessageForStudent = static function (array $student) use ($fallMakeupEx
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($students as $index => $student): ?>
|
||||
<?php $decisionMessage = $decisionMessageForStudent($student); ?>
|
||||
<?php $eligibilityMessage = is_array($student['enrollment_eligibility_message'] ?? null) ? $student['enrollment_eligibility_message'] : ['message' => '', 'blocking' => false, 'level' => 'info']; ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?= esc($student['school_id'] ?? 'N/A') ?></td>
|
||||
@@ -141,19 +110,21 @@ $decisionMessageForStudent = static function (array $student) use ($fallMakeupEx
|
||||
: 'Not Assigned';
|
||||
?>
|
||||
</td>
|
||||
<td><?= esc($student['transition_evaluation']['decision_label'] ?? 'Pending') ?></td>
|
||||
<td><?= esc($student['required_action_label'] ?? 'Contact the school administration.') ?></td>
|
||||
|
||||
<!-- Enroll Checkbox -->
|
||||
<td>
|
||||
<?php if ($student['enrollment_status'] === 'not enrolled'): ?>
|
||||
<?php $disableEnrollUI = $deadlinePassed || !$isEditable; ?>
|
||||
<?php $disableEnrollUI = $deadlinePassed || !$isEditable || (bool) ($eligibilityMessage['blocking'] ?? false); ?>
|
||||
<input type="checkbox"
|
||||
name="enroll[]"
|
||||
value="<?= esc($student['id']) ?>"
|
||||
data-decision-message="<?= esc($decisionMessage['message']) ?>"
|
||||
data-decision-blocking="<?= $decisionMessage['blocking'] ? '1' : '0' ?>"
|
||||
data-decision-message="<?= esc($eligibilityMessage['message'] ?? '') ?>"
|
||||
data-decision-blocking="<?= !empty($eligibilityMessage['blocking']) ? '1' : '0' ?>"
|
||||
data-decision-message-target="enrollment-decision-message-<?= esc($student['id']) ?>"
|
||||
<?= $disableEnrollUI ? 'disabled' : '' ?>>
|
||||
<?php elseif (in_array($student['enrollment_status'], ['enrolled', 'admission under review', 'payment pending', 'withdraw under review'])): ?>
|
||||
<?php elseif (in_array($student['enrollment_status'], ['enrolled', 'admission under review', 'review & decision', 'payment pending', 'withdraw under review'])): ?>
|
||||
<input type="checkbox" checked disabled>
|
||||
<?php else: ?>
|
||||
<input type="checkbox" disabled>
|
||||
@@ -180,6 +151,9 @@ $decisionMessageForStudent = static function (array $student) use ($fallMakeupEx
|
||||
case 'admission under review':
|
||||
echo '<span class="badge bg-primary">admission under review</span>';
|
||||
break;
|
||||
case 'review & decision':
|
||||
echo '<span class="badge bg-secondary">review & decision</span>';
|
||||
break;
|
||||
case 'payment pending':
|
||||
echo '<span class="badge bg-warning text-dark">payment pending</span>';
|
||||
break;
|
||||
@@ -210,11 +184,11 @@ $decisionMessageForStudent = static function (array $student) use ($fallMakeupEx
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($decisionMessage['message'] !== ''): ?>
|
||||
<tr id="enrollment-decision-message-<?= esc($student['id']) ?>" class="enrollment-decision-message-row d-none">
|
||||
<td colspan="10">
|
||||
<div class="alert alert-<?= esc($decisionMessage['level']) ?> mb-0">
|
||||
<?= esc($decisionMessage['message']) ?>
|
||||
<?php if (($eligibilityMessage['message'] ?? '') !== ''): ?>
|
||||
<tr id="enrollment-decision-message-<?= esc($student['id']) ?>" class="enrollment-decision-message-row">
|
||||
<td colspan="12">
|
||||
<div class="alert alert-<?= esc($eligibilityMessage['level'] ?? 'info') ?> mb-0">
|
||||
<?= esc($eligibilityMessage['message']) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -363,8 +337,6 @@ $decisionMessageForStudent = static function (array $student) use ($fallMakeupEx
|
||||
// 1) Block clicking "enroll" checkboxes after deadline
|
||||
document.querySelectorAll("input[name='enroll[]']").forEach(cb => {
|
||||
cb.addEventListener("click", function(e) {
|
||||
hideAllDecisionMessages();
|
||||
|
||||
if (deadlinePassed) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
Reference in New Issue
Block a user