@php use App\Domain\Time\BusinessCalendar; use App\Support\Format; $kpis = [ ['scheduled', $kpi['scheduled']], ['working', $kpi['working']], ['traveling', $kpi['traveling']], ['onBreak', $kpi['onBreak']], ['privateLeave', $kpi['privateLeave']], ['finished', $kpi['finished']], ['late', $kpi['late']], ['missing', $kpi['missing']], ]; $kindLabel = ['TRAVEL' => 'travel', 'WORK' => 'work', 'BREAK' => 'break', 'PRIVATE_LEAVE' => 'privateLeave']; @endphp
@unless ($isToday)@endunless
@foreach ($kpis as [$key, $value])

{{ __('attendanceMgmt.kpi.'.$key) }}

{{ $value }}

@switch($key) @case('scheduled'){{ __('attendanceMgmt.kpi.scheduledCaption', ['total' => $rows->count()]) }}@break @case('late'){{ __('attendanceMgmt.kpi.lateCaption', ['minutes' => $threshold]) }}@break @default{{ __('attendanceMgmt.kpi.'.$key.'Caption') }} @endswitch

@endforeach

{{ __('attendanceMgmt.dataNote') }}

{{ __('attendanceMgmt.table.title') }}

{{ __('attendanceMgmt.table.subtitle', ['date' => BusinessCalendar::formatKey($dateKey), 'timezone' => $timezone]) }}

@if ($rows->isEmpty())

{{ __('attendanceMgmt.empty.noWorkers') }}

{{ __('attendanceMgmt.empty.noWorkersHint') }}

@else
@foreach ($rows as $r) $detail && $detail['name'] === $r['name']])> @endforeach
{{ __('attendanceMgmt.table.worker') }} {{ __('attendanceMgmt.table.shift') }} {{ __('attendanceMgmt.table.firstTravel') }} {{ __('attendanceMgmt.table.workStart') }} {{ __('attendanceMgmt.table.break') }} {{ __('attendanceMgmt.table.checkOut') }} {{ __('attendanceMgmt.table.work') }} {{ __('attendanceMgmt.table.status') }} {{ __('attendanceMgmt.table.details') }}
{{ $r['name'] }} {{ $r['planned'] ?? __('attendanceMgmt.table.noSchedule') }} {{ $r['travel'] ?? '—' }} {{ $r['start'] ?? '—' }} {{ $r['breaks'] ?: '—' }} {{ $r['end'] ?? '—' }} {{ $r['workMinutes'] === null ? '—' : Format::minutes($r['workMinutes']) }} {{ $r['hasRecord'] ? __('workStatus.'.$r['state']->langKey()) : __('workStatus.noRecord') }} @if ($r['lateMinutes']){{ __('attendanceMgmt.flags.late', ['minutes' => $r['lateMinutes']]) }}@endif @if ($r['explanationPending']){{ __('attendanceMgmt.flags.explanationPending') }}@endif @if ($r['missing']){{ __('attendanceMgmt.flags.missing') }}@endif @if ($r['abandoned']){{ __('attendanceMgmt.flags.incomplete') }}@endif
@endif
@if ($detail) @php($s = $detail['summary'])

{{ __('attendanceMgmt.drawer.title') }} · {{ $detail['name'] }}

{{ BusinessCalendar::formatKey($dateKey) }} · {{ $timezone }}

{{ __('attendanceMgmt.drawer.planned') }}: {{ $detail['planned'] ? $detail['planned']->startTime.'–'.$detail['planned']->endTime : __('attendanceMgmt.drawer.noSchedule') }}

@if (! $s)

{{ __('workStatus.noRecord') }}

@else

{{ __('attendanceMgmt.drawer.durations') }}

@foreach ([['work', $s['workMs']], ['travel', $s['travelMs']], ['break', $s['breakMs']], ['privateLeave', $s['privateLeaveMs']], ['elapsed', $s['elapsedMs']]] as [$k, $ms])
{{ __('attendanceMgmt.drawer.d.'.$k) }}
{{ $ms === null ? __('attendanceMgmt.drawer.unknown') : Format::minutes(intdiv($ms, 60000)) }}
@endforeach

{{ __('attendanceMgmt.drawer.durationsNote') }}

@include('livewire._journey-report',['journeySummary'=>$s,'journeyTimezone'=>$timezone,'journeySite'=>$detail['session']->events->first()?->metadata['worksite']['name']??null]) @php($warnings = $s['warnings']) @if ($detail['noSchedule'])@php($warnings[] = 'NO_SCHEDULE')@endif @if ($s['incomplete'] || ! $s['finished'])@php($warnings[] = 'INCOMPLETE_SESSION')@endif @if ($detail['session']->explanation?->status === 'pending')@php($warnings[] = 'EXPLANATION_PENDING')@endif @php($lowAccuracy = $detail['session']->events->contains(fn ($e) => $e->location && $e->location->accuracy_meters > config('qw.attendance.low_accuracy_warning_meters'))) @if ($lowAccuracy)@php($warnings[] = 'LOW_GPS_ACCURACY')@endif @if (count($warnings))

{{ __('attendanceMgmt.drawer.quality') }}

@endif

{{ __('attendanceMgmt.drawer.timeline') }}

    @foreach ($detail['session']->events as $e)
  1. {{ $e->type->label('actions', $s['dualJourney']) }} @if ($e->location) {{ __('attendanceMgmt.drawer.gpsAccuracy', ['meters' => round($e->location->accuracy_meters)]) }}@if ($e->location->accuracy_meters > config('qw.attendance.low_accuracy_warning_meters')) · {{ __('attendanceMgmt.drawer.lowAccuracy') }}@endif @if ($detail['showCoordinates']){{ number_format($e->location->latitude, 5) }}, {{ number_format($e->location->longitude, 5) }}@endif @endif {{ $e->recorded_at->setTimezone($timezone)->format('H:i:s') }}
  2. @endforeach
@if (! $detail['showCoordinates'] && $detail['session']->events->contains(fn ($e) => $e->location))

{{ __('attendanceMgmt.drawer.coordinatesRestricted') }}

@endif @if ($detail['session']->explanation) @php($x = $detail['session']->explanation)

{{ __('attendanceMgmt.drawer.explanation') }}

{{ __('attendanceMgmt.drawer.minutesLate', ['minutes' => $x->minutes_late]) }} · {{ $x->status === 'pending' ? __('attendanceMgmt.drawer.explanationPending') : __('attendanceMgmt.drawer.explanationSubmitted') }}

{{-- Worker-written text is shown as entered and never translated. --}}

{{ $x->reason ?? __('attendanceMgmt.drawer.noReason') }}

@endif

{{ __('attendanceMgmt.drawer.gpsDisclaimer') }}

@endif
@endif