@@ -38,6 +41,9 @@ console.log(props.participant)
| IBAN: | {{ props.event.accountIban }} |
| Verwendungszweck: | {{ props.participant.payment_purpose }} |
| Betrag: | {{ props.participant.amount_left_string }} |
+
| |
+ Erinnerung in Kalender setzen
+ |
diff --git a/app/Mail/ParticipantParticipationMails/EventSignUpSuccessfullMail.php b/app/Mail/ParticipantParticipationMails/EventSignUpSuccessfullMail.php
index d6bd1c3..f100483 100644
--- a/app/Mail/ParticipantParticipationMails/EventSignUpSuccessfullMail.php
+++ b/app/Mail/ParticipantParticipationMails/EventSignUpSuccessfullMail.php
@@ -2,6 +2,12 @@
namespace App\Mail\ParticipantParticipationMails;
+use App\Domains\Event\Actions\GenerateIcal\GenerateIcalCommand;
+use App\Domains\Event\Actions\GenerateIcal\GenerateIcalRequest;
+use App\Domains\Event\Actions\GenerateIcal\GenerateIcalResponse;
+use App\Domains\Event\Actions\GenerateIcalForDeadline\GenerateIcalForDeadlineCommand;
+use App\Domains\Event\Actions\GenerateIcalForDeadline\GenerateIcalForDeadlineRequest;
+use App\Domains\Event\Actions\GenerateIcalForDeadline\GenerateIcalForDeadlineResponse;
use App\Models\EventParticipant;
use Illuminate\Bus\Queueable;
use Illuminate\Http\Request;
@@ -15,6 +21,10 @@ class EventSignUpSuccessfullMail extends Mailable
{
use Queueable, SerializesModels;
+ private ?GenerateIcalResponse $participationIcal = null;
+ private ?GenerateIcalForDeadlineResponse $deadlineIcal = null;
+
+
/**
* Create a new message instance.
*/
@@ -60,6 +70,10 @@ class EventSignUpSuccessfullMail extends Mailable
);
$girocodeBinary = (string)$girocodeProvider->create();
+ $participationIcal = $this->getParticipationIcal();
+ $deadlineIcal = $this->getDeadlineIcal();
+
+
return new Content(
view: 'emails.events.signup_complete',
with: [
@@ -76,19 +90,57 @@ class EventSignUpSuccessfullMail extends Mailable
'accountIban' => $event['accountIban'],
'paymentPurpose' => $participant['payment_purpose'],
'girocodeBinary' => $girocodeBinary,
- 'efzStatus' => $participant['efz_status']
+ 'efzStatus' => $participant['efz_status'],
+ 'participationIcalFilename' => $participationIcal->filename,
+ 'deadlineIcalFilename' => $deadlineIcal->filename,
],
);
}
- /**
- * Get the attachments for the message.
- *
- * @return array
- */
public function attachments(): array
{
- return [];
+ $attachments = [
+ Attachment::fromData(
+ fn () => $this->getParticipationIcal()->icalContent,
+ $this->getParticipationIcal()->filename
+ )->withMime('text/calendar'),
+ ];
+
+ $participant = $this->participant->toResource()->toArray(new Request());
+
+
+ if ($participant['needs_payment']) {
+ /*$attachments[] = [
+ Attachment::fromData(
+ fn () => $this->getDeadlineIcal()->icalContent,
+ $this->getDeadlineIcal()->filename
+ )->withMime('text/calendar'),
+ ];*/
+ }
+
+ return $attachments;
+ }
+
+ private function getDeadlineIcal(): GenerateIcalForDeadlineResponse
+ {
+ if ($this->deadlineIcal === null) {
+ $this->deadlineIcal = (new GenerateIcalForDeadlineCommand(
+ new GenerateIcalForDeadlineRequest($this->participant->event()->first())
+ ))->execute();
+ }
+
+ return $this->deadlineIcal;
+ }
+
+ private function getParticipationIcal(): GenerateIcalResponse
+ {
+ if ($this->participationIcal === null) {
+ $this->participationIcal = (new GenerateIcalCommand(
+ new GenerateIcalRequest($this->participant)
+ ))->execute();
+ }
+
+ return $this->participationIcal;
}
}
diff --git a/app/Repositories/EventParticipantRepository.php b/app/Repositories/EventParticipantRepository.php
index 15b291e..4032c8f 100644
--- a/app/Repositories/EventParticipantRepository.php
+++ b/app/Repositories/EventParticipantRepository.php
@@ -178,4 +178,47 @@ class EventParticipantRepository {
}
return $mailAddresses;
}
+
+ public function getMyParticipations(?int $maxEvents = null) : array {
+ $participations = [];
+ $user = auth()->user();
+ if ($user === null) {
+ return $participations;
+ }
+
+ $request = new \Illuminate\Http\Request();
+
+ $query = EventParticipant::where('user_id', $user->id)
+ ->whereNull('unregistered_at')
+ ->whereHas('event', function ($q) {
+ $q->where('end_date', '>=', now());
+ })
+ ->with(['event'])
+ ->join('events', 'event_participants.event_id', '=', 'events.id')
+ ->orderBy('events.start_date', 'asc')
+ ->select('event_participants.*');
+
+ if ($maxEvents !== null) {
+ $query->limit($maxEvents);
+ }
+
+ foreach ($query->get() as $participant) {
+ $participations[] = $participant->toResource()->toArray($request);
+ }
+
+ return $participations;
+ }
+
+ public function getMyParticipationByIdentifier(string $identifier) : ?EventParticipant {
+ $user = auth()->user();
+ if ($user === null) {
+ return null;
+ }
+
+ return EventParticipant::where('identifier', $identifier)
+ ->where('tenant', app('tenant')->slug)
+ ->where('user_id', $user->id)
+ ->whereNull('unregistered_at')
+ ->first();
+ }
}
diff --git a/app/Resources/EventParticipantResource.php b/app/Resources/EventParticipantResource.php
index add6de2..405f6f7 100644
--- a/app/Resources/EventParticipantResource.php
+++ b/app/Resources/EventParticipantResource.php
@@ -54,7 +54,7 @@ class EventParticipantResource extends JsonResource
'tetanusVaccination' => $this->resource->tetanus_vaccination?->format('d.m.Y') ?? 'Unbekannt',
'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,
+ 'needs_payment' => $this->resource->amount->getAmount() > 0 && $event->pay_direct && $this->resource->amount_paid?->getAmount() < $this->resource->amount->getAmount(),
'nicename' => $this->resource->getNicename(),
'arrival' => $this->resource->arrival_date->format('d.m.Y'),
'departure' => $this->resource->departure_date->format('d.m.Y'),
@@ -70,12 +70,21 @@ class EventParticipantResource extends JsonResource
'localGroupState' => config('postCode.map.' . $this->resource->localGroup()->first()->postcode),
'birthday' => $this->resource->birthday->format('d.m.Y'),
'eatingHabit' => EatingHabit::where('slug', $this->resource->eating_habit)->first()->name,
+ 'cocColor' => match ($this->resource->efz_status) {
+ EfzStatus::EFZ_STATUS_CHECKED_VALID => 'bg-green',
+ EfzStatus::EFZ_STATUS_NOT_REQUIRED => 'bg-green',
+ EfzStatus::EFZ_STATUS_NOT_CHECKED => 'bg-yellow',
+ EfzStatus::EFZ_STATUS_CHECKED_INVALID => 'bg-red',
+ },
'efzStatusReadable' => match($this->resource->efz_status) {
EfzStatus::EFZ_STATUS_CHECKED_VALID => 'Gültig',
EfzStatus::EFZ_STATUS_CHECKED_INVALID => 'Nicht eingereicht',
EfzStatus::EFZ_STATUS_NOT_CHECKED => 'Nicht geprüft',
EfzStatus::EFZ_STATUS_NOT_REQUIRED => 'Nicht erforderlich',
},
+ 'eventName' => $this->resource->event()->first()->name,
+ 'arrivalDateReadable' => $this->resource->arrival_date->format('d.m.Y'),
+ 'departureDateReadable' => $this->resource->departure_date->format('d.m.Y'),
]
);
}
diff --git a/app/Views/Partials/GlobalWidgets/GlobalWidgets.vue b/app/Views/Partials/GlobalWidgets/GlobalWidgets.vue
index 8a4dee2..e034219 100644
--- a/app/Views/Partials/GlobalWidgets/GlobalWidgets.vue
+++ b/app/Views/Partials/GlobalWidgets/GlobalWidgets.vue
@@ -40,4 +40,8 @@ import OpenCostUnits from "../../../Domains/Dashboard/Views/Partials/Widgets/Ope
margin: 0 10px;
}
+ .widget-box h2 {
+ display: none;
+ }
+
diff --git a/resources/views/emails/events/signup_complete.blade.php b/resources/views/emails/events/signup_complete.blade.php
index 356f876..2c0b571 100644
--- a/resources/views/emails/events/signup_complete.blade.php
+++ b/resources/views/emails/events/signup_complete.blade.php
@@ -23,7 +23,9 @@
Abreise
- {{ $departure }}
+ {{ $departure }}
+ In Kalender importieren
+
|
@@ -47,7 +49,7 @@
- @include('emails.subparts.payment')
+ @include('emails.subparts.payment')
@else