merge prod to main

This commit is contained in:
root
2026-05-16 13:44:12 -04:00
parent 663c0cdbda
commit b32fb853f6
901 changed files with 11241 additions and 1340 deletions
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
+91 -65
View File
@@ -7,79 +7,105 @@
<div class="text-muted">Review the weekly reports your childs teachers submit.</div>
</div>
<div class="text-end text-muted small">
Reports are grouped by Sunday; click any row to read the full details.
Reports are grouped by student; click a name to expand weekly details.
</div>
</div>
<?php if (! $hasSections): ?>
<?php if (! $hasStudents): ?>
<div class="alert alert-info">
We couldnt find any current enrollment for your account. Once your child is assigned to a Sunday class, their teachers progress reports will appear here.
</div>
<?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;
$statusLabel = $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 <?= esc($badgeClass) ?>"><?= esc($statusLabel) ?></span>
</div>
<div class="small text-muted">
<?= $report ? esc($report['unit_title'] ?: '-') : 'No submission' ?>
</div>
</div>
<?php endforeach; ?>
</div>
</td>
<td class="text-end">
<?php if ($exampleReport): ?>
<a href="<?= base_url('parent/progress/view/' . $exampleReport['id']) ?>" class="btn btn-sm btn-outline-primary">View Weekly Details</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php if (! empty($students)): ?>
<div class="accordion" id="parentProgressAccordion">
<?php foreach ($students as $index => $student): ?>
<?php
$studentId = (int) ($student['student_id'] ?? 0);
$studentName = trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? ''));
$studentName = $studentName !== '' ? $studentName : 'Student';
$className = $student['class_section_name'] ?? '';
$collapseId = 'student-progress-' . $studentId;
$headingId = 'student-progress-heading-' . $studentId;
$reportGroups = $studentReportGroups[$studentId] ?? [];
?>
<div class="accordion-item">
<h2 class="accordion-header" id="<?= esc($headingId) ?>">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#<?= esc($collapseId) ?>" aria-expanded="false" aria-controls="<?= esc($collapseId) ?>">
<div class="d-flex flex-column flex-md-row align-items-md-center gap-1 gap-md-3">
<span class="fw-semibold"><?= esc($studentName) ?></span>
<?php if ($className !== ''): ?>
<span class="text-muted small">Class: <?= esc($className) ?></span>
<?php endif; ?>
</div>
</button>
</h2>
<div id="<?= esc($collapseId) ?>" class="accordion-collapse collapse" aria-labelledby="<?= esc($headingId) ?>" data-bs-parent="#parentProgressAccordion">
<div class="accordion-body">
<?php if (empty($reportGroups)): ?>
<div class="alert alert-secondary mb-0">No reports submitted yet.</div>
<?php else: ?>
<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>
</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;
$statusLabel = $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 <?= esc($badgeClass) ?>"><?= esc($statusLabel) ?></span>
</div>
<div class="small text-muted">
<?= $report ? esc($report['unit_title'] ?: '-') : 'No submission' ?>
</div>
</div>
<?php endforeach; ?>
</div>
</td>
<td class="text-end">
<?php if ($exampleReport): ?>
<a href="<?= base_url('parent/progress/view/' . $exampleReport['id']) ?>" class="btn btn-sm btn-outline-primary">View Weekly Details</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
View File
Regular → Executable
View File
Regular → Executable
View File
View File
View File
View File
View File
View File
+52 -9
View File
@@ -24,6 +24,7 @@
</div>
<?php else: ?>
<?php foreach ($activeEvents as $event): ?>
<?php $externalParticipants = $externalParticipantsByEvent[$event['id']] ?? []; ?>
<div class="card mb-4">
<div class="card-body">
@@ -42,8 +43,52 @@
<?php endif; ?>
</div>
<!-- Event Description -->
<p class="card-text"><?= esc($event['description']) ?></p>
<div class="mb-3">
<h6 class="mb-1">Description</h6>
<?php if (!empty($event['description'])): ?>
<div class="mb-0"><?= $event['description'] ?></div>
<?php else: ?>
<p class="mb-0">No description</p>
<?php endif; ?>
</div>
<?php if (!empty($externalParticipants)): ?>
<div class="mb-3">
<h6 class="mb-2">External Participants</h6>
<div class="table-responsive">
<table class="table table-sm table-bordered mb-0">
<thead class="table-light">
<tr>
<th>Student Name</th>
<th>Status</th>
<th>Fee</th>
</tr>
</thead>
<tbody>
<?php foreach ($externalParticipants as $participant): ?>
<?php
$isPaid = !empty($participant['event_paid']) || ((float) ($participant['charged'] ?? 0) <= 0);
?>
<tr>
<td>
<?= esc($participant['name']) ?> <span class="text-muted">(external)</span>
<?php if (!empty($participant['note'])): ?>
<small class="text-muted d-block"><?= esc($participant['note']) ?></small>
<?php endif; ?>
</td>
<td>
<span class="badge bg-<?= $isPaid ? 'success' : 'danger' ?>">
<?= $isPaid ? 'Paid' : 'Unpaid' ?>
</span>
</td>
<td class="text-nowrap">$<?= esc(number_format((float) ($participant['charged'] ?? 0), 2)) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php endif; ?>
<!-- Participation Table -->
<form method="post" action="<?= site_url('parent/updateParticipation') ?>">
@@ -53,11 +98,10 @@
<div class="table-responsive">
<table class="table table-sm table-bordered">
<thead class="table-light">
<tr>
<th>Student First Name</th>
<th>Student Last Name</th>
<th class="text-center">Participate</th>
</tr>
<tr>
<th>Student Name</th>
<th class="text-center">Participate</th>
</tr>
</thead>
<tbody>
<?php foreach ($yourStudents as $student): ?>
@@ -66,8 +110,7 @@
$current = $charges[$key]['participation'] ?? '';
?>
<tr>
<td><?= esc($student['firstname']) ?></td>
<td><?= esc($student['lastname']) ?></td>
<td><?= esc(trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? ''))) ?></td>
<td class="text-center align-middle">
<div class="d-inline-flex align-items-center gap-3">
<div class="form-check">
+55
View File
@@ -143,12 +143,67 @@ $deadline = parseDbDateTime($dueDate, 'UTC', $displayTz); // format either DATE
</tbody>
</table>
</div>
<?php if (!empty($invoiceEventCharges)): ?>
<?php foreach ($invoices as $invoice): ?>
<?php $charges = $invoiceEventCharges[(int)($invoice['id'] ?? 0)] ?? []; ?>
<?php if (empty($charges)): ?>
<?php continue; ?>
<?php endif; ?>
<div class="card mb-3 shadow-sm">
<div class="card-header">
<strong>Event charges for Invoice #<?= esc($invoice['invoice_number'] ?? '#'.$invoice['id']) ?></strong>
</div>
<div class="card-body p-0">
<div class="table-responsive mb-0">
<table class="table table-sm table-bordered mb-0">
<thead class="table-light">
<tr>
<th>Event</th>
<th>Student</th>
<th>Fee</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($charges as $charge): ?>
<?php
$studentName = trim(($charge['student_firstname'] ?? '') . ' ' . ($charge['student_lastname'] ?? ''));
if ($studentName === '') {
$externalName = trim(($charge['external_firstname'] ?? '') . ' ' . ($charge['external_lastname'] ?? ''));
if ($externalName !== '') {
$studentName = $externalName . ' (external)';
}
}
$eventName = $charge['event_name'] ?? '—';
$paid = !empty($charge['event_paid']) || ((float)($charge['charged'] ?? 0) <= 0);
$badgeClass = $paid ? 'success' : 'danger';
?>
<tr>
<td><?= esc($eventName) ?></td>
<td><?= esc($studentName ?: '—') ?></td>
<td>$<?= number_format((float)($charge['event_amount'] ?? 0), 2) ?></td>
<td>
<span class="badge bg-<?= $badgeClass ?>">
<?= $paid ? 'Paid' : 'Unpaid' ?>
</span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php else: ?>
<div class="alert alert-info mb-3 d-inline-block">
No invoice found for the selected school year.
</div>
<?php endif; ?>
<?php $invoiceEventCharges = $invoiceEventCharges ?? []; ?>
<?= $this->endSection() ?>
<?= $this->section('scripts') ?>
View File
View File
View File
View File
+1 -1
View File
@@ -11,7 +11,7 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
<div class="alert alert-info mt-2">You've reached the maximum number of students (<?= $maxChilds ?>).</div>
<?php endif; ?>
<?php if ($disableEmergencyBtn): ?>
<!--div class="alert alert-info mt-2">You've reached the maximum number of emergency contacts (<--?= $maxEmergency ?>).</div-->
<!-- <div class="alert alert-info mt-2">You've reached the maximum number of emergency contacts (<?= esc((string) $maxEmergency) ?>).</div> -->
<?php endif; ?>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger">
+93 -5
View File
@@ -122,15 +122,40 @@
<div class="card shadow-sm">
<div class="card-body">
<?php
$cutoffDate = '';
$cutoffTime = '';
$cutoffThreshold = (string) ($cutoffThreshold ?? '09:00');
$cutoffTzAbbr = '';
try {
$tzName = (string) (config('School')->attendance['timezone'] ?? user_timezone());
$tz = new DateTimeZone($tzName ?: 'UTC');
$nowTz = new DateTime('now', $tz);
$cutoffDate = $nowTz->format('Y-m-d');
$cutoffTime = $nowTz->format('H:i');
$cutoffTzAbbr = $nowTz->format('T');
} catch (\Throwable $e) {
$cutoffDate = '';
$cutoffTime = '';
$cutoffTzAbbr = '';
}
?>
<form id="reportForm"
method="post"
action="<?= site_url('parent/report-attendance') ?>"
data-csrf-name="<?= esc(csrf_token()) ?>"
data-csrf-value="<?= esc(csrf_hash()) ?>"
data-check-url="<?= site_url('api/parent/report-attendance/check') ?>">
data-check-url="<?= site_url('api/parent/report-attendance/check') ?>"
data-cutoff-date="<?= esc($cutoffDate) ?>"
data-cutoff-time="<?= esc($cutoffTime) ?>"
data-cutoff-threshold="<?= esc($cutoffThreshold) ?>"
data-cutoff-blocked="0">
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>">
<div id="clientCheckAlert" class="alert d-none" role="alert"></div>
<div id="cutoffAlert" class="alert alert-warning d-none" role="alert">
Reporting closes at <?= esc($cutoffThreshold) ?><?= $cutoffTzAbbr !== '' ? ' ' . esc($cutoffTzAbbr) : '' ?> on the report date.
</div>
<div class="mb-3">
<label class="form-label fw-semibold">Select Child(ren)</label>
@@ -352,7 +377,10 @@
const dates = selectedDates();
if (!checkUrl || !dateSel || !typeSel) return;
if (!ids.length || !dates.length) {
if (submitBtn) submitBtn.disabled = false;
if (submitBtn) {
const cutoffBlocked = form.getAttribute('data-cutoff-blocked') === '1';
submitBtn.disabled = cutoffBlocked;
}
return;
}
@@ -395,7 +423,10 @@
}
if (!data || !data.ok) {
if (submitBtn) submitBtn.disabled = false;
if (submitBtn) {
const cutoffBlocked = form.getAttribute('data-cutoff-blocked') === '1';
submitBtn.disabled = cutoffBlocked;
}
return;
}
@@ -454,10 +485,16 @@
setAlert('', '');
}
if (submitBtn) submitBtn.disabled = (selectedIds().length === 0);
if (submitBtn) {
const cutoffBlocked = form.getAttribute('data-cutoff-blocked') === '1';
submitBtn.disabled = cutoffBlocked || (selectedIds().length === 0);
}
} catch (e) {
setAlert('warn', 'Could not verify submissions right now. You may proceed; server will validate.');
if (submitBtn) submitBtn.disabled = false;
if (submitBtn) {
const cutoffBlocked = form.getAttribute('data-cutoff-blocked') === '1';
submitBtn.disabled = cutoffBlocked;
}
}
}
@@ -472,4 +509,55 @@
runCheck();
});
</script>
<script>
// Cutoff enforcement helper (9:00 AM on the selected Sunday).
document.addEventListener('DOMContentLoaded', function() {
const form = document.getElementById('reportForm');
if (!form) return;
const dateSel = form.querySelector('select[name="dates[]"]');
const submitBtn = form.querySelector('button[type="submit"]');
const cutoffAlert = document.getElementById('cutoffAlert');
const cutoffDate = form.getAttribute('data-cutoff-date') || '';
const cutoffTime = form.getAttribute('data-cutoff-time') || '';
const cutoffThreshold = form.getAttribute('data-cutoff-threshold') || '09:00';
function parseTimeToMinutes(val) {
const parts = (val || '').split(':');
if (parts.length < 2) return null;
const hh = parseInt(parts[0], 10);
const mm = parseInt(parts[1], 10);
if (Number.isNaN(hh) || Number.isNaN(mm)) return null;
return (hh * 60) + mm;
}
function updateCutoffState() {
if (!dateSel || !cutoffDate || !cutoffTime) return;
const dates = Array.from(dateSel.selectedOptions || [])
.map(opt => opt.value)
.filter(v => v);
const nowMinutes = parseTimeToMinutes(cutoffTime);
const cutoffMinutes = parseTimeToMinutes(cutoffThreshold);
const isTodaySelected = dates.includes(cutoffDate);
const blocked = isTodaySelected && nowMinutes !== null && cutoffMinutes !== null && nowMinutes >= cutoffMinutes;
form.setAttribute('data-cutoff-blocked', blocked ? '1' : '0');
if (cutoffAlert) {
cutoffAlert.classList.toggle('d-none', !blocked);
}
if (submitBtn && blocked) {
submitBtn.disabled = true;
}
}
form.addEventListener('change', function(e) {
const tgt = e.target;
if (!tgt) return;
if (tgt.matches('select[name="dates[]"], input[name="student_ids[]"], #reportType')) {
updateCutoffState();
}
});
updateCutoffState();
});
</script>
<?= $this->endSection() ?>
+72
View File
@@ -0,0 +1,72 @@
<?= $this->extend('layout/main_layout') ?>
<?= $this->section('content') ?>
<div class="container my-5">
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-3">
<div>
<h3 class="text-success mb-1" style="font-family: Arial, sans-serif;">Report Cards</h3>
<div class="text-muted small">
<?= esc($schoolYear ?: 'N/A') ?> <?= $semester ? '• ' . esc($semester) . ' Semester' : '' ?>
</div>
</div>
</div>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('success')): ?>
<div class="alert alert-success"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<?php if (empty($students)): ?>
<div class="alert alert-info">No students available for report cards.</div>
<?php else: ?>
<div class="table-responsive">
<table class="table table-striped table-bordered align-middle">
<thead class="table-light">
<tr>
<th>Student</th>
<th>Class Section</th>
<th>Viewed</th>
<th>Signature</th>
<th class="text-end">Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($students as $student): ?>
<?php
$sid = (int) ($student['id'] ?? 0);
$ack = $ackMap[$sid] ?? null;
$viewedAt = $ack['viewed_at'] ?? '';
$signedAt = $ack['signed_at'] ?? '';
$signedName = $ack['signed_name'] ?? '';
?>
<tr>
<td><?= esc(trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? ''))) ?></td>
<td><?= esc($student['class_section_name'] ?? 'N/A') ?></td>
<td><?= $viewedAt ? esc(local_datetime($viewedAt, 'm-d-Y H:i')) : 'Not viewed' ?></td>
<td>
<?php if ($signedAt): ?>
<?= esc($signedName ?: 'Signed') ?><br>
<small class="text-muted"><?= esc(local_datetime($signedAt, 'm-d-Y H:i')) ?></small>
<?php else: ?>
<span class="text-muted">Not signed</span>
<?php endif; ?>
</td>
<td class="text-end">
<a class="btn btn-sm btn-outline-primary" target="_blank" href="<?= base_url('parent/report-cards/view/' . $sid) ?>">View Report</a>
<?php if (! $signedAt): ?>
<form class="d-inline-flex align-items-center gap-2 ms-2" method="post" action="<?= base_url('parent/report-cards/sign/' . $sid) ?>">
<?= csrf_field() ?>
<input type="text" name="signed_name" class="form-control form-control-sm" placeholder="Full name" required>
<button class="btn btn-sm btn-success" type="submit">Sign</button>
</form>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
<?= $this->endSection() ?>
Regular → Executable
+30 -1
View File
@@ -1,7 +1,9 @@
<?= $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;">Scores</h2>
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2">
<h3 class="text-success mb-0" style="font-family: Arial, sans-serif;">Scores</h3>
</div>
</div>
<!-- Filter Form -->
@@ -73,6 +75,7 @@ $showExamScoresBySemester = $showExamScoresBySemester ?? [];
<?php if ($showExamScoresForSemester): ?><th>Exam</th><?php endif; ?>
<?php endif; ?>
<?php if ($showExamScoresForSemester): ?><th>Semester Score</th><?php endif; ?>
<?php if ($showExamScoresForSemester): ?><th>Report Card</th><?php endif; ?>
</tr>
</thead>
<tbody>
@@ -96,6 +99,32 @@ $showExamScoresBySemester = $showExamScoresBySemester ?? [];
<?php if ($showExamScoresForSemester): ?><td><?= esc($student['scores']['midterm_exam']['score'] ?? $student['scores']['final_exam']['score'] ?? '-') ?></td><?php endif; ?>
<?php endif; ?>
<?php if ($showExamScoresForSemester): ?><td><?= esc($student['scores']['semester']['score'] ?? '-') ?></td><?php endif; ?>
<?php if ($showExamScoresForSemester): ?>
<td>
<?php
$reportStudentId = (int) ($student['student_id'] ?? 0);
if ($reportStudentId > 0) {
$reportYear = (string) ($selectedYear ?? '');
$reportSemester = (string) ($semester ?? '');
$reportDate = date('Y-m-d');
$reportUrl = base_url('parent/report-cards/view/' . $reportStudentId);
$query = http_build_query([
'school_year' => $reportYear,
'semester' => $reportSemester,
'report_date' => $reportDate,
]);
if ($query) {
$reportUrl .= '?' . $query;
}
}
?>
<?php if ($reportStudentId > 0): ?>
<a class="btn btn-sm btn-outline-primary" href="<?= esc($reportUrl) ?>" target="_blank" rel="noopener">View</a>
<?php else: ?>
<span class="text-muted">Unavailable</span>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php if (!empty($student['comment'])): ?>
<tr>
View File
View File