Files
alrahma_sunday_school/app/Views/teacher/class_progress_history.php
T
2026-02-26 23:27:50 -05:00

104 lines
4.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?= $this->extend('layout/main_layout') ?>
<?= $this->section('content') ?>
<div class="container py-4">
<div class="d-flex align-items-center justify-content-between mb-3">
<div>
<h3 class="mb-0">Class Progress Reports</h3>
<div class="text-muted">Review weekly submissions and compare Islamic Studies with Quran/Arabic.</div>
</div>
<a href="<?= base_url('teacher/progress/submit') ?>" class="btn btn-outline-secondary">Submit New Report</a>
</div>
<?php
$reportGroups = $reportGroups ?? [];
$subjectSections = $subjectSections ?? [];
$classSectionOptions = $classSectionOptions ?? [];
$selectedSectionId = $selectedSectionId ?? null;
?>
<?php if (!empty($classSectionOptions)): ?>
<form method="get" class="mb-3 row g-2 align-items-center">
<div class="col-auto">
<label class="form-label mb-0 small">Class / Section</label>
</div>
<div class="col-auto">
<select name="class_section_id" class="form-select form-select-sm" onchange="this.form.submit()">
<?php foreach ($classSectionOptions as $id => $label): ?>
<option value="<?= esc($id) ?>" <?= $selectedSectionId == $id ? 'selected' : '' ?>><?= esc($label ?: 'Unknown Section') ?></option>
<?php endforeach; ?>
</select>
</div>
</form>
<?php endif; ?>
<?php if (empty($reportGroups)): ?>
<div class="alert alert-secondary">No reports submitted yet.</div>
<?php else: ?>
<div class="card shadow-sm">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th>Week</th>
<th>Subjects</th>
<th class="text-end">Details</th>
</tr>
</thead>
<tbody>
<?php foreach ($reportGroups as $group): ?>
<?php
$start = $group['week_start'] ?? '';
$end = $group['week_end'] ?? '';
$weekLabel = $start ? date('M d, Y', strtotime($start)) : '-';
if ($end) {
$weekLabel .= ' ' . date('M d, Y', strtotime($end));
}
$reports = $group['reports'] ?? [];
$exampleReport = $reports ? reset($reports) : null;
?>
<tr>
<td>
<div class="fw-semibold"><?= esc($weekLabel) ?></div>
<?php if (!empty($group['class_section_name'])): ?>
<div class="text-muted small">Class: <?= esc($group['class_section_name']) ?></div>
<?php endif; ?>
</td>
<td>
<div class="d-flex flex-column gap-2">
<?php foreach ($subjectSections as $slug => $section): ?>
<?php
$subjectName = $section['db_subject'] ?? $section['label'] ?? $slug;
$report = $reports[$subjectName] ?? null;
$statusBadge = $report ? ($report['status_label'] ?? 'Unknown') : 'No submission';
$badgeClass = $report ? 'bg-secondary' : 'bg-light text-muted';
?>
<div class="border rounded-3 p-2">
<div class="d-flex justify-content-between align-items-center">
<strong class="small mb-0"><?= esc($section['label'] ?? $subjectName) ?></strong>
<span class="badge <?= $badgeClass ?>"><?= esc($statusBadge) ?></span>
</div>
<div class="small text-muted">
<?= $report ? esc($report['unit_title'] ?: '-') : 'No submission' ?>
</div>
<?php if ($report): ?>
<div class="small text-muted">
Submitted by: <?= esc(trim((string) ($report['teacher_name'] ?? '')) ?: 'Unknown') ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
</td>
<td class="text-end">
<?php if ($exampleReport): ?>
<a href="<?= base_url('teacher/progress/view/' . $exampleReport['id']) ?>" class="btn btn-sm btn-outline-primary">View Weekly Details</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php endif; ?>
</div>
<?= $this->endSection() ?>