diff --git a/app/Domains/Event/Actions/ManualCertificateOfConductionCheck/ManualCertificateOfConductionCheckCommand.php b/app/Domains/Event/Actions/ManualCertificateOfConductionCheck/ManualCertificateOfConductionCheckCommand.php new file mode 100644 index 0000000..09af199 --- /dev/null +++ b/app/Domains/Event/Actions/ManualCertificateOfConductionCheck/ManualCertificateOfConductionCheckCommand.php @@ -0,0 +1,21 @@ +request->participant->efz_status = EfzStatus::EFZ_STATUS_CHECKED_VALID; + $this->request->participant->save(); + $response->success = true; + return $response; + } +} diff --git a/app/Domains/Event/Actions/ManualCertificateOfConductionCheck/ManualCertificateOfConductionCheckRequest.php b/app/Domains/Event/Actions/ManualCertificateOfConductionCheck/ManualCertificateOfConductionCheckRequest.php new file mode 100644 index 0000000..2a37523 --- /dev/null +++ b/app/Domains/Event/Actions/ManualCertificateOfConductionCheck/ManualCertificateOfConductionCheckRequest.php @@ -0,0 +1,12 @@ +success = false; + } +} diff --git a/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentCommand.php b/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentCommand.php new file mode 100644 index 0000000..71a0861 --- /dev/null +++ b/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentCommand.php @@ -0,0 +1,19 @@ +request->participant->amount_paid = $this->request->amountPaid; + $this->request->participant->save(); + + $response->success = true; + + return $response; + } +} diff --git a/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentRequest.php b/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentRequest.php new file mode 100644 index 0000000..e2620e0 --- /dev/null +++ b/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentRequest.php @@ -0,0 +1,16 @@ +participant = $participant; + $this->amountPaid = $amountPaid; + } +} diff --git a/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentResponse.php b/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentResponse.php new file mode 100644 index 0000000..9edd641 --- /dev/null +++ b/app/Domains/Event/Actions/ParticipantPayment/ParticipantPaymentResponse.php @@ -0,0 +1,7 @@ + 'attachment; filename="' . $listType . '.csv"', ]); } + + public function listParticipants(string $eventId, string $listType, Request $request) : JsonResponse { + $event = $this->events->getByIdentifier($eventId); + switch ($listType) { + case 'by-local-group': + $participants = $this->eventParticipants->groupByLocalGroup($event, $request); + break; + case 'by-participation-group': + $participants = $this->eventParticipants->groupByParticipationType($event, $request); + break; + case 'signed-off': + break; + default: + $participants = ['Alle Teilnehmenden' => $this->eventParticipants->getForList($event, $request)]; + } + + return response()->json([ + 'participants' => $participants, + 'event' => $event->toResource()->toArray($request) + ]); + } } diff --git a/app/Domains/Event/Controllers/ParticipantController.php b/app/Domains/Event/Controllers/ParticipantController.php new file mode 100644 index 0000000..147ee82 --- /dev/null +++ b/app/Domains/Event/Controllers/ParticipantController.php @@ -0,0 +1,40 @@ +eventParticipants->getByIdentifier($participantIdentifier, $this->events, false); + + $paymentRequest = new ParticipantPaymentRequest($participant, $participant->amount); + + $paymentCommand = new ParticipantPaymentCommand($paymentRequest); + $paymentResponse = $paymentCommand->execute(); + + return response()->json([ + 'status' => $paymentResponse->success ? 'success' : 'error', + 'message' => $paymentResponse->success ? 'Die Zahlung wurde erfolgreich gebucht.' : 'Beim Buchen der Zahlung ist ein Fehler aufgetreten.' + ]); + } + + public function markCocExisting(string $participantIdentifier, Request $request) { + $participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events, false); + + $cocRequest = new ManualCertificateOfConductionCheckRequest($participant); + $cocCommand = new ManualCertificateOfConductionCheckCommand($cocRequest); + $cocResponse = $cocCommand->execute(); + + return response()->json([ + 'status' => $cocResponse->success ? 'success' : 'error', + 'message' => $cocResponse->success ? 'Das eFZ wurde als gültig hinterlegt' : 'Beim Aktualisieren des eFZ-Status ist ein Fehler aufgetreten.' + ]); + } +} diff --git a/app/Domains/Event/Routes/api.php b/app/Domains/Event/Routes/api.php index 11f777b..6f7292c 100644 --- a/app/Domains/Event/Routes/api.php +++ b/app/Domains/Event/Routes/api.php @@ -2,6 +2,7 @@ use App\Domains\Event\Controllers\CreateController; use App\Domains\Event\Controllers\DetailsController; +use App\Domains\Event\Controllers\ParticipantController; use App\Domains\Event\Controllers\SignupController; use App\Middleware\IdentifyTenant; use Illuminate\Support\Facades\Route; @@ -19,7 +20,7 @@ Route::prefix('api/v1') Route::prefix('/details/{eventId}') ->group(function () { Route::get('/summary', [DetailsController::class, 'summary']); - + Route::get('/participants/{listType}', [DetailsController::class, 'listParticipants']); Route::post('/event-managers', [DetailsController::class, 'updateEventManagers']); @@ -28,6 +29,10 @@ Route::prefix('api/v1') }); + Route::prefix('/participant/{participantIdentifier}')->group(function () { + Route::post('/payment-complete', [ParticipantController::class, 'paymentComplete']); + Route::post('/mark-coc-existing', [ParticipantController::class, 'markCocExisting']); + }); }); }); diff --git a/app/Domains/Event/Views/Details.vue b/app/Domains/Event/Views/Details.vue index 5c4cbca..8fdf945 100644 --- a/app/Domains/Event/Views/Details.vue +++ b/app/Domains/Event/Views/Details.vue @@ -3,7 +3,7 @@ import {reactive, inject, onMounted} from 'vue'; import AppLayout from "../../../../resources/js/layouts/AppLayout.vue"; import ShadowedBox from "../../../Views/Components/ShadowedBox.vue"; import TabbedPage from "../../../Views/Components/TabbedPage.vue"; -import ListCostUnits from "../../CostUnit/Views/Partials/ListCostUnits.vue"; +import ParticipantsList from "./Partials/ParticipantsList.vue"; import Overview from "./Partials/Overview.vue"; const props = defineProps({ @@ -18,27 +18,27 @@ const tabs = [ }, { title: 'Alle Teilnehmendenden', - component: ListCostUnits, - endpoint: "/api/v1/cost-unit/open/current-running-jobs", + component: ParticipantsList, + endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/all', }, { title: 'Teilis nach Stamm', - component: ListCostUnits, - endpoint: "/api/v1/cost-unit/open/closed-cost-units", + component: ParticipantsList, + endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/by-local-group', }, { title: 'Teilis nach Teili-Gruppe', - component: ListCostUnits, - endpoint: "/api/v1/cost-unit/open/archived-cost-units", + component: ParticipantsList, + endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/by-participation-group', }, { title: 'Abgemeldete Teilis', - component: ListCostUnits, - endpoint: "/api/v1/cost-unit/open/archived-cost-units", + component: ParticipantsList, + endpoint: "/api/v1/event/details/" + props.event.identifier + '/participants/signed-off', }, { title: 'Zusätze', - component: ListCostUnits, + component: ParticipantsList, endpoint: "/api/v1/cost-unit/open/archived-cost-units", }, ] diff --git a/app/Domains/Event/Views/Partials/Overview.vue b/app/Domains/Event/Views/Partials/Overview.vue index e78dc8c..a276bd9 100644 --- a/app/Domains/Event/Views/Partials/Overview.vue +++ b/app/Domains/Event/Views/Partials/Overview.vue @@ -1,5 +1,5 @@