This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
$isEditable = isset($isEditable) ? (bool) $isEditable : true;
|
||||
$selectedYear = trim((string) ($selectedYear ?? ''));
|
||||
$disableStudentBtn = count($existingKids) >= $maxChilds;
|
||||
$disableEmergencyBtn = count($emergencies) >= $maxEmergency;
|
||||
?>
|
||||
@@ -7,6 +9,14 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
|
||||
<?= $this->section('content') ?>
|
||||
<div class="container my-5">
|
||||
<h3 class="text-center text-success mb-3" style="font-family: Arial, sans-serif;">Student Registration</h3>
|
||||
<?php if ($selectedYear !== ''): ?>
|
||||
<div class="text-center text-muted mb-3">School year: <?= esc($selectedYear) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if (!$isEditable): ?>
|
||||
<div class="alert alert-warning">
|
||||
This school year is read-only. Switch to the active school year to register or edit students.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($disableStudentBtn): ?>
|
||||
<div class="alert alert-info mt-2">You've reached the maximum number of students (<?= $maxChilds ?>).</div>
|
||||
<?php endif; ?>
|
||||
@@ -100,7 +110,7 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
|
||||
?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?php if ($kid['enrollment'] == 0): ?>
|
||||
<?php if ($isEditable && $kid['enrollment'] == 0): ?>
|
||||
<form action="<?= base_url('/parent/delete_student/' . $kid['id']) ?>"
|
||||
method="post"
|
||||
style="display:inline">
|
||||
@@ -116,7 +126,7 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
|
||||
</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" disabled title="Student is already enrolled">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" disabled title="<?= $isEditable ? 'Student is already enrolled' : 'This school year is read-only' ?>">
|
||||
<i class="fas fa-ban"></i> Delete
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
@@ -162,7 +172,7 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
|
||||
<?php
|
||||
$today = local_date(utc_now(), 'Y-m-d');
|
||||
$disableDueToDate = ($today >= $lastDayOfRegistration);
|
||||
$disableAll = $disableStudentBtn || $disableDueToDate;
|
||||
$disableAll = $disableStudentBtn || $disableDueToDate || ! $isEditable;
|
||||
?>
|
||||
<form action="<?= base_url('/parent/register_student/save') ?>"
|
||||
method="post"
|
||||
@@ -183,6 +193,8 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
|
||||
title="<?php
|
||||
if ($disableStudentBtn) {
|
||||
echo "Maximum of $maxChilds students reached.";
|
||||
} elseif (!$isEditable) {
|
||||
echo "This school year is read-only.";
|
||||
} elseif ($disableDueToDate) {
|
||||
echo "Registration is closed after $lastDayOfRegistration.";
|
||||
}
|
||||
@@ -199,6 +211,8 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
|
||||
title="<?php
|
||||
if ($disableStudentBtn) {
|
||||
echo "Maximum of $maxChilds students reached.";
|
||||
} elseif (!$isEditable) {
|
||||
echo "This school year is read-only.";
|
||||
} elseif ($disableDueToDate) {
|
||||
echo "Registration is closed after $lastDayOfRegistration.";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user