This commit is contained in:
root
2026-05-26 23:14:55 -04:00
parent 5ed65a867c
commit c294d7bed7
38 changed files with 277 additions and 146 deletions
+38 -23
View File
@@ -5,11 +5,30 @@
<div class="wrapper">
<h2 class="text-center mt-4 mb-4">Student Decisions — All Students</h2>
<?= $this->include('partials/academic_filter') ?>
<!-- School Year filter only -->
<form method="get" class="row g-2 align-items-center justify-content-center mb-3">
<div class="col-auto"><label class="form-label mb-0">School year</label></div>
<div class="col-auto">
<select name="school_year" class="form-select form-select-sm" style="min-width: 180px;">
<?php $years = isset($schoolYears) && is_array($schoolYears) ? $schoolYears : []; ?>
<?php foreach ($years as $y):
$val = is_array($y) && isset($y['school_year']) ? (string)$y['school_year'] : (string)$y; ?>
<option value="<?= esc($val) ?>" <?= ($schoolYear === $val ? 'selected' : '') ?>><?= esc($val) ?></option>
<?php endforeach; ?>
<?php if (empty($years) && $schoolYear !== ''): ?>
<option value="<?= esc($schoolYear) ?>" selected><?= esc($schoolYear) ?></option>
<?php endif; ?>
</select>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-secondary btn-sm">Apply</button>
<a class="btn btn-outline-secondary btn-sm" href="?">Reset</a>
</div>
</form>
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
<div class="text-muted">
<?= esc(ucfirst($semester ?? '')) ?> • <?= esc($schoolYear ?? '') ?>
<?= esc($schoolYear ?? '') ?>
<?php if ($generated): ?>
<span class="badge bg-success ms-2">Saved</span>
<?php else: ?>
@@ -17,10 +36,6 @@
<?php endif; ?>
</div>
<div class="d-flex gap-2 flex-wrap">
<a class="btn btn-outline-secondary btn-sm"
href="<?= site_url('grading/below-60/decisions?' . http_build_query(['semester' => $semester, 'school_year' => $schoolYear])) ?>">
Below-60 Decisions
</a>
<a class="btn btn-outline-secondary btn-sm" href="<?= base_url('grading') ?>">
Grading
</a>
@@ -43,22 +58,18 @@
<!-- Generate / Regenerate button -->
<form method="post" action="<?= site_url('grading/decisions/generate') ?>" class="mb-3">
<?= csrf_field() ?>
<input type="hidden" name="semester" value="<?= esc($semester ?? '') ?>">
<input type="hidden" name="school_year" value="<?= esc($schoolYear ?? '') ?>">
<button type="submit" class="btn btn-primary">
<?= $generated ? 'Regenerate Decisions' : 'Generate Decisions' ?>
</button>
<span class="text-muted small ms-2">
Scores ≥ 60 → <strong>Pass</strong> (auto) &nbsp;|&nbsp;
Scores &lt; 60 → pulled from
<a href="<?= site_url('grading/below-60/decisions?' . http_build_query(['semester' => $semester, 'school_year' => $schoolYear])) ?>">
Below-60 Decisions
</a>
Year score ≥ 60 → <strong>Pass</strong> (auto) &nbsp;|&nbsp;
Year score &lt; 60 → pulled from below-60 decisions
</span>
</form>
<?php if (empty($rows)): ?>
<div class="alert alert-info">No semester scores found for this selection.</div>
<div class="alert alert-info">No semester scores found for this school year.</div>
<?php else: ?>
<?php
@@ -66,7 +77,7 @@
'Pass' => 'success',
'Repeat Class' => 'danger',
'Make-up exam in fall' => 'info',
'Deferred decision' => 'info',
'Deferred decision' => 'info',
'Expel' => 'danger',
'Withdrawn' => 'secondary',
];
@@ -76,7 +87,6 @@
'pending' => ['bg-warning-subtle text-warning-emphasis', 'Pending'],
];
// Stats
$stats = ['Pass' => 0, 'Other' => 0, 'Pending' => 0];
foreach ($rows as $r) {
if ($r['decision'] === 'Pass') $stats['Pass']++;
@@ -112,7 +122,9 @@
<tr>
<th>Student Name</th>
<th>Section</th>
<th class="text-center">Score</th>
<th class="text-center">Fall Score</th>
<th class="text-center">Spring Score</th>
<th class="text-center">Year Score</th>
<th class="text-center">Decision</th>
<th class="text-center">Source</th>
<th>Notes</th>
@@ -121,23 +133,26 @@
<tbody>
<?php foreach ($rows as $row): ?>
<?php
$score = $row['semester_score'];
$yearScore = $row['year_score'];
$decision = (string)($row['decision'] ?? '');
$source = (string)($row['source'] ?? 'pending');
$scoreVal = is_numeric($score) ? (float)$score : null;
$yearVal = is_numeric($yearScore) ? (float)$yearScore : null;
$rowClass = '';
if ($scoreVal !== null && $scoreVal < 60) {
$rowClass = $scoreVal < 50 ? 'grade-red' : 'grade-orange';
if ($yearVal !== null && $yearVal < 60) {
$rowClass = $yearVal < 50 ? 'grade-red' : 'grade-orange';
}
$badge = $decisionBadge[$decision] ?? null;
$badge = $decisionBadge[$decision] ?? null;
[$srcCls, $srcLabel] = $sourceBadge[$source] ?? ['bg-light text-muted', $source];
$studentName = trim((string)($row['firstname'] ?? '') . ' ' . (string)($row['lastname'] ?? ''));
$fmt = fn($v) => is_numeric($v) ? number_format((float)$v, 2) : '—';
?>
<tr class="<?= esc($rowClass) ?>">
<td><?= esc($studentName ?: 'N/A') ?></td>
<td><?= esc($row['class_section_name'] ?? '—') ?></td>
<td class="text-center"><?= esc($fmt($row['fall_score'] ?? null)) ?></td>
<td class="text-center"><?= esc($fmt($row['spring_score'] ?? null)) ?></td>
<td class="text-center fw-semibold">
<?= $scoreVal !== null ? esc(number_format($scoreVal, 2)) : '—' ?>
<?= esc($fmt($yearVal)) ?>
</td>
<td class="text-center">
<?php if ($decision !== '' && $badge): ?>
@@ -188,7 +203,7 @@
order: [[1, 'asc'], [0, 'asc']],
pageLength: 100,
lengthMenu: [25, 50, 100, 200],
columnDefs: [{ orderable: false, targets: [5] }]
columnDefs: [{ orderable: false, targets: [7] }]
});
} catch (_) {}
});
+15 -3
View File
@@ -9,13 +9,15 @@
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
<div class="text-muted">
<?= esc(ucfirst($semester ?? '')) ?> • <?= esc($schoolYear ?? '') ?>
<?= !empty($isYearMode) ? 'Whole Year' : esc(ucfirst($semester ?? '')) ?> • <?= 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' => $semester ?? '', '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
@@ -47,6 +49,7 @@
<tr>
<th>Student Name</th>
<th>Section</th>
<?php if (!empty($isYearMode)): ?><th>Semester</th><?php endif; ?>
<th>Hwk Avg</th>
<th>Project Avg</th>
<th>Participation</th>
@@ -54,10 +57,12 @@
<th>PTAP Score</th>
<th>Attendance</th>
<th>Midterm Score</th>
<th><?= strcasecmp($semester ?? '', 'fall') === 0 ? '1st Semester Score' : 'Semester Score' ?></th>
<th><?= !empty($isYearMode) ? 'Semester Score' : (strcasecmp($semester ?? '', 'fall') === 0 ? '1st Semester Score' : 'Semester Score') ?></th>
<?php if (empty($isYearMode)): ?>
<th>Status</th>
<th>Email Parent</th>
<th>Schedule Meeting</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
@@ -76,9 +81,13 @@
$studentName = trim((string)($row['firstname'] ?? '') . ' ' . (string)($row['lastname'] ?? ''));
?>
<?php $isClosed = ($row['status'] ?? 'Open') === 'Closed'; ?>
<?php $rowSemester = ucfirst(strtolower(trim((string)($row['semester'] ?? ($semester ?? ''))))); ?>
<tr class="<?= esc($scoreClass) ?>">
<td><?= esc($studentName !== '' ? $studentName : 'N/A') ?></td>
<td><?= esc($row['class_section_name'] ?? '—') ?></td>
<?php if (!empty($isYearMode)): ?>
<td class="text-center"><?= esc($rowSemester) ?></td>
<?php endif; ?>
<td class="text-center"><?= $displayScore($row['homework_avg'] ?? null) ?></td>
<td class="text-center"><?= $displayScore($row['project_avg'] ?? null) ?></td>
<td class="text-center"><?= $displayScore($row['participation_score'] ?? null) ?></td>
@@ -87,6 +96,7 @@
<td class="text-center"><?= $displayScore($row['attendance_score'] ?? null) ?></td>
<td class="text-center"><?= $displayScore($row['midterm_exam_score'] ?? null) ?></td>
<td class="text-center"><?= $displayScore($row['semester_score'] ?? null) ?></td>
<?php if (empty($isYearMode)): ?>
<td class="text-center">
<form method="post" action="<?= site_url('grading/below-60/status') ?>" class="d-flex align-items-center gap-2 justify-content-center">
<?= csrf_field() ?>
@@ -121,6 +131,7 @@
</a>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
@@ -147,8 +158,9 @@
const table = $('.below-sixty-dt');
if (!table.length) return;
try {
const semesterOffset = <?= !empty($isYearMode) ? '1' : '0' ?>;
table.DataTable({
order: [[8, 'asc']],
order: [[8 + semesterOffset, 'asc']],
pageLength: 100,
lengthMenu: [10, 25, 50, 100, 200]
});