137 lines
5.8 KiB
PHP
137 lines
5.8 KiB
PHP
<?= $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">Progress Report</h3>
|
|
<div class="text-muted">
|
|
<?= esc($row['class_section_name'] ?? '-') ?> • <?= esc($row['week_start'] ?? '-') ?>
|
|
</div>
|
|
</div>
|
|
<a href="<?= base_url('parent/progress') ?>" class="btn btn-outline-secondary">Back</a>
|
|
</div>
|
|
|
|
<?php
|
|
$weeklyReports = $weeklyReports ?? [];
|
|
$subjectSections = $subjectSections ?? [];
|
|
$reportsBySubject = [];
|
|
$attachments = [];
|
|
foreach ($weeklyReports as $report) {
|
|
$reportsBySubject[$report['subject']] = $report;
|
|
foreach (($report['attachments'] ?? []) as $attachment) {
|
|
$attachments[] = [
|
|
'subject' => $report['subject'] ?? 'Attachment',
|
|
'attachment' => $attachment,
|
|
'report_id' => $report['id'] ?? null,
|
|
];
|
|
}
|
|
}
|
|
?>
|
|
|
|
<div class="row g-3">
|
|
<div class="col-lg-8">
|
|
<?php foreach ($subjectSections as $slug => $section): ?>
|
|
<?php
|
|
$subjectName = $section['db_subject'] ?? $section['label'] ?? $slug;
|
|
$isQuran = $subjectName === 'Quran/Arabic';
|
|
$unitLabel = $isQuran ? 'Surah / Custom Arabic' : 'Unit / Chapter';
|
|
$homeworkLabel = $isQuran ? 'Arabic Practice / Homework' : 'Assigned Homework';
|
|
$report = $reportsBySubject[$subjectName] ?? null;
|
|
?>
|
|
<div class="card shadow-sm mb-3">
|
|
<div class="card-header bg-white d-flex align-items-center justify-content-between">
|
|
<strong class="mb-0"><?= esc($section['label'] ?? $subjectName) ?></strong>
|
|
</div>
|
|
<div class="card-body">
|
|
<?php if (! $report): ?>
|
|
<div class="text-muted">No entry submitted for this subject this week.</div>
|
|
<?php else: ?>
|
|
<?php if (!empty($report['materials'])): ?>
|
|
<div class="mb-2"><strong>Materials:</strong> <?= esc($report['materials']) ?></div>
|
|
<?php endif; ?>
|
|
<div class="mb-2"><strong><?= $unitLabel ?>:</strong> <?= esc($report['unit_title'] ?: '-') ?></div>
|
|
<div class="mb-3">
|
|
<strong>Activities / Notes</strong>
|
|
<div class="mt-1"><?= nl2br(esc($report['covered'] ?? '-')) ?></div>
|
|
</div>
|
|
<div class="mb-3">
|
|
<strong><?= $homeworkLabel ?>:</strong>
|
|
<div class="mt-1"><?= nl2br(esc($report['homework'] ?: '-')) ?></div>
|
|
</div>
|
|
<?php if (!empty($report['attachments'])): ?>
|
|
<div class="mt-3">
|
|
<strong>Attachments:</strong>
|
|
<div class="d-flex flex-column gap-2 mt-2">
|
|
<?php foreach ($report['attachments'] as $attachment): ?>
|
|
<?php
|
|
$linkId = $attachment['id'] ?? $report['id'];
|
|
$link = !empty($attachment['legacy'])
|
|
? base_url('parent/progress/attachment/' . $linkId)
|
|
: base_url('parent/progress/attachment-file/' . $linkId);
|
|
?>
|
|
<a class="btn btn-sm btn-outline-secondary text-start" href="<?= $link ?>" target="_blank" rel="noreferrer">
|
|
<?= esc($attachment['name'] ?? 'Attachment') ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<div class="col-lg-4">
|
|
<div class="card shadow-sm mb-3">
|
|
<div class="card-header bg-white"><strong>Summary</strong></div>
|
|
<div class="card-body">
|
|
<div class="mb-2"><strong>Teacher:</strong> <?= esc($row['teacher_name'] ?? '-') ?></div>
|
|
<div class="mb-2"><strong>Submitted:</strong> <?= esc($row['created_at'] ? date('M d, Y g:i A', strtotime($row['created_at'])) : '-') ?></div>
|
|
<?php if (!empty($row['status_label'])): ?>
|
|
<div><strong>Status:</strong> <?= esc($row['status_label']) ?></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($row['flags'])): ?>
|
|
<div class="card shadow-sm mb-3">
|
|
<div class="card-header bg-white"><strong>Highlights</strong></div>
|
|
<div class="card-body">
|
|
<div class="d-flex flex-wrap gap-2">
|
|
<?php foreach ($row['flags'] as $flag): ?>
|
|
<span class="badge bg-info text-dark"><?= esc(str_replace('_', ' ', $flag)) ?></span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($attachments)): ?>
|
|
<div class="card shadow-sm">
|
|
<div class="card-header bg-white"><strong>Attachments</strong></div>
|
|
<div class="card-body">
|
|
<?php foreach ($attachments as $entry): ?>
|
|
<?php
|
|
$attachment = $entry['attachment'] ?? [];
|
|
$linkId = $attachment['id'] ?? ($entry['report_id'] ?? null);
|
|
if (!$linkId) {
|
|
continue;
|
|
}
|
|
$link = !empty($attachment['legacy'])
|
|
? base_url('parent/progress/attachment/' . $linkId)
|
|
: base_url('parent/progress/attachment-file/' . $linkId);
|
|
$label = trim(($entry['subject'] ?? 'Attachment') . ' • ' . ($attachment['name'] ?? 'Attachment'));
|
|
?>
|
|
<a class="btn btn-outline-primary w-100 text-start mb-2" href="<?= $link ?>" target="_blank" rel="noreferrer">
|
|
<?= esc($label) ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?= $this->endSection() ?>
|