Improvements #9

Merged
th.guenther merged 1 commits from dev-4.5.1 into main 2026-06-22 21:08:29 +02:00
5 changed files with 116 additions and 2 deletions
@@ -54,7 +54,7 @@ function eatingHabit() {
<table class="form-table" style="margin-bottom: 20px;">
<tr>
<td>Dein Name:</td>
<td>{{props.formData.vorname}} {{props.formData.vorname}}</td>
<td>{{props.formData.vorname}} {{props.formData.nachname}}</td>
</tr>
<tr>
@@ -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) {
@@ -0,0 +1,50 @@
<?php
namespace App\Mail\InvoiceMails;
use App\Models\CostUnit;
use App\Models\Invoice;
use App\ValueObjects\Amount;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
class InvoiceMailsSubmittedConfirmationMail extends Mailable {
public function __construct(
private Invoice $invoice,
private CostUnit $costUnit,
)
{
//
}
public function envelope(): Envelope
{
return new Envelope(
subject: 'Deine Abrechnung wurde erfolgreich eingereicht',
);
}
public function content(): Content
{
return new Content(
view: 'emails.invoices.submitted_confirmation',
with: [
'contactName' => $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<int, Attachment>
*/
public function attachments(): array
{
return [];
}
}
+1 -1
View File
@@ -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);
}
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<body>
<h1>Hallo {{$contactName}},</h1>
<p>
deine Abrechnung wurde erfolgreich eingereicht.<br />
In der nachfolgenden Übersicht findest du die Details zu deiner Abrechnung:
</p>
<table cellpadding="0" cellspacing="0" border="0"
style="width: 100%; max-width: 640px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; color: #1f2937;">
<tr>
<td style="padding: 8px 12px; width: 180px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
Abrechnungsnummer:
</td>
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">
{{$invoiceNumber}}
</td>
</tr>
<tr>
<td style="padding: 8px 12px; width: 180px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
Veranstaltung / Kostenstelle:
</td>
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">
{{$costUnitName}}
</td>
</tr>
<tr>
<td style="padding: 8px 12px; width: 180px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
Betrag:
</td>
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">
{{$invoiceAmount}}
</td>
</tr>
<tr>
<td style="padding: 8px 12px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
Grund der Abrechnung:
</td>
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">
{{$invoiceType}}
</td>
</tr>
</table>
<p>
Deine Abrechnung wird nun bearbeitet. Du wirst per E-Mail benachrichtigt, sobald sich der Status deiner Abrechnung ändert.
</p>
</body>
</html>