{{-- Auto-refresh guard: reloads the page when the operating day or the open/closed status changes (e.g. a kiosk left running overnight). --}}
{{-- Today's date --}}

{{ $today->translatedFormat('l j F Y') }}

{{ __('log.daily_log.today') }}

{{-- Status + add button --}}
@if ($isOpen) {{ __('log.daily_log.open') }} @if ($currentRunway) RWY {{ $currentRunway }} @endif @else {{ __('log.daily_log.closed') }} @endif @if ($statusEvent)

{{ __($isOpen ? 'log.daily_log.opened_by_at' : 'log.daily_log.closed_by_at', [ 'name' => $statusEvent->actorName(), 'time' => $statusEvent->occurredAtLocal()->isToday() ? $statusEvent->occurredAtLocal()->format('H:i') : $statusEvent->occurredAtLocal()->format('d/m H:i'), ]) }}

@endif
@if ($isOpen) + {{ __('log.daily_log.add_entry') }} @endif
{{-- Flight list --}} @if ($flights->isEmpty())
{{ __('log.daily_log.empty') }}
@else
@foreach ($flights as $flight)
{{-- Header --}}
{{ $flight->registration }} @if ($flight->movement_type) @if ($flight->movementIcon()){{ $flight->movementIcon() }} @endif{{ $flight->movement_type }} @endif @if ($flight->aircraft_type) {{ $flight->aircraft_type }} @endif
{{ __('log.daily_log.dep') }} {{ $flight->departure_time ? \Illuminate\Support\Str::substr($flight->departure_time, 0, 5) : '—' }} {{ __('log.daily_log.ldg') }} {{ $flight->landing_time ? \Illuminate\Support\Str::substr($flight->landing_time, 0, 5) : '—' }}
{{-- Details --}}
{{ __('log.daily_log.pilot') }} {{ $flight->pilot_name }} @if ($flight->persons_on_board) {{ __('log.daily_log.pob') }} {{ $flight->persons_on_board }} @endif @if ($flight->origin || $flight->destination) {{ __('log.common.route') }} {{ $flight->origin ?: '—' }} → {{ $flight->destination ?: '—' }} @endif @if ($flight->landings_count) {{ __('log.common.landings') }} {{ $flight->landings_count }} @endif
{{-- Remarks --}} @if ($flight->remarks)
{{ $flight->remarks }}
@endif {{-- Action --}}
{{ __('log.daily_log.logged_at', ['time' => $flight->created_at->timezone($timezone)->format('H:i')]) }} @if ($flight->isWithinCorrectionWindow()) ✏️ {{ __('log.daily_log.edit') }} @endif
@if ($flight->destination === $homeCode) @if ($flight->isComplete()) ✓ {{ __('log.daily_log.complete') }} @else {{ $flight->landing_time ? __('log.daily_log.edit_landing') : __('log.daily_log.complete_landing') }} @endif @endif
@endforeach
@endif