@extends('layouts.pdf-layout') @section('letter_title')

{{ strtoupper('UP COUNTRY LUGG & PARCEL REPORT') }}

@endsection @section('content') @if (!empty($finalOutput)) @php // Get all unique cities from the final output for header $allCities = []; foreach ($finalOutput as $dateData) { foreach ($dateData[1] as $cityData) { $allCities[$cityData['city']] = true; // Unique cities } } @endphp @foreach (array_keys($allCities) as $city) @endforeach @foreach ($finalOutput as $dateData) @foreach (array_keys($allCities) as $city) @php // Find city data for the current date $cityData = collect($dateData[1])->firstWhere('city', $city); @endphp @endforeach @endforeach
Day Date{{ $city }}
{{ (new DateTime($dateData[0]))->format('l') }} {{ $dateData[0] }} @if ($cityData) {{ number_format($cityData['total_sales']) }} @else - @endif
@else

No data available for the selected date.

@endif @endsection