@extends('dashboard.layouts.app') @section('content') @include('components.alert')
All Invoices
Filters
@forelse ($studentInvoices as $invoice) @php $student = $invoice->student; $studentName = trim(($student->first_name ?? '') . ' ' . ($student->last_name ?? '')); $partyName = $studentName ?: ($invoice->party_name ?? ''); $discountAmount = $invoice->discount_amount ?? 0; $paymentStatusClass = match ($invoice->payment_status) { 'paid' => 'ui-pill--success', 'pending', 'partial', 'paid_deposite', 'deposite' => 'ui-pill--warn', 'not_paid', 'unpaid' => 'ui-pill--danger', 'rejected' => 'ui-pill--danger', default => 'ui-pill--neutral', }; $completionStatusClass = !$invoice->display_completion_status ? 'ui-pill--neutral' : ($invoice->display_completion_status === 'complete' ? 'ui-pill--success' : 'ui-pill--warn'); $discountTypeClass = match ($invoice->discount_plan_type) { 'fixed' => 'ui-pill--info', 'percentage' => 'ui-pill--primary', default => 'ui-pill--neutral', }; @endphp {{ method_exists($studentInvoices, 'firstItem') ? $studentInvoices->firstItem() + $loop->index : $loop->iteration }}
{{ $invoice->invoice_number }}
{{ $invoice->discount_plan_type ? ucfirst($invoice->discount_plan_type) : 'No Discount' }} @if ($invoice->discount_plan_type == 'percentage') {{ $invoice->discount_plan_price !== null ? number_format($invoice->discount_plan_price, 0) . '%' : '0%' }} @else {{ number_format($invoice->discount_plan_price ?? 0, 2) }} @endif {{ number_format($discountAmount, 2) }} @php $invoiceReceipts = app(\App\Services\InvoiceReceiptPresentationService::class) ->groups($invoice); @endphp @if($invoiceReceipts) @include('dashboard.student_invoices._received_amounts', [ 'receiptGroups' => $invoiceReceipts ]) Received @else {{ number_format($invoice->net_price ?? 0, 2) }} {{ $invoice->currency ?: 'EGP' }} @endif @if(($invoice->deposit_amount ?? 0) > 0) @include('dashboard.student_invoices._received_amounts', ['receiptGroups' => $invoiceReceipts, 'receiptFallbackAmount' => $invoice->deposit_amount, 'receiptFallbackCurrency' => $invoice->currency ?: 'EGP']) @else -- @endif @if ($student) {{ strtoupper(substr($student->first_name ?? 'S', 0, 1) . substr($student->last_name ?? '', 0, 1)) }} {{ $studentName ?: 'Student' }} Open student profile @else {{ $partyName ?: '-' }} @endif {{ $invoice->payment_status_label ?? ucfirst(str_replace('_', ' ', $invoice->payment_status ?? 'N/A')) }} {{ $invoice->display_completion_status_label }} {{ ucfirst($invoice->type ?? 'N/A') }} @empty
No sales invoices found.

Try changing filters or search keyword.

@endforelse
@if ($studentInvoices->hasPages())
{{ $studentInvoices->appends(request()->except('page'))->links('pagination::bootstrap-5') }}
@endif
@endsection @push('styles') @endpush @push('scripts') @endpush