@extends('layouts.master') @section('title', trans('messages.invoices')) @section('content') @php $sort = request()->get('sort', 'created_at'); $direction = request()->get('direction', 'desc'); @endphp
@can('invoices.bulk_delete')
@endcan
@csrf
@can('invoices.bulk_delete') @endcan @forelse($invoices as $invoice) @can('invoices.bulk_delete') @endcan @empty @endforelse
{{ trans('messages.invoice_number') }} @if($sort === 'invoice_number') @else @endif {{ trans('messages.customer') }} {{ trans('messages.date') }} @if($sort === 'created_at') @else @endif {{ trans('messages.total') }} @if($sort === 'total') @else @endif {{ trans('messages.paid') }} @if($sort === 'paid_amount') @else @endif {{ trans('messages.due') }} @if($sort === 'due_amount') @else @endif {{ trans('messages.status') }} @if($sort === 'status') @else @endif {{ trans('messages.actions') }}
{{ $invoice->invoice_number }} {{ $invoice->customer?->name ?? $invoice->customer_name }} {{ $invoice->created_at->format('Y-m-d') }} {{ format_currency($invoice->total) }} {{ format_currency($invoice->paid_amount) }} {{ format_currency($invoice->due_amount) }} @php $badgeClass = match($invoice->status) { 'paid' => 'success', 'partially_paid' => 'warning', 'draft' => 'secondary', 'returned' => 'danger', default => 'info' }; @endphp {{ trans('messages.' . $invoice->status) }} @can('invoices.view') @endcan @can('invoices.pdf') @endcan
{{ trans('messages.no_invoices_found') }}
{{ $invoices->links() }}
@include('partials.bulk-delete-modal') @endsection