fix delibration and below 60

This commit is contained in:
root
2026-05-30 15:00:16 -04:00
parent 89913d7473
commit f24f4311e8
9 changed files with 333 additions and 160 deletions
+73 -40
View File
@@ -1,28 +1,71 @@
<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<?php
// This page is Fall semester only.
// Do not expose Whole Year mode here.
$semester = 'fall';
$actionSemester = 'fall';
$schoolYear = $schoolYear ?? '';
$schoolYears = $schoolYears ?? [];
if (empty($schoolYears) && $schoolYear !== '') {
$schoolYears = [$schoolYear];
}
?>
<div class="container-fluid">
<div class="wrapper below-sixty-wrapper">
<h2 class="text-center mt-4 mb-4 below-sixty-title">Below 60 Summary</h2>
<?= $this->include('partials/academic_filter') ?>
<!-- School year filter only -->
<div class="card shadow-sm mb-3">
<div class="card-body py-3">
<form method="get"
action="<?= site_url('grading/below-60') ?>"
class="row g-2 align-items-end justify-content-center">
<input type="hidden" name="semester" value="fall">
<div class="col-12 col-sm-auto">
<label class="form-label mb-1 small fw-semibold">School Year</label>
<?php if (!empty($schoolYears)): ?>
<select name="school_year"
class="form-select form-select-sm"
style="min-width:160px;">
<?php foreach ($schoolYears as $yr): ?>
<option value="<?= esc($yr) ?>" <?= (string)$yr === (string)$schoolYear ? 'selected' : '' ?>>
<?= esc($yr) ?>
</option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="text"
name="school_year"
class="form-control form-control-sm"
style="min-width:160px;"
value="<?= esc($schoolYear) ?>"
placeholder="2025-2026">
<?php endif; ?>
</div>
<div class="col-12 col-sm-auto">
<button type="submit" class="btn btn-sm btn-primary">
<i class="bi bi-funnel me-1"></i>Apply
</button>
</div>
</form>
</div>
</div>
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
<div class="text-muted">
<?= !empty($isYearMode) ? 'Whole Year' : 'Fall' ?> • <?= esc($schoolYear ?? '') ?>
Fall • <?= esc($schoolYear) ?>
</div>
<div class="d-flex gap-2">
<?php if (!empty($isYearMode)): ?>
<a class="btn btn-outline-primary btn-sm"
href="<?= site_url('grading/below-60/decisions?' . http_build_query([
'semester' => 'year',
'school_year' => $schoolYear ?? '',
])) ?>">
Decisions
</a>
<?php endif; ?>
<?php if (!empty($canViewGrading)): ?>
<a class="btn btn-outline-secondary btn-sm" href="<?= base_url('grading') ?>">
Back to Grading
@@ -43,15 +86,11 @@
return esc($value);
};
// Fall mode uses Fall.
// Whole Year mode uses year.
$actionSemester = !empty($isYearMode) ? 'year' : 'fall';
?>
<?php if (empty($rows)): ?>
<div class="alert alert-success text-center d-inline-block">
No students below 60 for this selection.
No students below 60 for Fall in <?= esc($schoolYear) ?>.
</div>
<?php else: ?>
<div class="table-responsive below-sixty-table">
@@ -62,7 +101,7 @@
<tr>
<th>Student Name</th>
<th>Section</th>
<th class="text-center">Score</th>
<th class="text-center">Fall Score</th>
<th>Status</th>
<th>Email Parent</th>
<th>Schedule Meeting</th>
@@ -72,6 +111,7 @@
<tbody>
<?php foreach ($rows as $row): ?>
<?php
// Fall-only page: use semester_score.
$scoreRaw = $row['semester_score'] ?? null;
$scoreVal = is_numeric($scoreRaw) ? (float)$scoreRaw : null;
@@ -102,7 +142,7 @@
style="font-size:0.72rem;padding:1px 7px;"
data-student-id="<?= (int)($row['student_id'] ?? 0) ?>"
data-student-name="<?= esc($studentLabel) ?>"
data-school-year="<?= esc((string)($schoolYear ?? '')) ?>">
data-school-year="<?= esc((string)$schoolYear) ?>">
Details
</button>
</td>
@@ -119,15 +159,15 @@
<input type="hidden"
name="semester"
value="<?= esc($actionSemester) ?>">
value="fall">
<input type="hidden"
name="school_year"
value="<?= esc((string)($schoolYear ?? '')) ?>">
value="<?= esc((string)$schoolYear) ?>">
<select name="status"
class="form-select form-select-sm"
style="width: 110px;">
style="width:110px;">
<option value="Open" <?= ($row['status'] ?? 'Open') === 'Open' ? 'selected' : '' ?>>
Open
</option>
@@ -139,7 +179,7 @@
<input type="text"
name="note"
class="form-control form-control-sm"
style="width: 140px;"
style="width:140px;"
placeholder="Note (optional)"
value="<?= esc((string)($row['note'] ?? '')) ?>">
@@ -156,7 +196,11 @@
</button>
<?php else: ?>
<a class="btn btn-sm btn-outline-primary"
href="<?= site_url('grading/below-60/email/edit?student_id=' . (int)($row['student_id'] ?? 0) . '&semester=' . rawurlencode($actionSemester) . '&school_year=' . rawurlencode((string)($schoolYear ?? ''))) ?>">
href="<?= site_url('grading/below-60/email/edit?' . http_build_query([
'student_id' => (int)($row['student_id'] ?? 0),
'semester' => 'fall',
'school_year' => (string)$schoolYear,
])) ?>">
Send Email
</a>
<?php endif; ?>
@@ -169,7 +213,11 @@
</button>
<?php else: ?>
<a class="btn btn-sm btn-outline-secondary"
href="<?= site_url('grading/below-60/schedule?student_id=' . (int)($row['student_id'] ?? 0) . '&semester=' . rawurlencode($actionSemester) . '&school_year=' . rawurlencode((string)($schoolYear ?? ''))) ?>">
href="<?= site_url('grading/below-60/schedule?' . http_build_query([
'student_id' => (int)($row['student_id'] ?? 0),
'semester' => 'fall',
'school_year' => (string)$schoolYear,
])) ?>">
Schedule
</a>
<?php endif; ?>
@@ -246,21 +294,6 @@
<script>
(function () {
function normalizeSemesterFilter() {
const semesterSelect = document.querySelector('select[name="semester"]');
if (!semesterSelect) return;
const wholeYearSelected = <?= !empty($isYearMode) ? 'true' : 'false' ?>;
semesterSelect.innerHTML = '';
semesterSelect.add(new Option('Fall', 'fall', !wholeYearSelected, !wholeYearSelected));
semesterSelect.add(new Option('Whole Year', 'year', wholeYearSelected, wholeYearSelected));
semesterSelect.value = wholeYearSelected ? 'year' : 'fall';
}
document.addEventListener('DOMContentLoaded', normalizeSemesterFilter);
if (window.$ && $.fn && $.fn.DataTable) {
$(function () {
const table = $('.below-sixty-dt');