diff --git a/.ai/mcp/mcp.json b/.ai/mcp/mcp.json new file mode 100644 index 0000000..e69de29 diff --git a/app/Providers/PdfGenerateAndDownloadProvider.php b/app/Providers/PdfGenerateAndDownloadProvider.php new file mode 100644 index 0000000..5501df4 --- /dev/null +++ b/app/Providers/PdfGenerateAndDownloadProvider.php @@ -0,0 +1,17 @@ +loadHtml($html, 'UTF-8'); + $dompdf->setPaper('A4', $orientation); + $dompdf->render(); + + return $dompdf->output(); + } +} diff --git a/app/Repositories/EventParticipantRepository.php b/app/Repositories/EventParticipantRepository.php new file mode 100644 index 0000000..29cff4c --- /dev/null +++ b/app/Repositories/EventParticipantRepository.php @@ -0,0 +1,97 @@ +participants()->orderBy('lastname')->orderBy('firstname')->get() as $participant) { + $participants[] = $participant->toResource()->toArray($request); + }; + + return $participants; + } + + public function getParticipantsWithIntolerances(Event $event, Request $request) : array { + $participants = []; + foreach ($event->participants()->whereNotNull('intolerances')->whereNot('intolerances' , '=', '')->get() as $participant) { + $participants[] = $participant->toResource()->toArray($request); + }; + + return $participants; + } + + public function getKitchenOverview(Event $event) : array { + $data = []; + $participants = $event->participants()->get(); + + + for ($cur_date = $event->start_date; $cur_date <= $event->end_date; $cur_date->modify('+1 day')) { + $dateKey = $cur_date->format('d.m.Y'); + + $data[$dateKey] = [ + '1' => [], + '2' => [], + '3' => [], + ]; + + foreach (EatingHabit::all() as $eatingHabit) { + $data[$dateKey]['1'][$eatingHabit->slug] = 0; + $data[$dateKey]['2'][$eatingHabit->slug] = 0; + $data[$dateKey]['3'][$eatingHabit->slug] = 0; + } + + foreach ($participants as $participant) { + $eatingHabitSlug = $participant->eating_habit; + if ($eatingHabitSlug === null) { + continue; + } + + $anreise = $participant->arrival_date; + $abreise = $participant->departure_date; + + if ($anreise->getTimestamp() === $cur_date->getTimestamp()) { + switch ((int)$participant->arrival_eating) { + case 1: + $data[$dateKey]['3'][$eatingHabitSlug]++; + break; + case 2: + $data[$dateKey]['2'][$eatingHabitSlug]++; + $data[$dateKey]['3'][$eatingHabitSlug]++; + break; + case 3: + $data[$dateKey]['1'][$eatingHabitSlug]++; + $data[$dateKey]['2'][$eatingHabitSlug]++; + $data[$dateKey]['3'][$eatingHabitSlug]++; + break; + } + } elseif ($abreise->getTimestamp() === $cur_date->getTimestamp()) { + switch ((int)$participant->departure_eating) { + case 1: + $data[$dateKey]['1'][$eatingHabitSlug]++; + break; + case 2: + $data[$dateKey]['1'][$eatingHabitSlug]++; + $data[$dateKey]['2'][$eatingHabitSlug]++; + break; + case 3: + $data[$dateKey]['1'][$eatingHabitSlug]++; + $data[$dateKey]['2'][$eatingHabitSlug]++; + $data[$dateKey]['3'][$eatingHabitSlug]++; + break; + } + } else { + $data[$dateKey]['1'][$eatingHabitSlug]++; + $data[$dateKey]['2'][$eatingHabitSlug]++; + $data[$dateKey]['3'][$eatingHabitSlug]++; + } + } + } + + return $data; + } +} diff --git a/resources/views/pdfs/amount-list.blade.php b/resources/views/pdfs/amount-list.blade.php new file mode 100644 index 0000000..66f4d72 --- /dev/null +++ b/resources/views/pdfs/amount-list.blade.php @@ -0,0 +1,79 @@ + + + + + + + + @php + $rows = $rows ?? []; + $chunks = array_chunk($rows, 8); + @endphp + + @foreach($chunks as $chunk) +

Beitrags-Liste {{$event}}

+ + + + + + + + + + + + + @foreach($chunk as $index => $row) + + + + + + + + + + @endforeach + +
Name, AlterStammTeilnahmegruppeAnreise
Abreise
BeitragAnmerkungen
{{ $row['lastname']}},
{{ $row['firstname'] }}
{{$row['age'] ?? ''}} Jahre
{{ $row['localgroup'] ?? '' }}{{ $row['participationType'] ?? '' }}{{ $row['arrival'] ?? '' }}
{{$row['departure']}}
{{$row['presenceDays']['real']}} Tage
{{ $row['amountPaid']['readable'] ?? '' }} / {{ $row['amountExpected']['readable'] ?? '' }}{{ $row['notes'] ?? '' }}
+ + @if(! $loop->last) + @endif + @endforeach + + diff --git a/resources/views/pdfs/first-aid-list.blade.php b/resources/views/pdfs/first-aid-list.blade.php new file mode 100644 index 0000000..13d4100 --- /dev/null +++ b/resources/views/pdfs/first-aid-list.blade.php @@ -0,0 +1,87 @@ + + + + + + + + @php + $rows = $rows ?? []; + $chunks = array_chunk($rows, 8); + @endphp + + @foreach($chunks as $chunk) +

