fix financial issues
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<h2 class="text-center mt-4 mb-4">Student Decisions — All Students</h2>
|
||||
|
||||
<!-- School Year filter only -->
|
||||
<form method="get" class="row g-2 align-items-center justify-content-center mb-3">
|
||||
<form method="get" class="row g-2 align-items-center justify-content-center mb-3 no-print">
|
||||
<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;">
|
||||
@@ -35,7 +35,10 @@
|
||||
<span class="badge bg-warning text-dark ms-2">Not yet generated</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="d-flex gap-2 flex-wrap">
|
||||
<div class="d-flex gap-2 flex-wrap no-print">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" onclick="window.print()">
|
||||
Print Stats
|
||||
</button>
|
||||
<a class="btn btn-outline-secondary btn-sm" href="<?= base_url('grading') ?>">
|
||||
Grading
|
||||
</a>
|
||||
@@ -56,7 +59,7 @@
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Generate / Regenerate button -->
|
||||
<form method="post" action="<?= site_url('grading/decisions/generate') ?>" class="mb-3">
|
||||
<form method="post" action="<?= site_url('grading/decisions/generate') ?>" class="mb-3 no-print">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="school_year" value="<?= esc($schoolYear ?? '') ?>">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
@@ -93,10 +96,42 @@
|
||||
elseif ($r['decision'] === '' || $r['source'] === 'pending') $stats['Pending']++;
|
||||
else $stats['Other']++;
|
||||
}
|
||||
|
||||
$pct = static function (int $count, int $total): string {
|
||||
return $total > 0 ? number_format(($count / $total) * 100, 1) . '%' : '0.0%';
|
||||
};
|
||||
|
||||
$genderKey = static function (?string $gender): string {
|
||||
$value = strtolower(trim((string)$gender));
|
||||
|
||||
return match (true) {
|
||||
in_array($value, ['male', 'm', 'boy', 'boys'], true) => 'boys',
|
||||
in_array($value, ['female', 'f', 'girl', 'girls'], true) => 'girls',
|
||||
default => 'other',
|
||||
};
|
||||
};
|
||||
|
||||
$genderStats = static function (array $items) use ($genderKey): array {
|
||||
$stats = ['boys' => 0, 'girls' => 0, 'other' => 0];
|
||||
|
||||
foreach ($items as $item) {
|
||||
$stats[$genderKey($item['gender'] ?? '')]++;
|
||||
}
|
||||
|
||||
return $stats;
|
||||
};
|
||||
|
||||
$totalStudents = count($rows);
|
||||
$passRows = array_values(array_filter($rows, static fn (array $row): bool => (string)($row['decision'] ?? '') === 'Pass'));
|
||||
$trophyRows = array_values(array_filter($rows, static fn (array $row): bool => !empty($row['is_trophy'])));
|
||||
|
||||
$allGenderStats = $genderStats($rows);
|
||||
$passGenderStats = $genderStats($passRows);
|
||||
$trophyGenderStats = $genderStats($trophyRows);
|
||||
?>
|
||||
|
||||
<!-- Summary cards -->
|
||||
<div class="d-flex gap-3 mb-3 flex-wrap">
|
||||
<div class="d-flex gap-3 mb-3 flex-wrap no-print">
|
||||
<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>
|
||||
@@ -115,7 +150,60 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<div class="print-only" style="margin-bottom:14px;">
|
||||
<div style="text-align:center;margin-bottom:10px;border-bottom:2px solid #333;padding-bottom:6px;">
|
||||
<h2 style="margin:0;">Student Decisions Summary — <?= esc($schoolYear ?? '') ?></h2>
|
||||
<p style="margin:3px 0 0;font-size:10px;color:#555;">
|
||||
Trophy counts use the same year-score rule as the trophy final page.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h3 style="margin-bottom:6px;">Print Stats</h3>
|
||||
<table data-no-mgmt-sticky style="margin-bottom:12px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Metric</th>
|
||||
<th style="text-align:center;">Count</th>
|
||||
<th style="text-align:center;">Percent</th>
|
||||
<th style="text-align:center;">Boys</th>
|
||||
<th style="text-align:center;">Boys %</th>
|
||||
<th style="text-align:center;">Girls</th>
|
||||
<th style="text-align:center;">Girls %</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Total Students</td>
|
||||
<td style="text-align:center;"><?= $totalStudents ?></td>
|
||||
<td style="text-align:center;">100.0%</td>
|
||||
<td style="text-align:center;"><?= $allGenderStats['boys'] ?></td>
|
||||
<td style="text-align:center;"><?= $pct($allGenderStats['boys'], $totalStudents) ?></td>
|
||||
<td style="text-align:center;"><?= $allGenderStats['girls'] ?></td>
|
||||
<td style="text-align:center;"><?= $pct($allGenderStats['girls'], $totalStudents) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Pass</td>
|
||||
<td style="text-align:center;"><?= count($passRows) ?></td>
|
||||
<td style="text-align:center;"><?= $pct(count($passRows), $totalStudents) ?></td>
|
||||
<td style="text-align:center;"><?= $passGenderStats['boys'] ?></td>
|
||||
<td style="text-align:center;"><?= $pct($passGenderStats['boys'], count($passRows)) ?></td>
|
||||
<td style="text-align:center;"><?= $passGenderStats['girls'] ?></td>
|
||||
<td style="text-align:center;"><?= $pct($passGenderStats['girls'], count($passRows)) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Trophies</td>
|
||||
<td style="text-align:center;"><?= count($trophyRows) ?></td>
|
||||
<td style="text-align:center;"><?= $pct(count($trophyRows), $totalStudents) ?></td>
|
||||
<td style="text-align:center;"><?= $trophyGenderStats['boys'] ?></td>
|
||||
<td style="text-align:center;"><?= $pct($trophyGenderStats['boys'], count($trophyRows)) ?></td>
|
||||
<td style="text-align:center;"><?= $trophyGenderStats['girls'] ?></td>
|
||||
<td style="text-align:center;"><?= $pct($trophyGenderStats['girls'], count($trophyRows)) ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive no-print">
|
||||
<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">
|
||||
@@ -174,7 +262,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Legend -->
|
||||
<div class="mt-2 mb-4 d-flex gap-2 flex-wrap align-items-center">
|
||||
<div class="mt-2 mb-4 d-flex gap-2 flex-wrap align-items-center no-print">
|
||||
<?php foreach ($decisionBadge as $label => $color): ?>
|
||||
<span class="badge bg-<?= esc($color) ?> px-2 py-1"><?= esc($label) ?></span>
|
||||
<?php endforeach; ?>
|
||||
@@ -189,8 +277,29 @@
|
||||
|
||||
<?= $this->section('scripts') ?>
|
||||
<style>
|
||||
.print-only { display: none !important; }
|
||||
.grade-orange td { background: #fff3cd !important; color: #8a5d00; }
|
||||
.grade-red td { background: #f8d7da !important; color: #842029; }
|
||||
|
||||
@media print {
|
||||
.no-print { display: none !important; }
|
||||
.print-only { display: block !important; }
|
||||
body { font-size: 11px; }
|
||||
.container-fluid { padding: 0 !important; }
|
||||
table { width: 100%; border-collapse: collapse; font-size: 10px; }
|
||||
table th, table td { border: 1px solid #bbb; padding: 3px 5px; }
|
||||
table thead {
|
||||
background: #333 !important;
|
||||
color: #fff !important;
|
||||
-webkit-print-color-adjust: exact;
|
||||
print-color-adjust: exact;
|
||||
}
|
||||
table thead th {
|
||||
position: static !important;
|
||||
top: auto !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
|
||||
Reference in New Issue
Block a user