fix enrollment and email send to parent
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user