@extends('layouts.app') @section('content')

Gestionare Prezență

@if(session('success')) @endif @if(session('error')) @endif
Săptămâna {{ $weekdays[0]['date']->format('d.m') }} - {{ $weekdays[4]['date']->format('d.m.Y') }}
{{ $weekdays[array_search($selectedDate, array_column($weekdays, 'formatted'))]['day_name_ro'] }}, {{ $date->format('d.m.Y') }}

Data selectată pentru gestionarea prezenței

{{ $children->count() }}
Copii înregistrați
{{ $attendances->where('is_present', true)->count() }}
Prezenți
{{ $attendances->where('is_present', false)->count() }}
Absenți
@if($children->count() > 0)
@csrf
@foreach($children as $child) @php $attendance = $attendances->get($child->id); $isPresent = $attendance ? $attendance->is_present : false; $absenceReason = $attendance ? $attendance->absence_reason : ''; $includeInMeal = $attendance ? $attendance->include_in_meal : true; @endphp
{{ $child->full_name }}

{{ $child->group->name ?? 'Fără grup' }}

@if($child->allergies && count($child->allergies) > 0)
Alergii: {{ implode(', ', $child->allergies) }}
@endif
@endforeach
@else

Nu există copii înregistrați

Nu aveți copii aprobați pentru a gestiona prezența.

@endif @if($children->count() > 0)
Prezentă Săptămâna Curentă
@foreach($weekdays as $day) @endforeach @foreach($children as $child) @php $totalPresent = 0; @endphp @foreach($weekdays as $day) @php $dayAttendance = $weekAttendances->get($day['formatted'], collect())->where('child_id', $child->id)->first(); $isPresent = $dayAttendance ? $dayAttendance->is_present : null; if ($isPresent === true) $totalPresent++; @endphp @endforeach @endforeach
Copil Grupă
{{ $day['day_name_ro'] }} {{ $day['display'] }}
Total Prezențe
{{ substr($child->first_name, 0, 1) }}{{ substr($child->last_name, 0, 1) }}
{{ $child->full_name }} @if($child->allergies && count($child->allergies) > 0)
Alergii: {{ implode(', ', $child->allergies) }} @endif
{{ $child->group->name ?? 'N/A' }} @if($isPresent === true) Prezent @elseif($isPresent === false) Absent @if($dayAttendance && $dayAttendance->absence_reason)
{{ $dayAttendance->absence_reason }} @endif @else N/A @endif
{{ $totalPresent }}/5
@endif
@endsection