Erste-Hilfe-Liste {{$event}}

+ + + + + + + + + + + + + + + @foreach($chunk as $index => $row) + + + + + + + + + + + @endforeach + +
Name, AlterStammBade-ErlaubnisAllergien /
Unvertr.
MedikamenteNotfallkontaktErw. Erste Hilfe/
Tetanus-Vac.
Anmerkungen
{{ $row['lastname']}},
{{ $row['firstname'] }}
{{$row['age'] ?? ''}} Jahre
{{ $row['localgroup'] ?? '' }}{{ $row['swimmingPermission'] ?? '' }}{{ $row['allergies'] ?? '' }}
{{$row['intolerances']}}
{{ $row['medications'] ?? '' }} + {{ $row['contact_person'] ?? 'P: ' . $row['firstname'] . ' ' . $row['lastname']}}
+ {{ $row['phone_2'] ?? '---' }}
+ {{ $row['phone_1'] ?? '---' }} + +
{{ $row['extendedFirstAid'] ?? '' }}
T: {{$row['tetanusVaccination'] ?? 'Unbekannt'}}
{{ $row['notes'] ?? '' }}
+ + @if(! $loop->last) + @endif + @endforeach + + diff --git a/resources/views/pdfs/kitchen-list.blade.php b/resources/views/pdfs/kitchen-list.blade.php new file mode 100644 index 0000000..3b3bd81 --- /dev/null +++ b/resources/views/pdfs/kitchen-list.blade.php @@ -0,0 +1,128 @@ + + + + + + + +@php + use App\Enumerations\EatingHabit;$rows = $rows ?? []; + $chunks = array_chunk($rows, 8); + $eventStart = \Carbon\Carbon::parse($eventStart); + $eventEnd = \Carbon\Carbon::parse($eventEnd); + $days = \Carbon\CarbonPeriod::create($eventStart->startOfDay(), $eventEnd->startOfDay()); +@endphp + +

Küchenübersicht {{$event}}

+ + + + + + + + + + + + + + + + + + + + + + @foreach($days as $day) + + + + + + + + + + + + + @endforeach + +
DatumFrühstückMittagAbendessen
veganvegetarischomnivorveganvegetarischomnivorveganvegetarischomnivor
{{ $day->format('d.m.Y') }}{{ $kitchenRequirements[$day->format('d.m.Y')]['1'][EatingHabit::EATING_HABIT_VEGAN] }}{{ $kitchenRequirements[$day->format('d.m.Y')]['1'][EatingHabit::EATING_HABIT_VEGETARIAN] }}{{ $kitchenRequirements[$day->format('d.m.Y')]['1'][EatingHabit::EATING_HABIT_OMNIVOR] }}{{ $kitchenRequirements[$day->format('d.m.Y')]['2'][EatingHabit::EATING_HABIT_VEGAN] }}{{ $kitchenRequirements[$day->format('d.m.Y')]['2'][EatingHabit::EATING_HABIT_VEGETARIAN] }}{{ $kitchenRequirements[$day->format('d.m.Y')]['2'][EatingHabit::EATING_HABIT_OMNIVOR] }}{{ $kitchenRequirements[$day->format('d.m.Y')]['3'][EatingHabit::EATING_HABIT_VEGAN] }}{{ $kitchenRequirements[$day->format('d.m.Y')]['3'][EatingHabit::EATING_HABIT_VEGETARIAN] }}{{ $kitchenRequirements[$day->format('d.m.Y')]['3'][EatingHabit::EATING_HABIT_OMNIVOR] }}
+
+ + +@php + $rows = $participantsForKitchenList ?? []; + $chunks = array_chunk($rows, 8); +@endphp + +@foreach($chunks as $chunk) +

Teilnehmende mit bekannten Unverträglichkeiten

+ + + + + + + + + + + + + @foreach($chunk as $index => $row) + + + + + + + + + + @endforeach + +
Name, AlterStammTeilnahmegruppeAnreise
Abreise
UnverträglichkeitenAnmerkungen
{{ $row['lastname']}},
{{ $row['firstname'] }}
{{$row['age'] ?? ''}} Jahre
{{ $row['localgroup'] ?? '' }}{{ $row['participationType'] ?? '' }}{{ $row['arrival'] ?? '' }}
{{$row['departure']}}
{{$row['presenceDays']['real']}} Tage
{{ $row['intolerances'] }}{{ $row['notes'] ?? '' }}
+ + @if(! $loop->last) + @endif +@endforeach + +