diff --git a/app/Domains/Event/Actions/SignUp/SignUpCommand.php b/app/Domains/Event/Actions/SignUp/SignUpCommand.php index 7fafb53..c454281 100644 --- a/app/Domains/Event/Actions/SignUp/SignUpCommand.php +++ b/app/Domains/Event/Actions/SignUp/SignUpCommand.php @@ -2,6 +2,7 @@ namespace App\Domains\Event\Actions\SignUp; +use App\Enumerations\EatingHabit; use App\Enumerations\EfzStatus; use App\ValueObjects\Age; use Illuminate\Support\Str; @@ -13,8 +14,13 @@ class SignUpCommand { public function execute() : SignUpResponse { $response = new SignUpResponse(); - $participantAge = new Age($this->request->birthday); + $eatingHabit = match ($this->request->eating_habit) { + 'vegan' => EatingHabit::EATING_HABIT_VEGAN, + 'vegetarian' => EatingHabit::EATING_HABIT_VEGETARIAN, + default => EatingHabit::EATING_HABIT_OMNIVOR, + }; + $participantAge = new Age($this->request->birthday); $response->participant = $this->request->event->participants()->create( [ 'tenant' => $this->request->event->tenant, @@ -39,7 +45,7 @@ class SignUpCommand { 'intolerances' => $this->request->intolerances, 'medications' => $this->request->medications, 'tetanus_vaccination' => $this->request->tetanus_vaccination, - 'eating_habit' => $this->request->eating_habit, + 'eating_habit' => $eatingHabit, 'swimming_permission' => $participantAge->isfullAged() ? 'SWIMMING_PERMISSION_ALLOWED' : $this->request->swimming_permission, 'first_aid_permission' => $participantAge->isfullAged() ? 'FIRST_AID_PERMISSION_ALLOWED' : $this->request->first_aid_permission, 'foto_socialmedia' => $this->request->foto_socialmedia, diff --git a/app/Domains/Event/Controllers/DetailsController.php b/app/Domains/Event/Controllers/DetailsController.php index 511fc84..a670839 100644 --- a/app/Domains/Event/Controllers/DetailsController.php +++ b/app/Domains/Event/Controllers/DetailsController.php @@ -10,12 +10,15 @@ use App\Domains\Event\Actions\UpdateManagers\UpdateManagersCommand; use App\Domains\Event\Actions\UpdateManagers\UpdateManagersRequest; use App\Enumerations\ParticipationFeeType; use App\Enumerations\ParticipationType; +use App\Models\EventParticipant; use App\Providers\InertiaProvider; +use App\Providers\PdfGenerateAndDownloadProvider; use App\Resources\EventResource; use App\Scopes\CommonController; use App\ValueObjects\Amount; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Illuminate\Http\Response; class DetailsController extends CommonController { public function __invoke(int $eventId) { @@ -123,4 +126,31 @@ class DetailsController extends CommonController { return response()->json(['status' => $response->success ? 'success' : 'error']); } + + public function downloadPdfList(string $eventId, string $listType, Request $request): Response + { + $event = $this->events->getByIdentifier($eventId); + + $participants = $this->eventParticipants->getForList($event, $request); + $kitchenOverview = $this->eventParticipants->getKitchenOverview($event); + + $html = view('pdfs.' . $listType, [ + 'event' => $event->name, + 'eventStart' => $event->start_date, + 'eventEnd' => $event->end_date, + 'rows' => $participants, + 'kitchenRequirements' => $kitchenOverview, + 'participantsForKitchenList' => $this->eventParticipants->getParticipantsWithIntolerances($event, $request), + ])->render(); + + $pdf = PdfGenerateAndDownloadProvider::fromHtml( + $html, + 'landscape' + ); + + return response($pdf, 200, [ + 'Content-Type' => 'application/pdf', + 'Content-Disposition' => 'attachment; filename="' . $listType .'.pdf"', + ]); + } } diff --git a/app/Domains/Event/Controllers/SignupController.php b/app/Domains/Event/Controllers/SignupController.php index be1656e..568d454 100644 --- a/app/Domains/Event/Controllers/SignupController.php +++ b/app/Domains/Event/Controllers/SignupController.php @@ -81,10 +81,10 @@ class SignupController extends CommonController { $registrationData['nachname'], $registrationData['email_1'], DateTime::createFromFormat('Y-m-d', $registrationData['geburtsdatum'])); - +/* if ($doubleCheckEventRegistrationProvider->isRegistered()) { return response()->json(['status' => 'exists']); - } + }*/ $amount = $eventResource->calculateAmount( $registrationData['participationType'], diff --git a/app/Domains/Event/Routes/web.php b/app/Domains/Event/Routes/web.php index bb362ca..d0817fe 100644 --- a/app/Domains/Event/Routes/web.php +++ b/app/Domains/Event/Routes/web.php @@ -18,6 +18,7 @@ Route::middleware(IdentifyTenant::class)->group(function () { Route::middleware(['auth'])->group(function () { Route::get('/new', CreateController::class); Route::get('/details/{eventId}', DetailsController::class); + Route::get('/details/{eventId}/pdf/{listType}', [DetailsController::class, 'downloadPdfList']); }); }); }); diff --git a/app/Domains/Event/Views/Partials/CommonSettings.vue b/app/Domains/Event/Views/Partials/CommonSettings.vue index 1daa84b..738a2fa 100644 --- a/app/Domains/Event/Views/Partials/CommonSettings.vue +++ b/app/Domains/Event/Views/Partials/CommonSettings.vue @@ -36,7 +36,7 @@ sendWeeklyReports: props.event.sendWeeklyReports, registrationAllowed: props.event.registrationAllowed, flatSupport: props.event.flatSupportEdit, - supportPerson: props.event.supportPersonEdit, + supportPerson: props.event.supportPersonIndex, }) onMounted(async () => { diff --git a/app/Domains/Event/Views/Partials/Overview.vue b/app/Domains/Event/Views/Partials/Overview.vue index efbb076..78cb44e 100644 --- a/app/Domains/Event/Views/Partials/Overview.vue +++ b/app/Domains/Event/Views/Partials/Overview.vue @@ -60,11 +60,20 @@ import {onMounted, reactive, ref} from "vue";
| Teili | -{{props.event.participants.participant.count}} Personen: | +{{props.event.participants.participant.count}} Personen: | {{props.event.participants.participant.amount.paid.readable}} / | @@ -28,7 +28,7 @@||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Team | -{{props.event.participants.team.count}} Personen: | +{{props.event.participants.team.count}} Personen: | {{props.event.participants.team.amount.paid.readable}} / | @@ -39,7 +39,7 @@||||||||
| Unterstützende | -{{props.event.participants.volunteer.count}} Personen: | +{{props.event.participants.volunteer.count}} Personen: | {{props.event.participants.volunteer.amount.paid.readable}} / | @@ -50,7 +50,7 @@||||||||
| Sonstige | -{{props.event.participants.other.count}} Personen: | +{{props.event.participants.other.count}} Personen: | {{props.event.participants.other.amount.paid.readable}} / | @@ -91,7 +91,7 @@ {{ props.event.totalBalance.real.readable }} /- {{props.event.totalBalance.expected.readable}} + {{props.event.totalBalance.real.readable}} |
@@ -107,14 +107,14 @@
Ausgaben-
Mich selbst anmelden-Ich bin {{ event.alcoholicsAge }} Jahre oder älter. +Ich bin 18 Jahre oder älter. |