add some stuff

This commit is contained in:
Constantin Simonis 2025-02-04 19:35:05 +01:00
parent 607a74e311
commit 4b236543c8
Signed by: csimonis
GPG Key ID: 3878FF77C24AF4D2
2 changed files with 17 additions and 7 deletions

View File

@ -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);
}
}

View File

@ -7,20 +7,22 @@
<body>
Hallo {{ payment.customer.firstname }}
<br>
text
placeholder text
<br>
<br>
<hr>
{% for ticket in payment.customer.tickets %}
{{ (ticket.type | ticket)['name'] }} ({{ (ticket.type | ticket)['price'] }}€)
Ticket: {{ (ticket.type | ticket)['name'] }} ({{ (ticket.type | ticket)['price'] }}€)
<br>
{{ ticket.foodType | food }}
Essen: {{ ticket.foodType | food }}
<br>
{% if ticket.note %}
Anmerkung: {{ ticket.note }}
<br>
{{ ticket.note }}
{% endif %}
{% if not loop.last %}
<hr>
{% endif %}
<hr>
{% endfor %}
<br>
Gesamtpreis: {{ payment.total }}
</body>
</html>