This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user