GUI for Participant management
This commit is contained in:
@@ -19,6 +19,7 @@ use App\ValueObjects\Amount;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use function Symfony\Component\String\b;
|
||||
|
||||
class DetailsController extends CommonController {
|
||||
public function __invoke(int $eventId) {
|
||||
@@ -170,4 +171,25 @@ class DetailsController extends CommonController {
|
||||
'Content-Disposition' => '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)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
40
app/Domains/Event/Controllers/ParticipantController.php
Normal file
40
app/Domains/Event/Controllers/ParticipantController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Controllers;
|
||||
|
||||
use App\Domains\Event\Actions\ManualCertificateOfConductionCheck\ManualCertificateOfConductionCheckCommand;
|
||||
use App\Domains\Event\Actions\ManualCertificateOfConductionCheck\ManualCertificateOfConductionCheckRequest;
|
||||
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentCommand;
|
||||
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentRequest;
|
||||
use App\Models\EventParticipant;
|
||||
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);
|
||||
|
||||
$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.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user