Compare commits
2 Commits
63a9203aab
...
1e30a74072
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e30a74072 | |||
|
|
40a6a8b49a |
@ -35,9 +35,7 @@ public function index(PaginatedRequest $request): Response
|
||||
$academicTerms = $this->academicTermService->getAllForSelect();
|
||||
|
||||
$requestedTermId = $request->validated('academic_term_id');
|
||||
$defaultTermId = $academicTerms->firstWhere('is_active', true)?->id
|
||||
?? $academicTerms->sortByDesc('start_date')->first()?->id;
|
||||
$summaryTermId = $requestedTermId ?? $defaultTermId;
|
||||
$summaryTermId = $requestedTermId ?? $this->academicTermService->getActive()?->id;
|
||||
|
||||
return Inertia::render('admin/finances/tuition-invoices/index', [
|
||||
'invoices' => $this->service->paginated(
|
||||
|
||||
@ -14,6 +14,16 @@ public function getAllForSelect(): Collection
|
||||
return AcademicTerm::select(['id', 'name', 'semester', 'start_date', 'end_date', 'is_active'])->latest()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* The academic term currently marked active, falling back to the one with
|
||||
* the latest start date if none is explicitly active.
|
||||
*/
|
||||
public function getActive(): ?AcademicTerm
|
||||
{
|
||||
return AcademicTerm::where('is_active', true)->first()
|
||||
?? AcademicTerm::orderByDesc('start_date')->first();
|
||||
}
|
||||
|
||||
public function paginated(int $perPage = 25, string $search = '', ?string $semester = null, ?bool $isActive = null): LengthAwarePaginator
|
||||
{
|
||||
return AcademicTerm::query()
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
import { Head, router } from '@inertiajs/react';
|
||||
import { format } from 'date-fns';
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
import {
|
||||
CircleDollarSign,
|
||||
FileText,
|
||||
Plus,
|
||||
UserRoundX,
|
||||
Wallet,
|
||||
} from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
import type { PaginationState } from '@/components/data-table';
|
||||
import { DataTable } from '@/components/data-table';
|
||||
import { DatePicker } from '@/components/date-picker';
|
||||
@ -55,17 +66,6 @@ import {
|
||||
PaymentStatusLabels,
|
||||
PaymentStatuses,
|
||||
} from '@/types/tuition-payment';
|
||||
import { Head, router } from '@inertiajs/react';
|
||||
import { format } from 'date-fns';
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
import {
|
||||
CircleDollarSign,
|
||||
FileText,
|
||||
Plus,
|
||||
UserRoundX,
|
||||
Wallet,
|
||||
} from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
import { createTuitionInvoiceColumns } from './columns';
|
||||
|
||||
type AcademicTermOption = { id: number; name: string; semester: string };
|
||||
@ -208,8 +208,8 @@ export default function TuitionInvoiceIndex({
|
||||
Ringkasan berikut hanya menampilkan periode{' '}
|
||||
{summaryAcademicTerm
|
||||
? formatAcademicTermLabel(summaryAcademicTerm)
|
||||
: '-'}
|
||||
{' '} dan bisa disesuaikan lewat filter.
|
||||
: '-'}{' '}
|
||||
dan bisa disesuaikan lewat filter.
|
||||
</p>
|
||||
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user