@php
$cards = [
['icon' => 'ti-login-2', 'color' => 'purple', 'value' => $summary['checkIn'] ?? '—', 'label' => 'Check In'],
['icon' => 'ti-logout-2', 'color' => 'red', 'value' => $summary['checkOut'] ?? '—', 'label' => 'Check Out'],
['icon' => 'ti-clock-play', 'color' => 'green', 'value' => $fmtDur($summary['activeSec']), 'label' => 'Active Time'],
['icon' => 'ti-clock-pause', 'color' => 'gray', 'value' => $fmtDur($summary['idleSec']), 'label' => 'Idle / Breaks'],
['icon' => 'ti-photo', 'color' => 'blue', 'value' => $summary['shots'], 'label' => 'Screenshots'],
];
// Only when something was actually measured. A day recorded before
// 1.15.0 has no input figure at all, and showing "0%" there would
// assert the employee sat still when the truth is nobody looked.
if (($summary['inputPercent'] ?? null) !== null) {
$cards[] = [
'icon' => 'ti-activity', 'color' => 'azure',
'value' => $summary['inputPercent'] . '%', 'label' => 'Avg. Input Activity',
];
}
@endphp
@foreach ($cards as $card)
{{ $card['value'] }}
{{ $card['label'] }}
@endforeach
@if ($capped)
Showing the first 1000 screenshots of this day.
@endif
@php
/**
* The 5-minute window a capture belongs to — "07:30 – 07:35" rather than
* "07:33:31". The agent takes one shot per 5-minute window at a random
* offset inside it, so the exact second is an artefact of that jitter and
* reads as false precision. Two shots in one window share a label, which
* is correct: they are from the same window.
*/
$slot = function ($at) use ($tz) {
if (! $at) return '—';
$t = $at->copy()->tz($tz);
$from = $t->copy()->setTime($t->hour, intdiv($t->minute, 5) * 5, 0);
return $from->format('H:i') . ' – ' . $from->copy()->addMinutes(5)->format('H:i');
};
/**
* Every capture on the page, in the order it is rendered — the index
* the lightbox carousel steps through, so one modal serves the whole
* day rather than a modal per thumbnail.
*/
$ordered = $groupBy === 'task'
? $byGroup->flatMap(fn ($g) => $g)->values()
: $segments->flatMap(fn ($seg) => $seg['shots'])->values();
$slideOf = [];
foreach ($ordered as $i => $o) { $slideOf[$o->id] = $i; }
$dur = fn ($from, $to) => \App\Support\Duration::compact((int) $from->diffInSeconds($to));
@endphp
{{-- ── Screenshots: a timeline in hour mode, plain cards by task ────── --}}
@if ($groupBy !== 'task')
@forelse ($segments as $seg)
@if ($loop->first)