@php use App\Domain\Attendance\EventType; $stateKey = $today['state']->langKey(); $order = [EventType::TravelCheckIn, EventType::StartWork, EventType::StartBreak, EventType::EndBreak, EventType::ReturnDeparture, EventType::FinalCheckOut]; $primary = in_array($today['state']->value, ['working']) ? ($today['dualJourney'] ? EventType::ReturnDeparture : EventType::FinalCheckOut) : ($today['allowed'][0] ?? null); @endphp
$dashboard, 'mx-auto flex max-w-2xl flex-col gap-4' => ! $dashboard])> @if($employeeDashboard) @include('livewire._employee-dashboard') @else @include('livewire._worksite-selection') @if ($dashboard) {{-- Worker home: four summary cards (status now, planned shift, recorded work time, GPS), same data as the record below. --}}
@php $tones = ['working' => 'bg-success-soft text-success', 'finished' => 'bg-success-soft text-success', 'traveling' => 'bg-info-soft text-primary', 'on_break' => 'bg-warning-soft text-warning', 'private_leave' => 'bg-warning-soft text-warning']; $tone = $tones[$today['state']->value] ?? 'bg-muted text-muted-foreground'; @endphp @foreach ([['user-round-check', __('attendance.summary.status')], ['calendar-clock', __('attendance.summary.schedule')], ['clock-3', __('attendance.summary.duration')], ['map-pin', __('attendance.summary.gps')]] as $i => [$icon, $label])

{{ $label }}

@if ($i === 0)

{{ __('workStatus.'.$stateKey) }}

@elseif ($i === 1)

{{ $planned ? $planned['startTime'].'–'.$planned['endTime'] : __('attendance.summary.noSchedule') }}

{{ $planned ? __('attendance.summary.scheduleNote', ['timezone' => $tz]) : __('attendance.summary.noScheduleNote') }}

@elseif ($i === 2)

{{ $workMinutes >= 60 ? intdiv($workMinutes, 60).'h '.str_pad((string) ($workMinutes % 60), 2, '0', STR_PAD_LEFT).'m' : $workMinutes.'m' }}

{{ __('attendance.summary.durationNote') }}

@else

{{ __('attendance.summary.gpsStates.prompt') }}

{{ __('attendance.summary.gpsNote') }}

@endif
@endforeach
@endif @if($actionsReady)
$dashboard]) aria-labelledby="att-title">

{{ __('attendance.title') }}

{{ __($attendanceMode === 'manual' ? 'scanning.manualSubtitle' : 'attendance.subtitle') }}

in_array($today['state']->value, ['working']), 'bg-info-soft text-accent-foreground' => in_array($today['state']->value, ['traveling', 'on_break', 'private_leave']), 'bg-muted text-muted-foreground' => in_array($today['state']->value, ['not_started', 'finished'])])>{{ __('workStatus.'.$stateKey) }}
$dashboard])>
{{ __('attendance.summary.schedule') }}
{{ $planned ? $planned['startTime'].'–'.$planned['endTime'] : __('attendance.summary.noSchedule') }}
{{ $planned ? __('attendance.summary.scheduleNote', ['timezone' => $tz]) : __('attendance.summary.noScheduleNote') }}
{{ __('attendance.summary.gps') }}
{{ __('attendance.summary.gpsStates.prompt') }}
{{ __('attendance.summary.gpsNote') }}
@if ($pending)
{{ __('attendance.lateBanner.title', ['minutes' => $pending->minutes_late]) }}
@endif @if(!$today['closed'])
@foreach(['automatic','manual'] as $mode) @endforeach
@if($attendanceMode === 'manual')
{{ __('scanning.manual') }}

{{ __('scanning.manualHint') }}

@endif @endif @include('livewire._journey-clocks')
@if ($today['closed'])

! $dashboard, 'bg-success-soft text-success' => $dashboard && $today['closed'] === 'finished', 'bg-warning-soft text-warning' => $dashboard && $today['closed'] !== 'finished'])>{{ __('attendance.closed.'.$today['closed']) }}

