@foreach ($loads as $no => $load) @php // Credit-line overdue flag — mirrors the logic in // backend/financial/ReadyLoads.blade.php so that the // 3-second AJAX refresh does not strip the red flag // off rows that are still past their credit term. $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 — mirrors the full-page // ReadyLoads blade. Without this, a job // whose uploader/customer has been purged // 500s the 3s poll, freezing the list. $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 {{-- Preserve the active paymentType on pagination generated by the poll, so clicking page N doesn't silently drop back to the default Credit view. --}} {{$loads->appends(['pageName' => 'ReadyLoads', 'page_number' => $page_number, 'paymentType' => ($paymentType ?? 'credit')])->links('vendor.pagination.default')}}