50 lines
2.2 KiB
PHP
50 lines
2.2 KiB
PHP
<?= $this->extend('layout/main_layout') ?>
|
|
<?= $this->section('content') ?>
|
|
<div class="container my-5">
|
|
<h3 class="text-center text-success">Attendance Record</h3>
|
|
<?php if (!empty($selectedYear)): ?>
|
|
<div class="text-center text-muted small">School Year: <?= esc($selectedYear) ?></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Error Message -->
|
|
<?php if (isset($error)): ?>
|
|
<div class="alert alert-danger"><?= esc($error) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Attendance Table (one record per row; no regrouping) -->
|
|
<?php if (!empty($attendance)): ?>
|
|
<table class="table table-striped table-bordered mt-3">
|
|
<thead>
|
|
<tr>
|
|
<th>First Name</th>
|
|
<th>Last Name</th>
|
|
<th>Date</th>
|
|
<th>Status</th>
|
|
<th>Reason</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($attendance as $row): ?>
|
|
<?php $status = strtolower(trim((string)($row['status'] ?? ''))); ?>
|
|
<?php if ($status === 'absent' || $status === 'late'): ?>
|
|
<tr>
|
|
<td><?= esc($row['firstname'] ?? '') ?></td>
|
|
<td><?= esc($row['lastname'] ?? '') ?></td>
|
|
<td><?= esc(!empty($row['date']) ? local_date($row['date'], 'm-d-Y') : '') ?></td>
|
|
<td><?= esc($row['status'] ?? '') ?></td>
|
|
<td><?= esc($row['reason'] ?? '') ?></td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php else: ?>
|
|
<div class="alert alert-info mb-3 d-inline-block">No attendance records found for this school year.</div>
|
|
<?php endif; ?>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
|
|
<?= $this->endSection() ?>
|