fix parent and teacher pages to follow year filter
Tests / PHPUnit (push) Failing after 1m15s

This commit is contained in:
root
2026-07-15 20:03:36 -04:00
parent feb1b29a32
commit 5f27dccd0f
32 changed files with 582 additions and 364 deletions
+2 -18
View File
@@ -1644,23 +1644,8 @@ private function getGradeLevel($grade): array
return redirect()->back()->with('error', 'Unable to retrieve student data. Please contact support.');
}
$currentSchoolYear = $this->schoolYear;
// Get available school years from invoices
$schoolYears = $this->invoiceModel
->select('school_year')
->distinct()
->where('parent_id', $parentId)
->orderBy('school_year', 'DESC')
->findAll();
// Determine which year to show
$selectedYear = $this->request->getGet('school_year');
if (empty($selectedYear)) {
$hasCurrentYear = in_array($currentSchoolYear, array_column($schoolYears, 'school_year'));
$selectedYear = $hasCurrentYear ? $currentSchoolYear : (!empty($schoolYears) ? $schoolYears[0]['school_year'] : null);
}
$currentSchoolYear = $this->currentSchoolYearName((string) ($this->schoolYear ?? ''));
$selectedYear = $currentSchoolYear;
// Fetch invoices for the selected year
$invoices = [];
@@ -1718,7 +1703,6 @@ private function getGradeLevel($grade): array
return view('/parent/invoice_payment', [
'invoices' => $invoices,
'schoolYears' => $schoolYears,
'selectedYear' => $selectedYear,
'currentSchoolYear' => $currentSchoolYear,
'dueDate' => $this->dueDate,