From bc60461dac92945337a486bc94a967d2eadc4501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?= Date: Mon, 22 Jun 2026 21:07:53 +0200 Subject: [PATCH] Improvements --- .../Partials/SignUpForm/steps/StepSummary.vue | 2 +- .../CreateInvoice/CreateInvoiceCommand.php | 8 +++ .../InvoiceMailsSubmittedConfirmationMail.php | 50 +++++++++++++++++ app/Resources/EventResource.php | 2 +- .../invoices/submitted_confirmation.blade.php | 56 +++++++++++++++++++ 5 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 app/Mail/InvoiceMails/InvoiceMailsSubmittedConfirmationMail.php create mode 100644 resources/views/emails/invoices/submitted_confirmation.blade.php diff --git a/app/Domains/Event/Views/Partials/SignUpForm/steps/StepSummary.vue b/app/Domains/Event/Views/Partials/SignUpForm/steps/StepSummary.vue index fb2caae..a7da2a2 100644 --- a/app/Domains/Event/Views/Partials/SignUpForm/steps/StepSummary.vue +++ b/app/Domains/Event/Views/Partials/SignUpForm/steps/StepSummary.vue @@ -54,7 +54,7 @@ function eatingHabit() { - + diff --git a/app/Domains/Invoice/Actions/CreateInvoice/CreateInvoiceCommand.php b/app/Domains/Invoice/Actions/CreateInvoice/CreateInvoiceCommand.php index a922629..ea166b7 100644 --- a/app/Domains/Invoice/Actions/CreateInvoice/CreateInvoiceCommand.php +++ b/app/Domains/Invoice/Actions/CreateInvoice/CreateInvoiceCommand.php @@ -4,6 +4,7 @@ namespace App\Domains\Invoice\Actions\CreateInvoice; use App\Enumerations\InvoiceStatus; use App\Mail\InvoiceMails\InvoiceMailsNewInvoiceMail; +use App\Mail\InvoiceMails\InvoiceMailsSubmittedConfirmationMail; use App\Mail\ParticipantParticipationMails\EventSignUpSuccessfullMail; use App\Models\Invoice; use Illuminate\Support\Facades\Mail; @@ -50,6 +51,13 @@ class CreateInvoiceCommand { if ($invoice !== null) { $response->success = true; $response->invoice = $invoice; + + if ($invoice->contact_email !== null) { + Mail::to($invoice->contact_email)->send(new InvoiceMailsSubmittedConfirmationMail( + invoice: $invoice, + costUnit: $this->request->costUnit, + )); + } } if ($this->request->costUnit->mail_on_new) { diff --git a/app/Mail/InvoiceMails/InvoiceMailsSubmittedConfirmationMail.php b/app/Mail/InvoiceMails/InvoiceMailsSubmittedConfirmationMail.php new file mode 100644 index 0000000..dc206a7 --- /dev/null +++ b/app/Mail/InvoiceMails/InvoiceMailsSubmittedConfirmationMail.php @@ -0,0 +1,50 @@ + $this->invoice->contact_name, + 'costUnitName' => $this->costUnit->name, + 'invoiceAmount' => Amount::fromString($this->invoice->amount)->toString(), + 'invoiceType' => $this->invoice->invoiceType()->name, + 'invoiceNumber' => $this->invoice->invoice_number, + ], + ); + } + + /** + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/app/Resources/EventResource.php b/app/Resources/EventResource.php index 632146d..eef36db 100644 --- a/app/Resources/EventResource.php +++ b/app/Resources/EventResource.php @@ -331,7 +331,7 @@ class EventResource extends JsonResource{ $basicFee = $basicFee->multiply($this->getMultiplier()); if ($this->event->pay_per_day) { - $days = $arrival->diff($departure)->days; + $days = $arrival->diff($departure)->days + 1; $basicFee = $basicFee->multiply($days); } diff --git a/resources/views/emails/invoices/submitted_confirmation.blade.php b/resources/views/emails/invoices/submitted_confirmation.blade.php new file mode 100644 index 0000000..d66eb11 --- /dev/null +++ b/resources/views/emails/invoices/submitted_confirmation.blade.php @@ -0,0 +1,56 @@ + + + +

Hallo {{$contactName}},

+

+ deine Abrechnung wurde erfolgreich eingereicht.
+ In der nachfolgenden Übersicht findest du die Details zu deiner Abrechnung: +

+ + +
Dein Name:{{props.formData.vorname}} {{props.formData.vorname}}{{props.formData.vorname}} {{props.formData.nachname}}
+ + + + + + + + + + + + + + + + + + + + +
+ Abrechnungsnummer: + + {{$invoiceNumber}} +
+ Veranstaltung / Kostenstelle: + + {{$costUnitName}} +
+ Betrag: + + {{$invoiceAmount}} +
+ Grund der Abrechnung: + + {{$invoiceType}} +
+ + +

+ Deine Abrechnung wird nun bearbeitet. Du wirst per E-Mail benachrichtigt, sobald sich der Status deiner Abrechnung ändert. +

+ + -- 2.52.0