@extends('cargo_company.templates.layout') @section('head') @endsection @section('content')
Reports Overview
{{-- ============ STAT CARDS ============ --}}
@php $cards = [ ['Total Shipments', 'total_shipments', 'ri-ship-2-line', 'blue'], ['In Transit', 'in_transit', 'ri-roadster-line', 'amber'], ['Delivered', 'delivered', 'ri-checkbox-circle-line', 'green'], ['Cancelled', 'cancelled', 'ri-close-circle-line', 'red'], ['Total Deliveries', 'total_deliveries', 'ri-truck-line', 'cyan'], ['Active Deliveries', 'active_deliveries', 'ri-loader-4-line', 'gray'], ]; @endphp @foreach($cards as [$label, $key, $icon, $color])

{{ $label }}

{{ number_format($totals[$key]) }}

@endforeach

Total Charges

{{ number_format($totals['total_charges'], 2) }} AED

Total Items Handled

{{ number_format($totals['total_items']) }}

{{-- ============ BREAKDOWN ============ --}}
{{-- Shipments per month --}}
Shipments — Last 6 Months
Monthly totals
@php $max = collect($monthly)->max('total') ?: 1; @endphp @forelse($monthly as $m)
{{ $m->month }}
{{ $m->total }}
@empty
No data yet
@endforelse
{{-- Top merchants --}}
Top Merchants
By shipments
@php $maxM = collect($topMerchants)->max('total') ?: 1; @endphp @forelse($topMerchants as $tm)
{{ $tm->merchant?->company_name ?: ($tm->merchant?->name ?: '—') }}
{{ $tm->total }}
@empty
No data yet
@endforelse
{{-- Top transporters --}}
Top Transporters
By deliveries
@php $maxT = collect($topTransporters)->max('total') ?: 1; @endphp
@forelse($topTransporters as $tt)
{{ $tt->transporter?->company_name ?: ($tt->transporter?->name ?: '—') }}
{{ $tt->total }}
@empty
No data yet
@endforelse
@endsection