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
+60 -47
View File
@@ -5,29 +5,77 @@
// This page is Whole Year only.
// Do not expose semester filter here.
$semester = 'year';
$schoolYear = $schoolYear ?? '';
$schoolYears = $schoolYears ?? [];
if (empty($schoolYears) && $schoolYear !== '') {
$schoolYears = [$schoolYear];
}
?>
<div class="container-fluid">
<div class="wrapper below-sixty-decisions-wrapper">
<h2 class="text-center mt-4 mb-4">Below 60 — Whole Year Decisions</h2>
<h2 class="text-center mt-4 mb-4">School Year Decisions</h2>
<!-- School year filter -->
<div class="card shadow-sm mb-3">
<div class="card-body py-3">
<form method="get"
action="<?= site_url('grading/below-60/decisions') ?>"
class="row g-2 align-items-end justify-content-center">
<input type="hidden" name="semester" value="year">
<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">
Whole Year • <?= esc($schoolYear ?? '') ?>
Whole Year • <?= esc($schoolYear) ?>
</div>
<div class="d-flex gap-2 flex-wrap">
<a class="btn btn-outline-secondary btn-sm"
href="<?= site_url('grading/below-60?' . http_build_query([
'semester' => 'year',
'school_year' => $schoolYear ?? '',
'school_year' => $schoolYear,
])) ?>">
← Back to Below 60
</a>
<a class="btn btn-outline-primary btn-sm"
href="<?= site_url('grading/decisions?' . http_build_query([
'school_year' => $schoolYear ?? '',
'school_year' => $schoolYear,
])) ?>">
All Decisions
</a>
@@ -89,7 +137,7 @@ $semester = 'year';
<?php if (empty($rows)): ?>
<div class="alert alert-success text-center d-inline-block">
No students below 60 for the whole year.
No students below 60 for the whole year in <?= esc($schoolYear) ?>.
</div>
<?php else: ?>
<div class="table-responsive">
@@ -99,21 +147,19 @@ $semester = 'year';
<thead class="table-light">
<tr>
<th style="min-width:160px">Student Name</th>
<th>Section</th>
<th>Class-Section</th>
<th class="text-center">Year Score</th>
<th style="min-width:300px">Comments / Rationale &amp; Decision</th>
<th style="min-width:150px" class="text-center">Below-60 Decision</th>
<th style="min-width:130px" class="text-center">Final Decision</th>
<th style="min-width:130px" class="text-center">Certificate</th>
</tr>
</thead>
<tbody>
<?php foreach ($rows as $row): ?>
<?php
// Whole-year score. Prefer year_score if the controller provides it.
// Fall/Spring details remain available through the Details modal.
$scoreRaw = $row['year_score'] ?? $row['semester_score'] ?? null;
// Whole-year page: use year_score only.
// Do not fall back to semester_score, because this page should not display semester results.
$scoreRaw = $row['year_score'] ?? null;
$scoreVal = is_numeric($scoreRaw) ? (float)$scoreRaw : null;
$rowClass = '';
@@ -126,11 +172,6 @@ $semester = 'year';
$currentDecision = (string)($row['decision'] ?? '');
$currentNotes = (string)($row['decision_notes'] ?? '');
$badge = $decisionBadge[$currentDecision] ?? null;
$finalDecision = $row['consolidated_decision'] ?? null;
$finalBadge = $finalDecision !== null ? ($decisionBadge[$finalDecision] ?? 'secondary') : null;
$certNumber = (string)($row['certificate_number'] ?? '');
?>
<tr class="<?= esc($rowClass) ?>">
@@ -146,7 +187,7 @@ $semester = 'year';
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>
@@ -165,7 +206,7 @@ $semester = 'year';
<input type="hidden"
name="school_year"
value="<?= esc((string)($schoolYear ?? '')) ?>">
value="<?= esc((string)$schoolYear) ?>">
<textarea name="notes"
class="form-control form-control-sm decision-notes"
@@ -199,41 +240,13 @@ $semester = 'year';
class="btn btn-sm btn-outline-primary btn-send-email"
data-student-id="<?= (int)($row['student_id'] ?? 0) ?>"
data-semester="year"
data-school-year="<?= esc((string)($schoolYear ?? '')) ?>">
data-school-year="<?= esc((string)$schoolYear) ?>">
Send Email
</button>
<?php else: ?>
<span class="text-muted small">Pending</span>
<?php endif; ?>
</td>
<td class="text-center align-middle">
<?php if ($finalDecision !== null && $finalDecision !== ''): ?>
<span class="badge bg-<?= esc($finalBadge) ?> px-2 py-1">
<?= esc($finalDecision) ?>
</span>
<?php else: ?>
<a href="<?= site_url('grading/decisions?' . http_build_query([
'school_year' => $schoolYear ?? '',
])) ?>"
class="text-muted small">
Generate
</a>
<?php endif; ?>
</td>
<td class="text-center align-middle">
<?php if ($certNumber !== ''): ?>
<a href="<?= site_url('administrator/certificates/reprint/' . rawurlencode($certNumber)) ?>"
target="_blank"
class="font-monospace text-decoration-none fw-semibold"
title="Click to reprint certificate">
<?= esc($certNumber) ?>
</a>
<?php else: ?>
<span class="text-muted small">—</span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>