From 1fb8e3fa81b5c01e9444f2e2581aff2dbe1ee00f Mon Sep 17 00:00:00 2001 From: Constantin Simonis Date: Tue, 4 Feb 2025 19:35:05 +0100 Subject: [PATCH] add some stuff --- src/Entity/Payment.php | 8 ++++++++ templates/email/order.html.twig | 16 +++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Entity/Payment.php b/src/Entity/Payment.php index 0e788af..22d174f 100644 --- a/src/Entity/Payment.php +++ b/src/Entity/Payment.php @@ -2,6 +2,7 @@ namespace App\Entity; +use App\Enum\TicketData; use App\Repository\PaymentRepository; use Doctrine\ORM\Mapping as ORM; @@ -63,4 +64,11 @@ class Payment return $this; } + + public function getTotal(): float + { + return $this->customer->getTickets() + ->map(fn (Ticket $ticket) => TicketData::TICKET_DATA[$ticket->getType()]['price']) + ->reduce(fn (float $carry, float $price) => $carry + $price, 0); + } } diff --git a/templates/email/order.html.twig b/templates/email/order.html.twig index 6128df2..e6f905a 100644 --- a/templates/email/order.html.twig +++ b/templates/email/order.html.twig @@ -7,20 +7,22 @@ Hallo {{ payment.customer.firstname }}
-text +placeholder text
+
+
{% for ticket in payment.customer.tickets %} - {{ (ticket.type | ticket)['name'] }} ({{ (ticket.type | ticket)['price'] }}€) + Ticket: {{ (ticket.type | ticket)['name'] }} ({{ (ticket.type | ticket)['price'] }}€)
- {{ ticket.foodType | food }} + Essen: {{ ticket.foodType | food }}
{% if ticket.note %} + Anmerkung: {{ ticket.note }}
- {{ ticket.note }} - {% endif %} - {% if not loop.last %} -
{% endif %} +
{% endfor %} +
+Gesamtpreis: {{ payment.total }}€ \ No newline at end of file