@extends('layouts.app') @section('title', 'Fee Management') @section('page-title', 'Fee Management') @section('content')
{{-- Messages --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- Stats Cards --}}

Total Invoices

{{ $stats['total_invoices'] }}

Total Billed

₹{{ number_format($stats['total_amount'], 0) }}

Collected

₹{{ number_format($stats['paid_amount'], 0) }}

Pending

{{ $stats['pending_count'] }}

Overdue

{{ $stats['overdue_count'] }}

{{-- Quick Actions --}}
Generate Invoices
{{-- Fee Structures --}}

Fee Structures

@forelse($structures as $s) @empty @endforelse
Name Class Amount Frequency Due Date Invoices
{{ $s->name }} {{ $s->class_?->full_name ?? 'All Classes' }} ₹{{ number_format($s->amount, 2) }} {{ str_replace('_', ' ', $s->frequency) }} {{ $s->due_date->format('d M Y') }} {{ $s->invoices->count() }}
No fee structures yet. Create one to get started.
{{-- Invoices List --}}

Invoices

{{-- Filters --}}
Clear
@forelse($invoices as $inv) {{-- Inline Payment Form --}} @empty @endforelse
Invoice # Student Fee Type Total Paid Balance Due Status Actions
{{ $inv->invoice_number }} {{ $inv->student?->name ?? 'Deleted' }}

{{ $inv->student?->studentProfile?->class_?->full_name ?? '' }}

{{ $inv->feeStructure?->name ?? '—' }} ₹{{ number_format($inv->total, 2) }} ₹{{ number_format($inv->paid_amount, 2) }} ₹{{ number_format($inv->balance, 2) }} {{ $inv->due_date->format('d M Y') }} @php $statusColors = [ 'paid' => 'bg-green-100 text-green-700', 'partial' => 'bg-blue-100 text-blue-700', 'pending' => 'bg-yellow-100 text-yellow-700', 'overdue' => 'bg-red-100 text-red-700', ]; @endphp {{ ucfirst($inv->status) }}
@if($inv->balance > 0) @endif @foreach($inv->payments->where('status', 'success')->take(1) as $p) @endforeach @if($inv->payments->where('status', 'success')->isEmpty())
@csrf @method('DELETE')
@endif
@csrf
No invoices found.
@if($invoices->hasPages())
{{ $invoices->links() }}
@endif
{{-- Create Fee Structure Modal --}} @endsection