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 (_) {}
});