feat: update student import and graduation workflows
This commit is contained in:
@@ -21,7 +21,7 @@ class StudentExitController extends Controller
|
||||
$departmentId = $request->get('department_id');
|
||||
$classId = $request->get('class_id');
|
||||
|
||||
$studentExits = StudentExit::query()
|
||||
$studentExitsQuery = StudentExit::query()
|
||||
->with(['academicYear', 'department', 'classRoom'])
|
||||
->when($search !== '', function ($query) use ($search) {
|
||||
$query->where(function ($subQuery) use ($search) {
|
||||
@@ -32,12 +32,25 @@ class StudentExitController extends Controller
|
||||
})
|
||||
->when($academicYearId, fn ($query) => $query->where('academic_year_id', $academicYearId))
|
||||
->when($departmentId, fn ($query) => $query->where('department_id', $departmentId))
|
||||
->when($classId, fn ($query) => $query->where('class_id', $classId))
|
||||
->when($classId, fn ($query) => $query->where('class_id', $classId));
|
||||
|
||||
$studentExits = (clone $studentExitsQuery)
|
||||
->latest('exit_date')
|
||||
->latest('id')
|
||||
->paginate(10)
|
||||
->withQueryString();
|
||||
|
||||
$totalExits = StudentExit::count();
|
||||
$withLetterCount = StudentExit::query()->whereNotNull('exit_letter_file_path')->count();
|
||||
$withoutLetterCount = max($totalExits - $withLetterCount, 0);
|
||||
$thisYearCount = StudentExit::query()->whereYear('exit_date', now()->year)->count();
|
||||
$latestExitDate = StudentExit::query()->max('exit_date');
|
||||
$recentExits = StudentExit::query()
|
||||
->latest('exit_date')
|
||||
->latest('id')
|
||||
->limit(3)
|
||||
->get(['id', 'full_name', 'exit_date', 'department_id', 'class_id']);
|
||||
|
||||
return view('student-exits.index', [
|
||||
'studentExits' => $studentExits,
|
||||
'search' => $search,
|
||||
@@ -49,6 +62,15 @@ class StudentExitController extends Controller
|
||||
'academicYears' => AcademicYear::orderBy('name')->pluck('name', 'id'),
|
||||
'departments' => Department::orderBy('name')->pluck('name', 'id'),
|
||||
'classes' => SchoolClass::orderBy('name')->pluck('name', 'id'),
|
||||
'summary' => [
|
||||
'total' => $totalExits,
|
||||
'with_letter' => $withLetterCount,
|
||||
'without_letter' => $withoutLetterCount,
|
||||
'this_year' => $thisYearCount,
|
||||
'latest_exit_date' => $latestExitDate,
|
||||
'filtered' => $studentExits->total(),
|
||||
],
|
||||
'recentExits' => $recentExits,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user