fix certificates
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
<?= $this->extend('layout/management_layout') ?>
|
||||
<?= $this->section('content') ?>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="wrapper">
|
||||
<h2 class="text-center mt-4 mb-4">Student Decisions — All Students</h2>
|
||||
|
||||
<?= $this->include('partials/academic_filter') ?>
|
||||
|
||||
<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 ?? '') ?>
|
||||
<?php if ($generated): ?>
|
||||
<span class="badge bg-success ms-2">Saved</span>
|
||||
<?php else: ?>
|
||||
<span class="badge bg-warning text-dark ms-2">Not yet generated</span>
|
||||
<?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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty(session()->getFlashdata('status'))): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show">
|
||||
<?= esc(session()->getFlashdata('status')) ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty(session()->getFlashdata('error'))): ?>
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<?= esc(session()->getFlashdata('error')) ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 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) |
|
||||
Scores < 60 → pulled from
|
||||
<a href="<?= site_url('grading/below-60/decisions?' . http_build_query(['semester' => $semester, 'school_year' => $schoolYear])) ?>">
|
||||
Below-60 Decisions
|
||||
</a>
|
||||
</span>
|
||||
</form>
|
||||
|
||||
<?php if (empty($rows)): ?>
|
||||
<div class="alert alert-info">No semester scores found for this selection.</div>
|
||||
<?php else: ?>
|
||||
|
||||
<?php
|
||||
$decisionBadge = [
|
||||
'Pass' => 'success',
|
||||
'Repeat Class' => 'danger',
|
||||
'Make-up exam in fall' => 'info',
|
||||
'Deferred decision' => 'info',
|
||||
'Expel' => 'danger',
|
||||
'Withdrawn' => 'secondary',
|
||||
];
|
||||
$sourceBadge = [
|
||||
'auto' => ['bg-success-subtle text-success-emphasis', 'Auto'],
|
||||
'manual' => ['bg-primary-subtle text-primary-emphasis', 'Manual'],
|
||||
'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']++;
|
||||
elseif ($r['decision'] === '' || $r['source'] === 'pending') $stats['Pending']++;
|
||||
else $stats['Other']++;
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Summary cards -->
|
||||
<div class="d-flex gap-3 mb-3 flex-wrap">
|
||||
<div class="card text-center px-4 py-2 border-success">
|
||||
<div class="fs-4 fw-bold text-success"><?= $stats['Pass'] ?></div>
|
||||
<div class="text-muted small">Pass</div>
|
||||
</div>
|
||||
<div class="card text-center px-4 py-2 border-primary">
|
||||
<div class="fs-4 fw-bold text-primary"><?= $stats['Other'] ?></div>
|
||||
<div class="text-muted small">Other decision</div>
|
||||
</div>
|
||||
<div class="card text-center px-4 py-2 border-warning">
|
||||
<div class="fs-4 fw-bold text-warning"><?= $stats['Pending'] ?></div>
|
||||
<div class="text-muted small">Pending</div>
|
||||
</div>
|
||||
<div class="card text-center px-4 py-2">
|
||||
<div class="fs-4 fw-bold"><?= count($rows) ?></div>
|
||||
<div class="text-muted small">Total</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped align-middle w-100 all-decisions-dt"
|
||||
data-no-mgmt-sticky data-no-dt-fixedheader>
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Student Name</th>
|
||||
<th>Section</th>
|
||||
<th class="text-center">Score</th>
|
||||
<th class="text-center">Decision</th>
|
||||
<th class="text-center">Source</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($rows as $row): ?>
|
||||
<?php
|
||||
$score = $row['semester_score'];
|
||||
$decision = (string)($row['decision'] ?? '');
|
||||
$source = (string)($row['source'] ?? 'pending');
|
||||
$scoreVal = is_numeric($score) ? (float)$score : null;
|
||||
$rowClass = '';
|
||||
if ($scoreVal !== null && $scoreVal < 60) {
|
||||
$rowClass = $scoreVal < 50 ? 'grade-red' : 'grade-orange';
|
||||
}
|
||||
$badge = $decisionBadge[$decision] ?? null;
|
||||
[$srcCls, $srcLabel] = $sourceBadge[$source] ?? ['bg-light text-muted', $source];
|
||||
$studentName = trim((string)($row['firstname'] ?? '') . ' ' . (string)($row['lastname'] ?? ''));
|
||||
?>
|
||||
<tr class="<?= esc($rowClass) ?>">
|
||||
<td><?= esc($studentName ?: 'N/A') ?></td>
|
||||
<td><?= esc($row['class_section_name'] ?? '—') ?></td>
|
||||
<td class="text-center fw-semibold">
|
||||
<?= $scoreVal !== null ? esc(number_format($scoreVal, 2)) : '—' ?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?php if ($decision !== '' && $badge): ?>
|
||||
<span class="badge bg-<?= esc($badge) ?>"><?= esc($decision) ?></span>
|
||||
<?php elseif ($decision !== ''): ?>
|
||||
<span class="badge bg-secondary"><?= esc($decision) ?></span>
|
||||
<?php else: ?>
|
||||
<span class="text-muted small">—</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge <?= esc($srcCls) ?>"><?= esc($srcLabel) ?></span>
|
||||
</td>
|
||||
<td class="text-muted small"><?= nl2br(esc((string)($row['notes'] ?? ''))) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Legend -->
|
||||
<div class="mt-2 mb-4 d-flex gap-2 flex-wrap align-items-center">
|
||||
<?php foreach ($decisionBadge as $label => $color): ?>
|
||||
<span class="badge bg-<?= esc($color) ?> px-2 py-1"><?= esc($label) ?></span>
|
||||
<?php endforeach; ?>
|
||||
<span class="text-muted small ms-2">— decision colour key</span>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('scripts') ?>
|
||||
<style>
|
||||
.grade-orange td { background: #fff3cd !important; color: #8a5d00; }
|
||||
.grade-red td { background: #f8d7da !important; color: #842029; }
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
if (!window.$ || !$.fn || !$.fn.DataTable) return;
|
||||
$(function () {
|
||||
const tbl = $('.all-decisions-dt');
|
||||
if (!tbl.length) return;
|
||||
try {
|
||||
tbl.DataTable({
|
||||
order: [[1, 'asc'], [0, 'asc']],
|
||||
pageLength: 100,
|
||||
lengthMenu: [25, 50, 100, 200],
|
||||
columnDefs: [{ orderable: false, targets: [5] }]
|
||||
});
|
||||
} catch (_) {}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
Reference in New Issue
Block a user