fix is_active student flag logic and make moving with enrollment status
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 47s
Tests / PHPUnit (push) Successful in 1m16s

This commit is contained in:
root
2026-08-20 03:11:37 -04:00
parent 6f722795c5
commit 0a31aa1393
20 changed files with 588 additions and 489 deletions
@@ -54,7 +54,7 @@ if (!function_exists('enrollment_admin_flag_label')) {
{
return match ($type) {
'CLASS_REASSIGNMENT_REQUIRED' => 'Assign a class',
'PENDING_MAKE_UP_EXAM_PROMOTION' => 'Makeup exam result',
'PENDING_MAKE_UP_EXAM_PROMOTION' => 'Makeup exam',
'AGE_EXCEPTION_REQUIRED' => 'Age exception',
'LATE_REGISTRATION_EXCEPTION' => 'Late registration',
'FINANCIAL_REVIEW_REQUIRED' => 'Finance review',
@@ -359,7 +359,7 @@ $reasonCodes = is_array($exceptionReasonCodes ?? null) ? $exceptionReasonCodes :
<?php elseif ($flagTypeValue === 'PENDING_MAKE_UP_EXAM_PROMOTION'): ?>
<form method="post" action="<?= site_url('administrator/enrollment-admin/flags/' . $flagId . '/makeup-promotion') ?>" class="mb-2">
<?= csrf_field() ?>
<div class="small fw-semibold mb-1">Record the makeup exam result</div>
<div class="small fw-semibold mb-1">Record the makeup exam</div>
<select class="form-select form-select-sm mb-2" name="exam_result" required>
<option value="">Exam result</option>
<option value="passed">Passed</option>
@@ -1,135 +0,0 @@
<?php
$activeStudents = $active_students ?? [];
$removedStudents = $removed_students ?? [];
$schoolYear = $school_year ?? '';
$activeSchoolYear = $active_school_year ?? '';
?>
<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<div class="container-fluid">
<div class="wrapper">
<div class="content">
<h2 class="text-center mt-4 mb-2">Student Removal</h2>
<p class="text-center text-muted mb-4">
Active school year: <?= esc($schoolYear !== '' ? $schoolYear : $activeSchoolYear) ?>.
Active students have a class assignment in the active school year. Removed students are inactive or have no active-year assignment.
</p>
<?= $this->include('partials/flash_messages') ?>
<div class="card mb-4 shadow-sm">
<div class="card-header d-flex align-items-center justify-content-between">
<span>Active Students</span>
<span class="badge bg-primary"><?= count($activeStudents) ?></span>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="activeStudentsTable" class="table table-striped table-hover align-middle">
<thead class="table-dark">
<tr>
<th>School ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Class</th>
<th style="min-width: 140px;">Action</th>
</tr>
</thead>
<tbody>
<?php if (!empty($activeStudents)): ?>
<?php foreach ($activeStudents as $student): ?>
<tr>
<td><?= esc($student['school_id'] ?? '') ?></td>
<td><?= esc($student['firstname'] ?? '') ?></td>
<td><?= esc($student['lastname'] ?? '') ?></td>
<td><?= esc($student['class_section_name'] ?? 'No class assigned') ?></td>
<td>
<form method="post" action="<?= site_url('administrator/students/set-active') ?>" class="d-inline">
<?= csrf_field() ?>
<input type="hidden" name="student_id" value="<?= (int)($student['id'] ?? 0) ?>">
<input type="hidden" name="is_active" value="0">
<button type="submit" class="btn btn-outline-danger btn-sm" onclick="return confirm('Remove this student from classes and attendance?');">
Remove
</button>
</form>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="5" class="text-center">No active students found.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<div class="card shadow-sm">
<div class="card-header d-flex align-items-center justify-content-between">
<span>Removed Students</span>
<span class="badge bg-secondary"><?= count($removedStudents) ?></span>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="removedStudentsTable" class="table table-striped table-hover align-middle">
<thead class="table-dark">
<tr>
<th>School ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Last Class</th>
<th style="min-width: 140px;">Action</th>
</tr>
</thead>
<tbody>
<?php if (!empty($removedStudents)): ?>
<?php foreach ($removedStudents as $student): ?>
<tr>
<td><?= esc($student['school_id'] ?? '') ?></td>
<td><?= esc($student['firstname'] ?? '') ?></td>
<td><?= esc($student['lastname'] ?? '') ?></td>
<td><?= esc($student['class_section_name'] ?? 'No class assigned') ?></td>
<td>
<form method="post" action="<?= site_url('administrator/students/set-active') ?>" class="d-inline">
<?= csrf_field() ?>
<input type="hidden" name="student_id" value="<?= (int)($student['id'] ?? 0) ?>">
<input type="hidden" name="is_active" value="1">
<button type="submit" class="btn btn-outline-success btn-sm" onclick="return confirm('Restore this student to classes and attendance?');">
Restore
</button>
</form>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="5" class="text-center">No removed students found.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('scripts') ?>
<script>
document.addEventListener('DOMContentLoaded', () => {
if (window.jQuery && typeof jQuery.fn.DataTable === 'function') {
if (document.getElementById('activeStudentsTable')) {
jQuery('#activeStudentsTable').DataTable();
}
if (document.getElementById('removedStudentsTable')) {
jQuery('#removedStudentsTable').DataTable();
}
}
});
</script>
<?= $this->endSection() ?>
+4 -6
View File
@@ -381,14 +381,12 @@ $selectedYear = trim((string)($selectedYear ?? ''));
</select>
</div>
<!-- is_active -->
<div class="col-md-3">
<label class="form-label d-block">Active Status</label>
<input type="hidden" name="is_active" value="0">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" value="1" id="is_active_<?= (int)$student['id'] ?>" name="is_active" <?= $isActive ? 'checked' : '' ?>>
<label class="form-check-label" for="is_active_<?= (int)$student['id'] ?>">Show in classes/attendance</label>
</div>
<span class="badge <?= $isActive ? 'bg-success' : 'bg-secondary' ?>">
<?= $isActive ? 'Visible' : 'Hidden' ?>
</span>
<div class="form-text">Controlled by current enrollment status.</div>
</div>
<!-- photo_consent -->
-26
View File
@@ -1,26 +0,0 @@
<?= $this->extend('layout/email_layout') ?>
<?= $this->section('content') ?>
<div style="font-family:Arial, Helvetica, sans-serif; color:#222; font-size:16px; line-height:1.6;">
<p style="margin:0 0 12px 0;">
Dear <?= esc($parent_name ?? 'Parent/Guardian') ?>,
</p>
<p style="margin:0 0 12px 0;">
We are writing to inform you that <?= $student_name ? 'your child, <strong>' . esc($student_name) . '</strong>' : 'your child' ?> has been officially withdrawn from the school's enrollment list, effective immediately.
</p>
<p style="margin:0 0 12px 0;">
To ensure confidentiality and accuracy, we kindly request that you contact the school directly. This will allow us to provide complete information and discuss any necessary next steps.
</p>
<p style="margin:0 0 12px 0;">
Thank you for your understanding. We look forward to speaking with you soon.
</p>
<p style="margin:0;">
Sincerely,<br>
<?= esc($signature ?? 'AlRahma School Administration') ?>
</p>
</div>
<?= $this->endSection() ?>
+7 -3
View File
@@ -525,7 +525,7 @@
<!-- Statistics Start -->
<div class="container-xxl py-2 content-section">
<div class="container">
<div class="home-stats" data-dashboard-endpoint="<?= site_url('api/administrator/dashboard') ?>">
<div class="home-stats" data-dashboard-endpoint="/api/administrator/dashboard">
<h1 class="d-flex justify-content-center p-md-1">Active Participants</h1>
<br>
<div class="stats-row">
@@ -734,11 +734,15 @@
window.addEventListener('load', function() {
// Hide the spinner
const spinner = document.getElementById('spinner');
spinner.style.opacity = '0';
if (spinner) {
spinner.style.opacity = '0';
}
// Remove spinner from DOM after fade out
setTimeout(function() {
spinner.style.display = 'none';
if (spinner) {
spinner.style.display = 'none';
}
// Force show all content
document.querySelectorAll('.content-section, h1, h2, h3, h4, h5, h6, p').forEach(function(el) {
+2 -7
View File
@@ -454,22 +454,17 @@ foreach (($students ?? []) as $student) {
</div>
<div class="d-none" data-step-panel="2">
<h6 class="fw-semibold">Review tuition, fees, and balance</h6>
<h6 class="fw-semibold">Review tuition, fees and balance</h6>
<div class="text-muted small mb-3">Review the family account information before submitting enrollment.</div>
<?php if ($familyFinancialSummary !== []): ?>
<div class="border rounded p-3 bg-light">
<div class="row g-2">
<div class="col-md-4"><span class="text-muted">Previous-year carry-over balance:</span> <strong data-financial-value="carry_over_balance"><?= esc($money($familyFinancialSummary['carry_over_balance'] ?? 0)) ?></strong></div>
<div class="col-md-4"><span class="text-muted">Registration fee:</span> <strong data-financial-value="registration_fee"><?= esc($money($familyFinancialSummary['registration_fee'] ?? 0)) ?></strong></div>
<div class="col-md-4"><span class="text-muted">Tuition due now:</span> <strong data-financial-value="tuition_due_at_registration"><?= esc($money($familyFinancialSummary['tuition_due_at_registration'] ?? 0)) ?></strong></div>
<div class="col-md-4"><span class="text-muted">Mandatory fees:</span> <strong data-financial-value="mandatory_fees"><?= esc($money($familyFinancialSummary['mandatory_fees'] ?? 0)) ?></strong></div>
<div class="col-md-4"><span class="text-muted">Current-year account balance:</span> <strong data-financial-value="current_balance"><?= esc($money($familyFinancialSummary['current_balance'] ?? 0)) ?></strong></div>
<div class="col-md-4"><span class="text-muted">Total currently due:</span> <strong data-financial-value="amount_due"><?= esc($money($familyFinancialSummary['amount_due'] ?? 0)) ?></strong></div>
<div class="col-md-4"><span class="text-muted">Total currently due:</span> <strong data-financial-value="amount_due"><?= esc($money($familyFinancialSummary['amount_due'] ?? 0)) ?></strong></div>
</div>
<?php if (!empty($familyFinancialSummary['policy_message'])): ?>
<div class="small text-muted mt-2"><?= esc($familyFinancialSummary['policy_message']) ?></div>
<?php endif; ?>
<div class="small mt-2"><a href="<?= site_url('parent/financial-aid') ?>">Request financial aid</a></div>
</div>
<?php else: ?>
<div class="alert alert-warning mb-0">Family account information is not available. Please contact the administration if you have questions about tuition or balance.</div>
+4 -4
View File
@@ -34,19 +34,19 @@ switch ($userRole) {
<ul class="list-unstyled mb-0 info-list">
<li class="info-title text-center text-md-end"></li>
<li>
<a href="<?= base_url('privacy_policy.pdf') ?>" target="_blank" rel="noopener noreferrer"
<a href="/privacy_policy.pdf" target="_blank" rel="noopener noreferrer"
class="pdf-link" data-filename="privacy_policy.pdf">
<i class="fas fa-file-pdf me-1"></i>Privacy Policy
</a>
</li>
<li>
<a href="<?= base_url('terms_of_service.pdf') ?>" target="_blank" rel="noopener noreferrer"
<a href="/terms_of_service.pdf" target="_blank" rel="noopener noreferrer"
class="pdf-link" data-filename="terms_of_service.pdf">
<i class="fas fa-file-pdf me-1"></i>Terms of Service
</a>
</li>
<li>
<a href="<?= base_url('account_creation_guide.pdf') ?>" target="_blank" rel="noopener noreferrer"
<a href="/account_creation_guide.pdf" target="_blank" rel="noopener noreferrer"
class="pdf-link" data-filename="account_creation_guide.pdf">
<i class="fas fa-file-pdf"></i>How To Create An Account
</a>
@@ -91,4 +91,4 @@ switch ($userRole) {
});
});
});
</script>
</script>