@extends('layouts.mainlayout') @section('fullwidth', true) @section('content') @php $canColumn = function ($key) { return Auth::user()->canSeeElement("summary", "columns", $key); }; $visibleColumnCount = collect(["date", "direction", "location", "staff", "route", "transport", "status"])->filter($canColumn)->count(); $sortUrl = function ($column) use ($sort, $sortDirection) { $nextDirection = $sort === $column && $sortDirection === 'asc' ? 'desc' : 'asc'; return request()->fullUrlWithQuery(['sort' => $column, 'direction' => $nextDirection, 'page' => null]); }; $statusMap = [ 1 => ['Ticketed', 'is-ticketed'], 2 => ['In progress', 'is-progress'], 3 => ['Arrived', 'is-arrived'], 4 => ['Issue', 'is-issue'], 5 => ['Cancelled', 'is-issue'], ]; $transportLabel = function ($row) { $airportFrom = trim((string) $row->airport_from); $airportWhere = trim((string) $row->airport_where); if ($airportFrom !== '' && $airportWhere !== '' && $airportFrom !== '0' && $airportWhere !== '0') { return $airportFrom.' – '.$airportWhere; } $bus = (string) $row->bus; if (isset($bus[0]) && $bus[0] === '3') return 'Own cost'; if (isset($bus[0]) && $bus[0] === '4') return 'Bus'; if (isset($bus[0]) && in_array($bus[0], ['1', '2'], true)) return 'Airplane'; return 'Not specified'; }; @endphp

Transit summary

The operational data used by the general transit summary email.

{{ number_format($summaryRows->total()) }} records
Search and filter
@foreach($selectedDates as $selectedDate)@endforeach
@if(Auth::user()->canSeeElement("summary", "buttons", "apply_filter"))@endif @if(Auth::user()->canSeeElement("summary", "buttons", "reset_filter") && ($search !== '' || $dateFrom !== '' || $dateTo !== '' || $selectedDates)) Reset @endif
General summary
@foreach(['date'=>'Date','direction'=>'Direction','location'=>'Location','staff'=>'Staff','route'=>'Route','transport'=>'Transport','status'=>'Status'] as $columnKey=>$columnLabel)@if($canColumn($columnKey))@endif @endforeach @forelse($summaryRows as $row) @php $isArrival = $row->from === 'Home'; $isDeparture = $row->where === 'Home'; $direction = $isArrival ? 'Arrival' : ($isDeparture ? 'Departure' : 'Transfer'); $location = $isArrival ? $row->where : ($isDeparture ? $row->from : $row->where); [$statusLabel, $statusClass] = $statusMap[(int) $row->status] ?? ['Unknown', 'is-muted']; $ticketUrl = trim((string) ($row->ticket_url ?? '')); $hasTicket = (int) $row->status === 1 && $ticketUrl !== '' && file_exists(public_path('tranzit/'.$ticketUrl)); if ((int) $row->status === 1) { $statusLabel = $hasTicket ? 'Ticketed' : 'Ticket ordered'; } @endphp @if($canColumn("date"))@endif @if($canColumn("direction"))@endif @if($canColumn("location"))@endif @if($canColumn("staff"))@endif @if($canColumn("route"))@endif @if($canColumn("transport"))@endif @if($canColumn("status"))@endif @empty @endforelse
@if($columnKey === 'date')@else{{ $columnLabel }}@endif
{{ $row->arrival_date }}{{ $direction }}{{ $location }}{{ trim($row->firstname.' '.$row->lastname) ?: 'Unknown staff' }}{{ $row->from }} {{ $row->where }}{{ $transportLabel($row) }} @if((int) $row->status !== 5) @if($hasTicket) {{ $statusLabel }} @else {{ $statusLabel }} @endif @endif @php $summaryChangedToday = !empty($row->modified_at) && in_array(date('Y-m-d', strtotime($row->modified_at)), [date('Y-m-d'), date('Y-m-d', strtotime('-1 day'))], true); $summaryWasModified = strpos((string) ($row->modification_summary ?? ''), 'Reason:') !== false; $summaryModificationTitle = $row->modification_summary ?: 'Transit details were modified.'; @endphp @if((int) $row->status === 5 && $summaryChangedToday) Deleted/Cancelled @elseif($summaryWasModified) Modified @endif
No summary records foundChange the search term or date interval.
@if($summaryRows->hasPages())
Showing {{ $summaryRows->firstItem() }}–{{ $summaryRows->lastItem() }} of {{ $summaryRows->total() }} {{ $summaryRows->links() }}
@endif
@endsection