add some stuff

This commit is contained in:
Constantin Simonis 2025-02-04 19:35:05 +01:00
parent 2820752248
commit 1fb8e3fa81
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; namespace App\Entity;
use App\Enum\TicketData;
use App\Repository\PaymentRepository; use App\Repository\PaymentRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
@ -63,4 +64,11 @@ class Payment
return $this; 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> <body>
Hallo {{ payment.customer.firstname }} Hallo {{ payment.customer.firstname }}
<br> <br>
text placeholder text
<br> <br>
<br>
<hr>
{% for ticket in payment.customer.tickets %} {% for ticket in payment.customer.tickets %}
{{ (ticket.type | ticket)['name'] }} ({{ (ticket.type | ticket)['price'] }}€) Ticket: {{ (ticket.type | ticket)['name'] }} ({{ (ticket.type | ticket)['price'] }}€)
<br> <br>
{{ ticket.foodType | food }} Essen: {{ ticket.foodType | food }}
<br> <br>
{% if ticket.note %} {% if ticket.note %}
Anmerkung: {{ ticket.note }}
<br> <br>
{{ ticket.note }}
{% endif %}
{% if not loop.last %}
<hr>
{% endif %} {% endif %}
<hr>
{% endfor %} {% endfor %}
<br>
Gesamtpreis: {{ payment.total }}
</body> </body>
</html> </html>