First Aid list, amount list and kitchen list PDF download implemented
This commit is contained in:
0
.ai/mcp/mcp.json
Normal file
0
.ai/mcp/mcp.json
Normal file
17
app/Providers/PdfGenerateAndDownloadProvider.php
Normal file
17
app/Providers/PdfGenerateAndDownloadProvider.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Dompdf\Dompdf;
|
||||
|
||||
class PdfGenerateAndDownloadProvider {
|
||||
public static function fromHtml(string $html, string $orientation = 'portrait'): string
|
||||
{
|
||||
$dompdf = new Dompdf();
|
||||
$dompdf->loadHtml($html, 'UTF-8');
|
||||
$dompdf->setPaper('A4', $orientation);
|
||||
$dompdf->render();
|
||||
|
||||
return $dompdf->output();
|
||||
}
|
||||
}
|
||||
97
app/Repositories/EventParticipantRepository.php
Normal file
97
app/Repositories/EventParticipantRepository.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Enumerations\EatingHabit;
|
||||
use App\Models\Event;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EventParticipantRepository {
|
||||
public function getForList(Event $event, Request $request) : array {
|
||||
$participants = [];
|
||||
foreach ($event->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;
|
||||
}
|
||||
}
|
||||
79
resources/views/pdfs/amount-list.blade.php
Normal file
79
resources/views/pdfs/amount-list.blade.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
@page {
|
||||
margin: 15mm 10mm;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: DejaVu Sans, sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 8mm;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #000;
|
||||
padding: 6px 8px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.page-break {
|
||||
page-break-after: always;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@php
|
||||
$rows = $rows ?? [];
|
||||
$chunks = array_chunk($rows, 8);
|
||||
@endphp
|
||||
|
||||
@foreach($chunks as $chunk)
|
||||
<h1>Beitrags-Liste {{$event}}</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 2cm;">Name, Alter</th>
|
||||
<th style="width: 2cm;">Stamm</th>
|
||||
<th style="width: 2.5cm;">Teilnahmegruppe</th>
|
||||
<th style="width: 3.5cm;">Anreise<br />Abreise</th>
|
||||
<th style="width: 3.5cm;">Beitrag</th>
|
||||
<th>Anmerkungen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($chunk as $index => $row)
|
||||
<tr>
|
||||
<td>{{ $row['lastname']}},<br />{{ $row['firstname'] }}<br /> {{$row['age'] ?? ''}} Jahre</td>
|
||||
<td>{{ $row['localgroup'] ?? '' }}</td>
|
||||
<td>{{ $row['participationType'] ?? '' }}</td>
|
||||
<td>{{ $row['arrival'] ?? '' }}<br />{{$row['departure']}}<br />{{$row['presenceDays']['real']}} Tage</td>
|
||||
<td>{{ $row['amountPaid']['readable'] ?? '' }} / {{ $row['amountExpected']['readable'] ?? '' }}</td>
|
||||
|
||||
<td>{{ $row['notes'] ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if(! $loop->last)
|
||||
@endif
|
||||
@endforeach
|
||||
</body>
|
||||
</html>
|
||||
87
resources/views/pdfs/first-aid-list.blade.php
Normal file
87
resources/views/pdfs/first-aid-list.blade.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
@page {
|
||||
margin: 15mm 10mm;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: DejaVu Sans, sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 8mm;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #000;
|
||||
padding: 6px 8px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.page-break {
|
||||
page-break-after: always;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@php
|
||||
$rows = $rows ?? [];
|
||||
$chunks = array_chunk($rows, 8);
|
||||
@endphp
|
||||
|
||||
@foreach($chunks as $chunk)
|
||||
<h1>Erste-Hilfe-Liste {{$event}}</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 2cm;">Name, Alter</th>
|
||||
<th style="width: 2cm;">Stamm</th>
|
||||
<th style="width: 2.5cm;">Bade-Erlaubnis</th>
|
||||
<th style="width: 3.5cm;">Allergien /<br />Unvertr.</th>
|
||||
<th style="width: 3.5cm;">Medikamente</th>
|
||||
<th style="width: 3.5cm;">Notfallkontakt</th>
|
||||
<th style="width: 3.5cm;">Erw. Erste Hilfe/<br />Tetanus-Vac.</th>
|
||||
<th>Anmerkungen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($chunk as $index => $row)
|
||||
<tr>
|
||||
<td>{{ $row['lastname']}},<br />{{ $row['firstname'] }}<br /> {{$row['age'] ?? ''}} Jahre</td>
|
||||
<td>{{ $row['localgroup'] ?? '' }}</td>
|
||||
<td>{{ $row['swimmingPermission'] ?? '' }}</td>
|
||||
<td>{{ $row['allergies'] ?? '' }}<br />{{$row['intolerances']}}</td>
|
||||
<td>{{ $row['medications'] ?? '' }}</td>
|
||||
<td>
|
||||
{{ $row['contact_person'] ?? 'P: ' . $row['firstname'] . ' ' . $row['lastname']}}<br />
|
||||
{{ $row['phone_2'] ?? '---' }}<br />
|
||||
{{ $row['phone_1'] ?? '---' }}
|
||||
|
||||
</td>
|
||||
<td>{{ $row['extendedFirstAid'] ?? '' }}<br />T: {{$row['tetanusVaccination'] ?? 'Unbekannt'}}</td>
|
||||
<td>{{ $row['notes'] ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if(! $loop->last)
|
||||
@endif
|
||||
@endforeach
|
||||
</body>
|
||||
</html>
|
||||
128
resources/views/pdfs/kitchen-list.blade.php
Normal file
128
resources/views/pdfs/kitchen-list.blade.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
@page {
|
||||
margin: 15mm 10mm;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: DejaVu Sans, sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 8mm;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #000;
|
||||
padding: 6px 8px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.page-break {
|
||||
page-break-after: always;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@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
|
||||
|
||||
<h1>Küchenübersicht {{$event}}</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" style="width: 2.5cm;">Datum</th>
|
||||
<th colspan="3">Frühstück</th>
|
||||
<th colspan="3">Mittag</th>
|
||||
<th colspan="3">Abendessen</th>
|
||||
</tr>
|
||||
<tr class="subheader">
|
||||
<th style="width: 2.2cm;">vegan</th>
|
||||
<th style="width: 2.2cm;">vegetarisch</th>
|
||||
<th style="width: 2.2cm;">omnivor</th>
|
||||
<th style="width: 2.2cm;">vegan</th>
|
||||
<th style="width: 2.2cm;">vegetarisch</th>
|
||||
<th style="width: 2.2cm;">omnivor</th>
|
||||
<th style="width: 2.2cm;">vegan</th>
|
||||
<th style="width: 2.2cm;">vegetarisch</th>
|
||||
<th style="width: 2.2cm;">omnivor</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($days as $day)
|
||||
<tr>
|
||||
<td>{{ $day->format('d.m.Y') }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['1'][EatingHabit::EATING_HABIT_VEGAN] }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['1'][EatingHabit::EATING_HABIT_VEGETARIAN] }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['1'][EatingHabit::EATING_HABIT_OMNIVOR] }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['2'][EatingHabit::EATING_HABIT_VEGAN] }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['2'][EatingHabit::EATING_HABIT_VEGETARIAN] }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['2'][EatingHabit::EATING_HABIT_OMNIVOR] }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['3'][EatingHabit::EATING_HABIT_VEGAN] }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['3'][EatingHabit::EATING_HABIT_VEGETARIAN] }}</td>
|
||||
<td style="text-align: center">{{ $kitchenRequirements[$day->format('d.m.Y')]['3'][EatingHabit::EATING_HABIT_OMNIVOR] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="page-break"></div>
|
||||
|
||||
|
||||
@php
|
||||
$rows = $participantsForKitchenList ?? [];
|
||||
$chunks = array_chunk($rows, 8);
|
||||
@endphp
|
||||
|
||||
@foreach($chunks as $chunk)
|
||||
<h1>Teilnehmende mit bekannten Unverträglichkeiten</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 2cm;">Name, Alter</th>
|
||||
<th style="width: 2cm;">Stamm</th>
|
||||
<th style="width: 2.5cm;">Teilnahmegruppe</th>
|
||||
<th style="width: 3.5cm;">Anreise<br/>Abreise</th>
|
||||
<th style="width: 3.5cm;">Unverträglichkeiten</th>
|
||||
<th>Anmerkungen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($chunk as $index => $row)
|
||||
<tr>
|
||||
<td>{{ $row['lastname']}},<br/>{{ $row['firstname'] }}<br/> {{$row['age'] ?? ''}} Jahre</td>
|
||||
<td>{{ $row['localgroup'] ?? '' }}</td>
|
||||
<td>{{ $row['participationType'] ?? '' }}</td>
|
||||
<td>{{ $row['arrival'] ?? '' }}<br/>{{$row['departure']}}<br/>{{$row['presenceDays']['real']}} Tage</td>
|
||||
<td>{{ $row['intolerances'] }}</td>
|
||||
|
||||
<td>{{ $row['notes'] ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if(! $loop->last)
|
||||
@endif
|
||||
@endforeach
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user