@extends('layouts.backend') @section('content')

Loads To Invoice

{{-- Payment-type filter pills (accounts-only). Each pill carries a live count bubble sourced from BackendController@ReadyLoads. --}}
#
Reference
LRN
Type of Entry
GMR
Status
@foreach ($loads as $no => $load) @php // Credit-line overdue flag. Only meaningful when viewing the // Credit pill; otherwise a prepaid job has no "grace period". $isOverdueToInvoice = false; if (($paymentType ?? 'credit') === 'credit' && !empty($load->updated_at)) { try { $daysSinceReady = \Carbon\Carbon::parse($load->updated_at)->diffInDays(now()); $isOverdueToInvoice = $daysSinceReady >= ($creditOverdueDays ?? 3); } catch (\Throwable $e) { $isOverdueToInvoice = false; } } @endphp
{{ $load->customer_reference }}
{{ $load->lrn }}
{{ optional($load->getTypeOfEntry)->type ?? '—' }}
{{ $load->gmr == '0' ? 'No' : 'Yes' }}
{{ optional($load->getStatus)->status ?? '—' }} @if($isOverdueToInvoice) TO BE INVOICED @endif
@php // Null-safety: relationships can be null if the // related user / customer row has been hard- // deleted (account purge, employee removal). // Previously this 500'd the whole page inside // the foreach with "Property name on null". $uName = optional($load->getUser)->name ?? 'Unknown'; $cId = optional($load->getCustomer)->id; $cName = optional($load->getCustomer)->legal_name ?? 'Unknown customer'; @endphp
by: {{ $uName }} (Company: @if($cId) {{ $cName }} @else {{ $cName }} @endif ) on {{date('d M Y H:i',strtotime($load->created_at))}}
@endforeach {{$loads->links('vendor.pagination.default')}}
@endsection