events->getById($eventId); return new InertiaProvider('Event/Details', ['event' => $event])->render(); } public function summary(int $eventId) : JsonResponse { $event = $this->events->getById($eventId); return response()->json(['event' => new EventResource($event)->toArray()]); } 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' => Amount::fromString($request->input('pft_1_amount')) ]; $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' => Amount::fromString($request->input('pft_2_amount')) ]; } 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' => Amount::fromString($request->input('pft_3_amount')) ]; } 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' => Amount::fromString($request->input('pft_4_amount')) ]; } $participationFeeCommand = new SetParticipationFeesCommand($participationFeeRequest); $response = $participationFeeCommand->excetute(); return response()->json(['status' => $response->success ? 'success' : 'error']); } }