@extends('layouts.app') @section('title', 'Attendance Summary') @section('content') @php // Column totals across all sites. $colTotals = array_fill_keys($codes, 0); $grandStaff = 0; $grandTotal = 0; @endphp
Attendance Summary by Site
{{ \Carbon\Carbon::create($year, $month, 1)->format('F Y') }}
Mark Attendance
Codes: @foreach(\App\Models\Attendance::CODES as $code=>$label) {{ $code }} = {{ $label }} @endforeach
@foreach($codes as $code)@endforeach @forelse($sites as $site) @php $staff = (int) ($staffCounts[$site->id] ?? 0); $row = $matrix[$site->id] ?? []; $rowTotal = array_sum($row); $cov = $coverage[$site->id] ?? null; $marked = (int) ($cov->staff_marked ?? 0); $days = (int) ($cov->days_recorded ?? 0); $pct = $staff > 0 ? (int) round($marked / $staff * 100) : 0; $grandStaff += $staff; $grandTotal += $rowTotal; @endphp @foreach($codes as $code) @php $c = (int) ($row[$code] ?? 0); $colTotals[$code] += $c; @endphp @endforeach @empty @endforelse @if($sites->isNotEmpty()) @foreach($codes as $code)@endforeach @endif
Site / Project Staff Marked Days Coverage{{ $code }}Records
{{ $site->name }} {{ $staff }} {{ $marked ?: '–' }} {{ $days ?: '–' }}
{{ $pct }}%
@if($c > 0){{ $c }}@else@endif {{ $rowTotal ?: '–' }} Add
No sites with staff or attendance for this month.
Total {{ $grandStaff }} {{ $colTotals[$code] ?: '–' }}{{ $grandTotal ?: '–' }}
@endsection