62 lines
2.7 KiB
PHP
62 lines
2.7 KiB
PHP
<?= $this->extend('layout/main_layout') ?>
|
|
<?= $this->section('content') ?>
|
|
<div class="container my-5">
|
|
<h3 class="text-center text-success" style="font-family: Arial, sans-serif;">Attendance Record</h2>
|
|
</div>
|
|
<!-- Filter Form -->
|
|
|
|
|
|
<form action="" method="get" class="form-inline">
|
|
<div class="d-flex align-items-center">
|
|
<select name="school_year" id="school_year" class="form-control me-3"> <!-- Added me-3 (right margin) -->
|
|
<?php foreach ($schoolYears as $year): ?>
|
|
<option value="<?= esc($year['school_year']) ?>" <?= $selectedYear === $year['school_year'] ? 'selected' : '' ?>>
|
|
<?= esc($year['school_year']) ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<button type="submit" class="btn btn-success">Filter</button>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- 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 the selected school year.</div>
|
|
<?php endif; ?>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
|
|
<?= $this->endSection() ?>
|