diff --git a/app/Domains/Event/Actions/SignUp/SignUpCommand.php b/app/Domains/Event/Actions/SignUp/SignUpCommand.php index 7fafb53..c454281 100644 --- a/app/Domains/Event/Actions/SignUp/SignUpCommand.php +++ b/app/Domains/Event/Actions/SignUp/SignUpCommand.php @@ -2,6 +2,7 @@ namespace App\Domains\Event\Actions\SignUp; +use App\Enumerations\EatingHabit; use App\Enumerations\EfzStatus; use App\ValueObjects\Age; use Illuminate\Support\Str; @@ -13,8 +14,13 @@ class SignUpCommand { public function execute() : SignUpResponse { $response = new SignUpResponse(); - $participantAge = new Age($this->request->birthday); + $eatingHabit = match ($this->request->eating_habit) { + 'vegan' => EatingHabit::EATING_HABIT_VEGAN, + 'vegetarian' => EatingHabit::EATING_HABIT_VEGETARIAN, + default => EatingHabit::EATING_HABIT_OMNIVOR, + }; + $participantAge = new Age($this->request->birthday); $response->participant = $this->request->event->participants()->create( [ 'tenant' => $this->request->event->tenant, @@ -39,7 +45,7 @@ class SignUpCommand { 'intolerances' => $this->request->intolerances, 'medications' => $this->request->medications, 'tetanus_vaccination' => $this->request->tetanus_vaccination, - 'eating_habit' => $this->request->eating_habit, + 'eating_habit' => $eatingHabit, 'swimming_permission' => $participantAge->isfullAged() ? 'SWIMMING_PERMISSION_ALLOWED' : $this->request->swimming_permission, 'first_aid_permission' => $participantAge->isfullAged() ? 'FIRST_AID_PERMISSION_ALLOWED' : $this->request->first_aid_permission, 'foto_socialmedia' => $this->request->foto_socialmedia, diff --git a/app/Domains/Event/Controllers/DetailsController.php b/app/Domains/Event/Controllers/DetailsController.php index 511fc84..a670839 100644 --- a/app/Domains/Event/Controllers/DetailsController.php +++ b/app/Domains/Event/Controllers/DetailsController.php @@ -10,12 +10,15 @@ use App\Domains\Event\Actions\UpdateManagers\UpdateManagersCommand; use App\Domains\Event\Actions\UpdateManagers\UpdateManagersRequest; use App\Enumerations\ParticipationFeeType; use App\Enumerations\ParticipationType; +use App\Models\EventParticipant; use App\Providers\InertiaProvider; +use App\Providers\PdfGenerateAndDownloadProvider; use App\Resources\EventResource; use App\Scopes\CommonController; use App\ValueObjects\Amount; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Illuminate\Http\Response; class DetailsController extends CommonController { public function __invoke(int $eventId) { @@ -123,4 +126,31 @@ class DetailsController extends CommonController { 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"', + ]); + } } diff --git a/app/Domains/Event/Controllers/SignupController.php b/app/Domains/Event/Controllers/SignupController.php index be1656e..568d454 100644 --- a/app/Domains/Event/Controllers/SignupController.php +++ b/app/Domains/Event/Controllers/SignupController.php @@ -81,10 +81,10 @@ class SignupController extends CommonController { $registrationData['nachname'], $registrationData['email_1'], DateTime::createFromFormat('Y-m-d', $registrationData['geburtsdatum'])); - +/* if ($doubleCheckEventRegistrationProvider->isRegistered()) { return response()->json(['status' => 'exists']); - } + }*/ $amount = $eventResource->calculateAmount( $registrationData['participationType'], diff --git a/app/Domains/Event/Routes/web.php b/app/Domains/Event/Routes/web.php index bb362ca..d0817fe 100644 --- a/app/Domains/Event/Routes/web.php +++ b/app/Domains/Event/Routes/web.php @@ -18,6 +18,7 @@ Route::middleware(IdentifyTenant::class)->group(function () { Route::middleware(['auth'])->group(function () { Route::get('/new', CreateController::class); Route::get('/details/{eventId}', DetailsController::class); + Route::get('/details/{eventId}/pdf/{listType}', [DetailsController::class, 'downloadPdfList']); }); }); }); diff --git a/app/Domains/Event/Views/Partials/CommonSettings.vue b/app/Domains/Event/Views/Partials/CommonSettings.vue index 1daa84b..738a2fa 100644 --- a/app/Domains/Event/Views/Partials/CommonSettings.vue +++ b/app/Domains/Event/Views/Partials/CommonSettings.vue @@ -36,7 +36,7 @@ sendWeeklyReports: props.event.sendWeeklyReports, registrationAllowed: props.event.registrationAllowed, flatSupport: props.event.flatSupportEdit, - supportPerson: props.event.supportPersonEdit, + supportPerson: props.event.supportPersonIndex, }) onMounted(async () => { diff --git a/app/Domains/Event/Views/Partials/Overview.vue b/app/Domains/Event/Views/Partials/Overview.vue index efbb076..78cb44e 100644 --- a/app/Domains/Event/Views/Partials/Overview.vue +++ b/app/Domains/Event/Views/Partials/Overview.vue @@ -60,11 +60,20 @@ import {onMounted, reactive, ref} from "vue";
-
+ + +
+

-
-
+ + +
+ + + +
+


diff --git a/app/Domains/Event/Views/Partials/ParticipationSummary.vue b/app/Domains/Event/Views/Partials/ParticipationSummary.vue index 765f891..7b7177c 100644 --- a/app/Domains/Event/Views/Partials/ParticipationSummary.vue +++ b/app/Domains/Event/Views/Partials/ParticipationSummary.vue @@ -17,7 +17,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -91,7 +91,7 @@ {{ props.event.totalBalance.real.readable }} /
Teili{{props.event.participants.participant.count}} Personen:{{props.event.participants.participant.count}} Personen: {{props.event.participants.participant.amount.paid.readable}} /
Team{{props.event.participants.team.count}} Personen:{{props.event.participants.team.count}} Personen: {{props.event.participants.team.amount.paid.readable}} /
Unterstützende{{props.event.participants.volunteer.count}} Personen:{{props.event.participants.volunteer.count}} Personen: {{props.event.participants.volunteer.amount.paid.readable}} /
Sonstige{{props.event.participants.other.count}} Personen:{{props.event.participants.other.count}} Personen: {{props.event.participants.other.amount.paid.readable}} / - {{props.event.totalBalance.expected.readable}} + {{props.event.totalBalance.real.readable}} @@ -107,14 +107,14 @@

Ausgaben

- +
- - + +
{{amount.name}} {{amount.string}}
Gesamt{{props.event.costUnit.overAllAmount.text}}Gesamt{{props.event.costUnit.overAllAmount.text}}
diff --git a/app/Domains/Event/Views/Partials/SignUpForm/composables/useSignupForm.js b/app/Domains/Event/Views/Partials/SignUpForm/composables/useSignupForm.js index 7697141..40c4905 100644 --- a/app/Domains/Event/Views/Partials/SignUpForm/composables/useSignupForm.js +++ b/app/Domains/Event/Views/Partials/SignUpForm/composables/useSignupForm.js @@ -33,8 +33,8 @@ console.log(participantData) first_aid: '-1', participant_group: '', beitrag: 'regular', - arrival: event.eventBeginInternal?.split('T')[0] ?? '', - departure: event.eventEndInternal?.split('T')[0] ?? '', + arrival: event.arrivalDefault ?? '', + departure: event.departureDefault ?? '', anreise_essen: '1', abreise_essen: '2', foto: { socialmedia: false, print: false, webseite: false, partner: false, intern: false }, diff --git a/app/Domains/Event/Views/Partials/SignUpForm/steps/StepAge.vue b/app/Domains/Event/Views/Partials/SignUpForm/steps/StepAge.vue index 364bad2..7ff297a 100644 --- a/app/Domains/Event/Views/Partials/SignUpForm/steps/StepAge.vue +++ b/app/Domains/Event/Views/Partials/SignUpForm/steps/StepAge.vue @@ -31,7 +31,7 @@ const emit = defineEmits(['next'])

Mich selbst anmelden

-

Ich bin {{ event.alcoholicsAge }} Jahre oder älter.

+

Ich bin 18 Jahre oder älter.

diff --git a/app/Enumerations/SwimmingPermission.php b/app/Enumerations/SwimmingPermission.php index a2e74b3..d0f40e3 100644 --- a/app/Enumerations/SwimmingPermission.php +++ b/app/Enumerations/SwimmingPermission.php @@ -22,5 +22,6 @@ class SwimmingPermission extends CommonModel protected $fillable = [ 'slug', 'name', + 'short' ]; } diff --git a/app/Installer/ProductionDataSeeder.php b/app/Installer/ProductionDataSeeder.php index e05b79d..a004700 100644 --- a/app/Installer/ProductionDataSeeder.php +++ b/app/Installer/ProductionDataSeeder.php @@ -73,9 +73,9 @@ class ProductionDataSeeder { } private function installSwimmingPermissions() { - SwimmingPermission::create(['name' => 'Mein Kind darf baden und kann schwimmen', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_ALLOWED]); - SwimmingPermission::create(['name' => 'Mein Kind darf baden und kann NICHT schwimmen', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_LIMITED]); - SwimmingPermission::create(['name' => 'Mein Kind darf nicht baden', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_DENIED]); + SwimmingPermission::create(['name' => 'Mein Kind darf baden und kann schwimmen', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_ALLOWED, 'short' => 'Erteilt']); + SwimmingPermission::create(['name' => 'Mein Kind darf baden und kann NICHT schwimmen', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_LIMITED, 'short' => 'Nur Flachwasser']); + SwimmingPermission::create(['name' => 'Mein Kind darf nicht baden', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_DENIED, 'short' => 'Verweiger']); } private function installEatingHabits() { diff --git a/app/Models/Event.php b/app/Models/Event.php index 0b0fcf6..8a6e6a2 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -169,7 +169,7 @@ class Event extends InstancedModel ->withTimestamps(); } - public function participants() : hasMany { + public function participants() : HasMany { return $this->hasMany(EventParticipant::class); } diff --git a/app/Models/EventParticipant.php b/app/Models/EventParticipant.php index 6177ff2..0803d07 100644 --- a/app/Models/EventParticipant.php +++ b/app/Models/EventParticipant.php @@ -45,7 +45,7 @@ class EventParticipant extends InstancedModel 'intolerances', 'medications', 'tetanus_vaccination', - 'eating_habits', + 'eating_habit', 'swimming_permission', 'first_aid_permission', diff --git a/app/Repositories/CostUnitRepository.php b/app/Repositories/CostUnitRepository.php index 0d59ca1..8ca9416 100644 --- a/app/Repositories/CostUnitRepository.php +++ b/app/Repositories/CostUnitRepository.php @@ -166,7 +166,7 @@ class CostUnitRepository { if ( $invoice->status === InvoiceStatus::INVOICE_STATUS_DENIED || $invoice->donation || - $invoice->type !== $invoice->slug + $invoice->type !== $invoiceType->slug ) { continue; } diff --git a/app/Resources/EventParticipantResource.php b/app/Resources/EventParticipantResource.php index 526f290..2a3cf58 100644 --- a/app/Resources/EventParticipantResource.php +++ b/app/Resources/EventParticipantResource.php @@ -4,6 +4,7 @@ namespace App\Resources; use App\Enumerations\ParticipationType; use App\Models\EventParticipant; +use App\ValueObjects\Age; use Illuminate\Http\Resources\Json\JsonResource; class EventParticipantResource extends JsonResource @@ -34,6 +35,11 @@ class EventParticipantResource extends JsonResource return array_merge( $this->resource->toArray(), [ + 'age' => new Age($this->resource->birthday)->getAge(), + 'localgroup' => $this->resource->localGroup()->first()->name, + 'swimmingPermission' => $this->resource->swimmingPermission()->first()->short, + 'extendedFirstAid' => $this->resource->firstAidPermission()->first()->name, + 'tetanusVaccination' => $this->resource->tetanus_vaccination?->format('d.m.Y'), 'presenceDays' => ['real' => $presenceDays, 'support' => $presenceDaysSupport], 'participationType' => ParticipationType::where(['slug' => $this->resource->participation_type])->first()->name, 'needs_payment' => $this->resource->amount->getAmount() > 0 && $event->pay_direct, @@ -43,7 +49,8 @@ class EventParticipantResource extends JsonResource 'amount_left_string' => $amountLeft->toString(), 'amount_left_value' => $amountLeft->getAmount(), 'email_1' => $this->resource->email_1, - + 'amountPaid' => ['value' => $this->resource->amount_paid, 'readable' => $this->resource->amount_paid?->toString() ?? '0,00 Euro'], + 'amountExpected' => ['value' => $this->resource->amount, 'readable' => $this->resource->amount?->toString() ?? '0,00 Euro'], ] ); diff --git a/app/Resources/EventResource.php b/app/Resources/EventResource.php index 184e798..61a030b 100644 --- a/app/Resources/EventResource.php +++ b/app/Resources/EventResource.php @@ -67,13 +67,12 @@ class EventResource extends JsonResource{ $returnArray['participants'][$participationType] = $this->getParticipants($participationType); } - - - $returnArray['costUnit'] = new CostUnitResource($this->event->costUnit()->first())->toArray(true); $returnArray['solidarityPayment'] = $this->event->participation_fee_type === ParticipationFeeType::PARTICIPATION_FEE_TYPE_SOLIDARITY; $returnArray['payPerDay'] = $this->event->pay_per_day; $returnArray['maxAmount'] = $this->event->total_max_amount->getFormattedAmount(); + $returnArray['arrivalDefault'] = $this->event->start_date->format('Y-m-d'); + $returnArray['departureDefault'] = $this->event->end_date->format('Y-m-d'); $returnArray['eventBegin'] = $this->event->start_date->format('d.m.Y'); $returnArray['eventBeginInternal'] = $this->event->start_date; $returnArray['eventEnd'] = $this->event->end_date->format('d.m.Y'); @@ -94,7 +93,6 @@ class EventResource extends JsonResource{ $totalBalanceReal->subtractAmount($returnArray['costUnit']['overAllAmount']['value']); $totalBalanceExpected->subtractAmount($returnArray['costUnit']['overAllAmount']['value']); - $returnArray['totalBalance'] = [ 'real' => [ 'value' => $totalBalanceReal->getAmount(), diff --git a/app/Scopes/CommonController.php b/app/Scopes/CommonController.php index d26c3ae..a1bb05d 100644 --- a/app/Scopes/CommonController.php +++ b/app/Scopes/CommonController.php @@ -5,6 +5,7 @@ namespace App\Scopes; use App\Models\Tenant; use App\Providers\AuthCheckProvider; use App\Repositories\CostUnitRepository; +use App\Repositories\EventParticipantRepository; use App\Repositories\EventRepository; use App\Repositories\InvoiceRepository; use App\Repositories\PageTextRepository; @@ -19,6 +20,7 @@ abstract class CommonController { protected InvoiceRepository $invoices; protected EventRepository $events; + protected EventParticipantRepository $eventParticipants; public function __construct() { $this->tenant = app('tenant'); @@ -27,6 +29,7 @@ abstract class CommonController { $this->pageTexts = new PageTextRepository(); $this->invoices = new InvoiceRepository(); $this->events = new EventRepository(); + $this->eventParticipants = new EventParticipantRepository(); } protected function checkAuth() { diff --git a/database/migrations/2026_01_30_140002_create_users_table.php b/database/migrations/2026_01_30_140002_create_users_table.php index 5615e4e..1b08eac 100644 --- a/database/migrations/2026_01_30_140002_create_users_table.php +++ b/database/migrations/2026_01_30_140002_create_users_table.php @@ -27,6 +27,7 @@ return new class extends Migration Schema::create('swimming_permissions', function (Blueprint $table) { $table->string('slug')->unique()->primary(); $table->string('name'); + $table->string('short'); $table->timestamps(); }); diff --git a/database/migrations/2026_02_14_140010_create_events.php b/database/migrations/2026_02_14_140010_create_events.php index 37d3643..a38b9be 100644 --- a/database/migrations/2026_02_14_140010_create_events.php +++ b/database/migrations/2026_02_14_140010_create_events.php @@ -46,10 +46,10 @@ return new class extends Migration { $table->string('location'); $table->string('postal_code'); $table->string('email'); - $table->dateTime('start_date'); - $table->dateTime('end_date'); - $table->dateTime('early_bird_end'); - $table->dateTime('registration_final_end'); + $table->date('start_date'); + $table->date('end_date'); + $table->date('early_bird_end'); + $table->date('registration_final_end'); $table->integer('early_bird_end_amount_increase'); $table->string('account_owner'); $table->string('account_iban'); diff --git a/database/migrations/2026_02_15_140010_create_event_particpants.php b/database/migrations/2026_02_15_140010_create_event_particpants.php index 4a3e03e..2c8d010 100644 --- a/database/migrations/2026_02_15_140010_create_event_particpants.php +++ b/database/migrations/2026_02_15_140010_create_event_particpants.php @@ -50,8 +50,8 @@ return new class extends Migration { $table->boolean('foto_webseite')->default(false); $table->boolean('foto_partner')->default(false); $table->boolean('foto_intern')->default(false); - $table->dateTime('arrival_date'); - $table->dateTime('departure_date'); + $table->date('arrival_date'); + $table->date('departure_date'); $table->integer('arrival_eating'); $table->integer('departure_eating'); $table->longText('notes')->nullable();