@extends('layouts.dashboard') @section('page_title', 'Accounting Manager') @php $tabs = [ 'delivered' => ['label' => 'Delivered', 'icon' => 'fa-truck-ramp-box'], 'completed' => ['label' => 'Completed', 'icon' => 'fa-clipboard-check'], 'invoiced' => ['label' => 'Invoiced', 'icon' => 'fa-file-invoice-dollar'], 'paid' => ['label' => 'Invoice / Paid', 'icon' => 'fa-circle-check'], ]; $searchFields = [ 'all' => 'Search All', 'load_number' => 'Load Number', 'invoice_number' => 'Invoice Number', 'customer' => 'Customer', 'dispatcher' => 'Dispatcher', 'carrier' => 'Carrier', 'driver' => 'Driver', 'truck' => 'Truck', 'trailer' => 'Trailer', 'work_order' => 'Work Order #', 'shipper' => 'Shipper', 'origin_city' => 'Origin City', 'origin_state' => 'Origin State', 'po_numbers' => 'P.O. Numbers', 'consignee' => 'Consignee', 'destination_city' => 'Destination City', ]; $carrierDriverLabel = function ($load) { $carrier = $load->assignments->firstWhere('assignment_type', 'carrier'); if ($carrier && $carrier->carrierCompany) { return $carrier->carrierCompany->display_name; } $driver = $load->assignments->firstWhere('assignment_type', 'driver'); if ($driver && $driver->driver) { return $driver->driver->full_name; } return '—'; }; $shipDate = function ($load) { $stop = $load->shippers->first(); return $stop && $stop->scheduled_at ? $stop->scheduled_at->format('Y-m-d') : '—'; }; @endphp @push('styles') @endpush @section('content')
@php $qs = request()->only(['search_field', 'search', 'date_from', 'date_to', 'customer_id']); @endphp
@foreach ($tabs as $key => $meta) {{ $meta['label'] }} @endforeach
@if ($tab === 'completed')
@endif
@if (in_array($tab, ['invoiced', 'paid']))
Exported Batch Invoice Exported & Batch Invoice
@endif
@if ($tab === 'completed') @endif @if (in_array($tab, ['invoiced', 'paid'])) @else @endif @if ($tab === 'invoiced') @elseif ($tab === 'paid') @endif @forelse ($loads as $load) @php $record = $load->accountingRecord; $rowClass = ''; if ($record) { if ($record->is_exported && $record->is_batch_invoice) { $rowClass = 'ff-acc-row--both'; } elseif ($record->is_exported) { $rowClass = 'ff-acc-row--exported'; } elseif ($record->is_batch_invoice) { $rowClass = 'ff-acc-row--batch'; } } $aging = $record?->agingDays(); $agingClass = $aging === null ? '' : ($aging > 30 ? 'ff-acc-aging--late' : ($aging > 14 ? 'ff-acc-aging--warn' : 'ff-acc-aging--ok')); @endphp @if ($tab === 'completed') @endif @if (in_array($tab, ['invoiced', 'paid'])) @else @endif @if ($tab === 'invoiced') @elseif ($tab === 'paid') @endif @empty @endforelse
Load #Invoice # Invoice DateShip DateCustomer Driver / CarrierPaid AgingPaid Days To PayOptions
{{ $load->load_number }}{{ $record?->invoice_number ?? '—' }} {{ $record?->invoiced_at?->format('Y-m-d') ?? '—' }}{{ $shipDate($load) }}{{ $load->customerCompany?->display_name ?? '—' }} {{ $carrierDriverLabel($load) }} {{ $aging ?? 0 }} {{ $record?->daysToPay() ?? '—' }}
@if ($tab === 'delivered') @elseif ($tab === 'completed') @elseif ($tab === 'invoiced') @elseif ($tab === 'paid') @endif
No {{ $tabs[$tab]['label'] }} loads found for the selected filters.
Showing {{ $loads->firstItem() ?? 0 }}–{{ $loads->lastItem() ?? 0 }} of {{ $loads->total() }}
{{ $loads->links('pagination::bootstrap-5') }}
{{-- Edit Load notes modal --}} {{-- Mark Paid confirmation modal --}} {{-- Mark Unpaid reason modal --}} {{-- Email Invoice modal --}} {{-- Invoice template preview modal --}}
@endsection @push('scripts') @endpush