Attendance Reports

{{-- Period + date filters --}}
@foreach(['day' => 'Day', 'week' => 'Week', 'month' => 'Month'] as $val => $label) @endforeach
@if($period === 'day') @elseif($period === 'week') to @else @endif
{{-- KPI cards --}}
@php $kpis = [ ['Total Visits', $summary['total_visits'] ?? 0, 'text-orange-500'], ['Avg / Day', number_format($summary['avg_per_day'] ?? 0, 1), 'text-blue-500'], ['Avg Duration', ($summary['avg_duration_min'] ?? 0) . ' min', 'text-green-600'], ['Unique Members', $summary['unique_members'] ?? 0, 'text-purple-500'], ['Denied', $summary['denied_count'] ?? 0, 'text-red-500'], ]; @endphp @foreach($kpis as [$label, $value, $color])

{{ $value }}

{{ $label }}

@endforeach
{{-- Daily bar chart --}}

Daily Visits

@php $maxVisits = collect($daily_data)->max('count') ?: 1; @endphp @if(count($daily_data))
@foreach($daily_data as $day) @php $barPct = round(($day['count'] / $maxVisits) * 100); @endphp
{{ $day['count'] }}
@endforeach
@foreach($daily_data as $day)
{{ $day['short_label'] ?? substr($day['label'] ?? '', 0, 3) }}
@endforeach
@else
No data for this period.
@endif
{{-- Top members --}}

Top Members

@forelse($top_members as $i => $m)
{{ $i + 1 }}

{{ $m['name'] }}

{{ $m['member_code'] ?? '' }}

{{ $m['visits'] }}
@empty

No visits in period.

@endforelse
{{-- Hourly heatmap --}} @if(!empty($hourly_data))

Hourly Heatmap

@php $maxHour = collect($hourly_data)->max() ?: 1; @endphp
@foreach($hourly_data as $hour => $count) @php $intensity = $count / $maxHour; @endphp
@endforeach
@foreach(range(0, 23, 6) as $h) {{ sprintf('%02d', $h) }}:00 @endforeach 23:00
@endif