@endif {{-- Stepper: six primary actions. Done = check + time, available = the action, otherwise "not now". The server still decides what is valid. --}}
    @foreach ($order as $n => $step) @php $last = $events->where('type', $step)->last(); $available = in_array($step, $today['allowed'], true) && ! $today['closed']; $done = (bool) $last; $journeyActive = $today['dualJourney'] && (($step === EventType::TravelCheckIn && $today['state']->value === 'traveling') || ($step === EventType::ReturnDeparture && $today['state']->value === 'return_travel')); @endphp
  1. @unless ($loop->last)@endunless @if ($available) @php $isPrimary = $primary === $step; @endphp @else
    $done, 'border-border/60 bg-muted/30 text-muted-foreground' => ! $done])> {{ $n + 1 }}. {{ $step->label('buttons',$today['dualJourney'],$today['sixStep']) }}{{ $done ? __('attendance.lastRegisteredAt', ['time' => $last->recorded_at->setTimezone($tz)->format('H:i')]) : (!$today['dualJourney'] && config('worksites.enabled') && $attendanceMode !== 'manual' && $step === EventType::TravelCheckIn ? __('scanning.checkInHint') : $step->label('hints',$today['dualJourney'],$today['sixStep'])) }} @if ($done){{ $last->recorded_at->setTimezone($tz)->format('H:i') }}@if(isset($last->metadata['manual'])){{ __('scanning.manual') }}@endif@else{{ __('attendance.states.unavailable') }}@endif
    @endif
  2. @endforeach

{{ __('attendance.gpsModal.locating') }}

{{ __($today['sixStep'] ? 'sixStep.gpsFootnote' : ($today['dualJourney'] ? 'journeys.gpsFootnote' : 'attendance.gpsFootnote')) }}

@include('livewire._attendance-secondary')
@if ($error) @elseif ($notice)

@if ($notice === 'explanationSaved'){{ __('attendance.toast.explanationSaved') }}. {{ __('attendance.toast.explanationSavedBody') }} @else{{ __('attendance.toast.saved', ['action' => __($today['sixStep'] && Lang::has('sixStep.actions.'.$notice) ? 'sixStep.actions.'.$notice : 'attendance.actions.'.$notice)]) }}@endif

@endif
@endif
$dashboard]) aria-labelledby="rec-title">

{{ __('attendance.record.title') }}

{{ __('attendance.record.subtitle', ['timezone' => $tz]) }}

@if ($events->isEmpty())

{{ __('attendance.record.empty') }}

{{ __('attendance.record.emptyHint') }}

@elseif ($dashboard) {{-- Timeline (worker home): one ring per saved event, the time in blue, the state the event led to, and the GPS accuracy when a fix was saved. --}} @php $after = ['worksite_arrival'=>['onSite','bg-info-soft text-primary'],'return_departure'=>['returnTravel','bg-info-soft text-primary'],'travel_check_in' => ['traveling', 'bg-info-soft text-primary'], 'start_work' => ['working', 'bg-primary text-white'], 'start_break' => ['onBreak', 'bg-warning-soft text-warning'], 'end_break' => ['working', 'bg-primary text-white'], 'start_private_leave' => ['privateLeave', 'bg-warning-soft text-warning'], 'end_private_leave' => ['working', 'bg-primary text-white'], 'final_check_out' => ['finished', 'bg-success-soft text-success']]; @endphp
    @foreach ($events as $e)
  1. @unless ($loop->last)@endunless

    {{ __('attendance.actions.'.$e->type->langKey()) }}

    @include('livewire._manual-event-details', ['event' => $e])
    @if (isset($after[$e->type->value])){{ __('workStatus.'.$after[$e->type->value][0]) }}@endif @if ($e->location){{ __('attendance.record.gps', ['meters' => round($e->location->accuracy_meters)]) }}@endif
  2. @endforeach
@else
    @foreach ($events as $e)
  1. {{ __('attendance.actions.'.$e->type->langKey()) }}@include('livewire._manual-event-details', ['event' => $e]) @if ($e->location){{ __('attendance.record.gps', ['meters' => round($e->location->accuracy_meters)]) }}@endif {{ $e->recorded_at->setTimezone($tz)->format('H:i:s') }}
  2. @endforeach
@endif
@endif @if ($explaining && $pending)
@endif