fix registration enrollment of students
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user