Participant mangement

This commit is contained in:
2026-04-11 22:17:38 +02:00
parent e6bd8c684d
commit ed7f887e3a
47 changed files with 1641 additions and 269 deletions

View File

@@ -182,6 +182,7 @@ class DetailsController extends CommonController {
$participants = $this->eventParticipants->groupByParticipationType($event, $request);
break;
case 'signed-off':
$participants = $this->eventParticipants->getSignedOffParticipants($event, $request);
break;
default:
$participants = ['Alle Teilnehmenden' => $this->eventParticipants->getForList($event, $request)];

View File

@@ -11,22 +11,8 @@ use App\Scopes\CommonController;
use Illuminate\Support\Facades\Request;
class ParticipantController extends CommonController {
public function paymentComplete(string $participantIdentifier, Request $request) {
$participant = $this->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);
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
$cocRequest = new ManualCertificateOfConductionCheckRequest($participant);
$cocCommand = new ManualCertificateOfConductionCheckCommand($cocRequest);
@@ -37,4 +23,12 @@ class ParticipantController extends CommonController {
'message' => $cocResponse->success ? 'Das eFZ wurde als gültig hinterlegt' : 'Beim Aktualisieren des eFZ-Status ist ein Fehler aufgetreten.'
]);
}
public function __invoke(string $participantIdentifier, Request $request) {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events)->toResource()->toArray($request);
return response()->json([
'participant' => $participant,
]);
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentCommand;
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentRequest;
use App\Scopes\CommonController;
use App\ValueObjects\Amount;
use Illuminate\Http\Request;
class ParticipantPaymentController extends CommonController
{
public function paymentComplete(string $participantIdentifier, Request $request) {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
$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 partialPaymentComplete(string $participantIdentifier, Request $request) {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
$paymentRequest = new ParticipantPaymentRequest($participant, Amount::fromString($request->input('amount')));
$paymentCommand = new ParticipantPaymentCommand($paymentRequest);
$paymentResponse = $paymentCommand->execute();
$amountLeft = clone($paymentResponse->amountExpected);
$amountLeft->subtractAmount($paymentResponse->amountPaid);
return response()->json([
'status' => $paymentResponse->success ? 'success' : 'error',
'message' => $paymentResponse->success ? 'Die Zahlung wurde erfolgreich gebucht.' : 'Beim Buchen der Zahlung ist ein Fehler aufgetreten.',
'identifier' => $participant->identifier,
'amount' => [
'paid' => $paymentResponse->amountPaid->toString(),
'expected' => $paymentResponse->amountExpected->toString(),
'actions' => $amountLeft->getAmount() != 0 ? 'inline' : 'none',
'class' => $amountLeft->getAmount() != 0 ? 'not-paid' : 'paid',
]
]);
dd($participant);
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\SetParticipationState\SetParticipationStateCommand;
use App\Domains\Event\Actions\SetParticipationState\SetParticipationStateReSignonRequest;
use App\Domains\Event\Actions\SetParticipationState\SetParticipationStateSignoffRequest;
use App\Scopes\CommonController;
use DateTime;
use Illuminate\Http\Request;
class ParticipantReSignOnController extends CommonController
{
public function __invoke(string $participantIdentifier, Request $request) {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
$request = new SetParticipationStateReSignonRequest($participant);
$command = new SetParticipationStateCommand($request);
$command->execute();
return response()->json([
'status' => 'success',
'identifier' => $participant->identifier,
'message' => 'Die Wiederanmeldung wurde erfolgreich durchgeführt.'
]);
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\SetParticipationState\SetParticipationStateCommand;
use App\Domains\Event\Actions\SetParticipationState\SetParticipationStateSignoffRequest;
use App\Scopes\CommonController;
use DateTime;
use Illuminate\Http\Request;
class ParticipantSignOffController extends CommonController
{
public function __invoke(string $participantIdentifier, Request $request) {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
$signOffDate = DateTime::createFromFormat('Y-m-d', $request->input('cancel_date'));
$signOffRequest = new SetParticipationStateSignoffRequest($participant, $signOffDate);
$signOffCommand = new SetParticipationStateCommand($signOffRequest);
$signOffCommand->execute();
return response()->json([
'status' => 'success',
'identifier' => $participant->identifier,
'message' => 'Die Abmeldung wurde erfolgreich durchgeführt.'
]);
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\UpdateParticipant\UpdateParticipantCommand;
use App\Domains\Event\Actions\UpdateParticipant\UpdateParticipantRequest;
use App\Enumerations\EfzStatus;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ParticipantUpdateController extends CommonController {
public function __invoke(string $participantIdentifier, Request $request): JsonResponse {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
$updateRequest = new UpdateParticipantRequest(
participant: $participant,
firstname: $request->input('firstname'),
lastname: $request->input('lastname'),
nickname: $request->input('nickname'),
address_1: $request->input('address_1'),
address_2: $request->input('address_2'),
postcode: $request->input('postcode'),
city: $request->input('city'),
localgroup: $request->input('localgroup'),
birthday: $request->input('birthday'),
email_1: $request->input('email_1'),
phone_1: $request->input('phone_1'),
contact_person: $request->input('contact_person'),
email_2: $request->input('email_2'),
phone_2: $request->input('phone_2'),
arrival: $request->input('arrival'),
departure: $request->input('departure'),
participationType: $request->input('participationType'),
eatingHabit: $request->input('eatingHabit'),
allergies: $request->input('allergies'),
intolerances: $request->input('intolerances'),
medications: $request->input('medications'),
extendedFirstAid: $request->input('extendedFirstAid'),
swimmingPermission: $request->input('swimmingPermission'),
tetanusVaccination: $request->input('tetanusVaccination'),
notes: $request->input('notes'),
amountPaid: $request->input('amountPaid'),
amountExpected: $request->input('amountExpected'),
cocStatus: $request->input('cocStatus'),
);
$command = new UpdateParticipantCommand($updateRequest);
$response = $command->execute();
$data = [
'status' => $response->success ? 'success' : 'error',
'identifier' => $participant->identifier,
'participant' => $response->participant->toResource()->toArray($request),
];
if ($response->cocStatus !== null) {
$data['cocChanged'] = true;
$data['coc']['action'] = in_array($response->cocStatus->slug, [
EfzStatus::EFZ_STATUS_CHECKED_INVALID,
EfzStatus::EFZ_STATUS_NOT_CHECKED]) ? 'inline' : 'none';
$data['coc']['statusText'] = $response->cocStatus->name;
$data['coc']['class'] = match($response->cocStatus->slug) {
EfzStatus::EFZ_STATUS_CHECKED_INVALID => 'efz-invalid',
EfzStatus::EFZ_STATUS_NOT_CHECKED => 'efz-not-checked',
default => 'efz-valid',
};
}
if ($response->amountPaid !== null) {
$amountLeft = clone($response->amountExpected);
$amountLeft->subtractAmount($response->amountPaid);
$data['amountChanged'] = true;
$data['amount'] = [
'paid' => $response->amountPaid->toString(),
'expected' => $response->amountExpected->toString(),
'actions' => $amountLeft->getAmount() != 0 ? 'inline' : 'none',
'class' => $amountLeft->getAmount() != 0 ? 'not-paid' : 'paid',
];
}
return response()->json($data);
}
}

View File

@@ -6,7 +6,7 @@ use App\Domains\Event\Actions\CertificateOfConductionCheck\CertificateOfConducti
use App\Domains\Event\Actions\CertificateOfConductionCheck\CertificateOfConductionCheckRequest;
use App\Domains\Event\Actions\SignUp\SignUpCommand;
use App\Domains\Event\Actions\SignUp\SignUpRequest;
use App\Mail\EventSignUpSuccessfull;
use App\Mail\ParticipantParticipationMails\EventSignUpSuccessfullMail;
use App\Models\Tenant;
use App\Providers\DoubleCheckEventRegistrationProvider;
use App\Providers\InertiaProvider;
@@ -143,12 +143,12 @@ class SignupController extends CommonController {
$signupResponse->participant->efz_status = $certificateOfConductionCheckResponse->status;
$signupResponse->participant->save();
Mail::to($signupResponse->participant->email_1)->send(new EventSignUpSuccessfull(
Mail::to($signupResponse->participant->email_1)->send(new EventSignUpSuccessfullMail(
participant: $signupResponse->participant,
));
if ($signupResponse->participant->email_2 !== null) {
Mail::to($signupResponse->participant->email_2)->send(new EventSignUpSuccessfull(
Mail::to($signupResponse->participant->email_2)->send(new EventSignUpSuccessfullMail(
participant: $signupResponse->participant,
));
}