fix enrollment and email send to parent
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 49s
Tests / PHPUnit (push) Failing after 1m20s

This commit is contained in:
root
2026-08-27 12:39:08 -04:00
parent 7b86cf5218
commit 0ae9993d82
19 changed files with 37831 additions and 1313 deletions
+20 -5
View File
@@ -279,7 +279,20 @@ $hasSettledEnrollmentStatus = static function (?string $status, ?string $admissi
};
$enrollableCount = 0;
$withdrawableCount = 0;
$currentYearTuitionStudentCount = 0;
foreach (($students ?? []) as $student) {
$studentStatus = strtolower(trim((string) ($student['enrollment_status'] ?? '')));
$studentAdmissionStatus = strtolower(trim((string) ($student['admission_status'] ?? '')));
if (
! in_array($studentStatus, ['withdrawn', 'withdraw under review', 'refund pending', 'denied', 'not enrolled'], true)
&& (
in_array($studentStatus, ['admission under review', 'review & decision', 'payment pending', 'enrolled', 'waitlist'], true)
|| $studentAdmissionStatus === 'accepted'
)
) {
$currentYearTuitionStudentCount++;
}
$evaluation = is_array($student['transition_evaluation'] ?? null) ? $student['transition_evaluation'] : [];
if (
(($evaluation['can_enroll'] ?? false) === true || ($evaluation['parent_enrollment_allowed'] ?? false) === true)
@@ -942,6 +955,7 @@ $studentCount = count($students ?? []);
'carryOverBalance' => (float) ($familyFinancialSummary['carry_forward_balance'] ?? $familyFinancialSummary['carry_over_balance'] ?? 0),
'currentBalance' => (float) ($familyFinancialSummary['current_year_balance'] ?? $familyFinancialSummary['current_balance'] ?? 0),
'amountDue' => (float) ($familyFinancialSummary['total_enrollment_due'] ?? $familyFinancialSummary['amount_due'] ?? 0),
'currentYearTuitionStudentCount' => (int) ($currentYearTuitionStudentCount ?? 0),
], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) ?>;
let currentStep = 0;
let hasAcceptedSchoolPolicy = <?= $hasAcceptedSchoolPolicy ? 'true' : 'false' ?>;
@@ -975,7 +989,8 @@ $studentCount = count($students ?? []);
function calculateSelectedTuition() {
return selectedEnrollInputs().reduce((total, input, index) => {
return total + (index === 0 ? Number(feeSchedule.firstStudentFee || 0) : Number(feeSchedule.secondStudentFee || 0));
const familyPosition = Number(familyFinancial.currentYearTuitionStudentCount || 0) + index;
return total + (familyPosition === 0 ? Number(feeSchedule.firstStudentFee || 0) : Number(feeSchedule.secondStudentFee || 0));
}, 0);
}
@@ -1037,8 +1052,8 @@ $studentCount = count($students ?? []);
}
feeReviewList.innerHTML = cards.map((student, index) => {
const tuitionFee = index === 0 ? feeSchedule.firstStudentFee : feeSchedule.secondStudentFee;
const tier = index === 0 ? 'First student tuition tier' : 'Additional student tuition tier';
const familyPosition = Number(familyFinancial.currentYearTuitionStudentCount || 0) + index;
const tuitionFee = familyPosition === 0 ? feeSchedule.firstStudentFee : feeSchedule.secondStudentFee;
const lines = [
['Student', student.name],
['School ID', student.schoolId || 'N/A'],
@@ -1717,11 +1732,11 @@ $studentCount = count($students ?? []);
});
refreshEligibility().then(() => {
if (enrollmentStartStep >= 2 && startButton && !startButton.disabled && !<?= $flashError ? 'true' : 'false' ?>) {
if (enrollmentStartStep >= 1 && startButton && !startButton.disabled && !<?= $flashError ? 'true' : 'false' ?>) {
openEnrollmentAtStep(enrollmentStartStep - 1);
}
}).catch(() => {
if (enrollmentStartStep >= 2 && startButton && !startButton.disabled && !<?= $flashError ? 'true' : 'false' ?>) {
if (enrollmentStartStep >= 1 && startButton && !startButton.disabled && !<?= $flashError ? 'true' : 'false' ?>) {
openEnrollmentAtStep(enrollmentStartStep - 1);
}
// Keep server-rendered eligibility if refresh fails.