fix registration enrollment of students
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 48s
Tests / PHPUnit (push) Successful in 1m19s

This commit is contained in:
root
2026-08-26 21:36:03 -04:00
parent a354d78fa9
commit 9676261d65
7 changed files with 208 additions and 53 deletions
+11 -3
View File
@@ -100,14 +100,22 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
</div>
<?php endif; ?>
<?php
// Check if at least one student is not enrolled
$hasUnenrolled = false;
$unenrolledStudentIds = [];
foreach ($existingKids as $kid) {
if ($kid['enrollment'] == 0) {
$hasUnenrolled = true;
break;
$studentId = (int) ($kid['id'] ?? 0);
if ($studentId > 0) {
$unenrolledStudentIds[] = $studentId;
}
}
}
usort($unenrolledStudentIds, static fn (int $a, int $b): int => $b <=> $a);
$enrollmentUrl = base_url('/parent/enroll_classes?' . http_build_query([
'start' => 2,
'students' => implode(',', $unenrolledStudentIds),
]));
?>
<?php if ($hasUnenrolled): ?>
@@ -118,7 +126,7 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
<p class="mb-3">
Please complete their enrollment using the button below to ensure they are able to attend classes.
</p>
<a href="<?= base_url('/parent/enroll_classes') ?>"
<a href="<?= esc($enrollmentUrl) ?>"
class="btn btn-lg btn-success bi bi-pencil-square"
data-bs-toggle="tooltip"
data-bs-placement="bottom"