events->getById($eventId); return new InertiaProvider('Event/Details', ['event' => $event])->render(); } public function summary(int $eventId, Request $request) : JsonResponse { $event = $this->events->getById($eventId); return response()->json(['event' => $event->toResource()->toArray($request)]); } public function updateCommonSettings(int $eventId, Request $request) : JsonResponse { $event = $this->events->getById($eventId); $earlyBirdEnd = \DateTime::createFromFormat('Y-m-d', $request->input('earlyBirdEnd')); $registrationFinalEnd = \DateTime::createFromFormat('Y-m-d', $request->input('registrationFinalEnd')); $flatSupport = Amount::fromString($request->input('flatSupport')); $supportPerPerson = Amount::fromString($request->input('supportPerson')); $contributinLocalGroups = $request->input('contributingLocalGroups'); $eatingHabits = $request->input('eatingHabits'); $eventUpdateRequest = new UpdateEventRequest( $event, $request->input('eventName'), $request->input('eventLocation'), $request->input('postalCode'), $request->input('email'), $earlyBirdEnd, $registrationFinalEnd, $request->input('alcoholicsAge'), $request->input('sendWeeklyReports'), $request->input('registrationAllowed'), $flatSupport, $supportPerPerson, $contributinLocalGroups, $eatingHabits ); $eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest); $response = $eventUpdateCommand->execute(); return response()->json(['status' => $response->success ? 'success' : 'error']); } public function updateEventManagers(int $eventId, Request $request) : JsonResponse { $event = $this->events->getById($eventId); $updateEventManagersRequest = new UpdateManagersRequest($event, $request->input('selectedManagers')); $updateEventManagersCommand = new UpdateManagersCommand($updateEventManagersRequest); $response = $updateEventManagersCommand->execute(); return response()->json(['status' => $response->success ? 'success' : 'error']); } public function updateParticipationFees(int $eventId, Request $request) : JsonResponse { $event = $this->events->getById($eventId); $participationFeeFirst = [ 'type' => ParticipationType::PARTICIPATION_TYPE_PARTICIPANT, 'name' => 'Teilnehmer', 'description' => $request->input('pft_1_description'), 'amount_standard' => Amount::fromString($request->input('pft_1_amount_standard')), 'amount_reduced' => null !== $request->input('pft_1_amount_reduced') ? Amount::fromString($request->input('pft_1_amount_reduced')) : null, 'amount_solidarity' => null !== $request->input('pft_1_amount_solidarity') ? Amount::fromString($request->input('pft_1_amount_solidarity')) : null ]; $participationFeeRequest = new SetParticipationFeesRequest($event, $participationFeeFirst); if ($request->input('pft_2_active')) { $participationFeeRequest->participationFeeSecond = [ 'type' => ParticipationType::PARTICIPATION_TYPE_TEAM, 'name' => $event->participation_fee_type === ParticipationFeeType::PARTICIPATION_FEE_TYPE_FIXED ? 'Kernteam' : 'Solidaritätsbeitrag', 'description' => $request->input('pft_2_description'), 'amount_standard' => Amount::fromString($request->input('pft_2_amount_standard')), 'amount_reduced' => null !== $request->input('pft_2_amount_reduced') ? Amount::fromString($request->input('pft_2_amount_reduced')) : null, 'amount_solidarity' => null !== $request->input('pft_2_amount_solidarity') ? Amount::fromString($request->input('pft_2_amount_solidarity')) : null ]; } if ($request->input('pft_3_active')) { $participationFeeRequest->participationFeeThird = [ 'type' => ParticipationType::PARTICIPATION_TYPE_VOLUNTEER, 'name' => $event->participation_fee_type === ParticipationFeeType::PARTICIPATION_FEE_TYPE_FIXED ? 'Unterstützende' : 'Reduzierter Beitrag', 'description' => $event->participation_fee_type !== ParticipationFeeType::PARTICIPATION_FEE_TYPE_SOLIDARITY ? $request->input('pft_3_description') : 'Nach Verfügbarkeit', 'amount_standard' => Amount::fromString($request->input('pft_3_amount_standard')), 'amount_reduced' => null !== $request->input('pft_3_amount_reduced') ? Amount::fromString($request->input('pft_3_amount_reduced')) : null, 'amount_solidarity' => null !== $request->input('pft_3_amount_solidarity') ? Amount::fromString($request->input('pft_3_amount_solidarity')) : null ]; } if ($request->input('pft_4_active') && $event->participation_fee_type === ParticipationFeeType::PARTICIPATION_FEE_TYPE_FIXED) { $participationFeeRequest->participationFeeFourth = [ 'type' => ParticipationType::PARTICIPATION_TYPE_OTHER, 'name' => 'Sonstige', 'description' => $request->input('pft_4_description'), 'amount_standard' => Amount::fromString($request->input('pft_4_amount_standard')), 'amount_reduced' => null !== $request->input('pft_4_amount_reduced') ? Amount::fromString($request->input('pft_4_amount_reduced')) : null, 'amount_solidarity' => null !== $request->input('pft_4_amount_solidarity') ? Amount::fromString($request->input('pft_4_amount_solidarity')) : null ]; } $participationFeeCommand = new SetParticipationFeesCommand($participationFeeRequest); $response = $participationFeeCommand->execute(); 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"', ]); } public function downloadCsvList(string $eventId, string $listType, Request $request): Response { $event = $this->events->getByIdentifier($eventId); $participants = $this->eventParticipants->getForList($event, $request); $kitchenOverview = $this->eventParticipants->getKitchenOverview($event); $csv = view('csvs.' . $listType, [ 'event' => $event->name, 'rows' => $participants, ])->render(); return response($csv, 200, [ 'Content-Type' => 'text/csv; charset=UTF-8', 'Content-Disposition' => 'attachment; filename="' . $listType . '.csv"', ]); } }