This commit is contained in:
Constantin Simonis 2025-02-13 20:58:16 +01:00
parent 34d5145df4
commit 0236f6f92a
Signed by: csimonis
GPG Key ID: 3878FF77C24AF4D2
7 changed files with 90 additions and 24 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,5 +1,7 @@
twig: twig:
file_name_pattern: '*.twig' file_name_pattern: '*.twig'
paths:
'%kernel.project_dir%/assets/images/email': images
when@test: when@test:
twig: twig:

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Controller;
use chillerlan\QRCode\QRCode;
use Nucleos\DompdfBundle\Factory\DompdfFactory;
use Nucleos\DompdfBundle\Wrapper\DompdfWrapper;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class TestController extends AbstractController
{
#[Route('/test')]
public function index(Filesystem $filesystem): Response
{
$dompdfWrapper = new DompdfWrapper(new DompdfFactory());
$content = $dompdfWrapper->getPdf($this->renderView('test.html.twig', ['qr' => (new QRCode())->render('https://www.google.com')]));
$filesystem->dumpFile('test.pdf', $content);
return $this->render('test.html.twig', ['qr' => (new QRCode())->render('https://www.google.com')]);
}
}

View File

@ -10,6 +10,8 @@ use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Part\DataPart;
use Symfony\Component\Mime\Part\File;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class TicketEmailService class TicketEmailService

View File

@ -1,30 +1,53 @@
<!doctype html> <!DOCTYPE html>
<html lang="en"> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Abiball Ticket</title> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Abiball - Freie Waldorfschule Bremen</title>
</head> </head>
<body> <body style="margin: 0; padding: 0; font-family: Arial, sans-serif; background-color: #f6f6f6;">
Hallo {{ payment.customer.firstname }} <table role="presentation" cellpadding="0" cellspacing="0" width="100%" style="background-color: #f6f6f6;">
<br> <tr>
placeholder text <td style="padding: 20px 0;">
<br> <table role="presentation" cellpadding="0" cellspacing="0" width="300" style="margin: 0 auto; background-color: #ffffff; border-radius: 8px; overflow: hidden;">
<br> <tr>
<hr> <td style="background-color: #372064; padding: 10px 5px 5px; text-align: center;">
{% for ticket in payment.customer.tickets %} <img src="{{ email.image('@images/header.jpeg') }}" alt="Abiball" style="width: 290px; height: auto;">
Ticket: {{ (ticket.type | ticket)['name'] }} ({{ (ticket.type | ticket)['price'] }}€) </td>
<br> </tr>
Essen: {{ ticket.foodType | food }}
<br>
{% if ticket.note %}
Anmerkung: {{ ticket.note }}
<br>
{% endif %}
<hr>
{% endfor %}
<br>
Gesamtpreis: {{ payment.total }}
<img src="{{ qr }}" width="100"> <tr>
<td style="padding: 0;">
<img src="{{ email.image('@images/background.jpeg') }}" alt="Celebration" style="width: 100%; max-width: 300px; height: auto; display: block;">
</td>
</tr>
<tr>
<td style="padding: 40px;">
<h2 style="text-align: center; color: #333333; font-size: 24px; margin-bottom: 20px;">You're Invited!</h2>
<p style="text-align: center; color: #666666; font-size: 16px; line-height: 1.5; margin-bottom: 30px;">
Join us for an evening of celebration, dancing, and memories at the Freie Waldorfschule Bremen Graduation Ball
</p>
<table role="presentation" cellpadding="0" cellspacing="0" width="100%" style="background-color: #f8f9fa; border-radius: 8px; margin-bottom: 30px;">
<tr>
<td style="padding: 25px;">
<h3 style="color: #333333; font-size: 18px; margin: 0 0 15px 0;">Event Details</h3>
<p style="color: #666666; margin: 5px 0;">Date: [Date]</p>
<p style="color: #666666; margin: 5px 0;">Time: [Time]</p>
<p style="color: #666666; margin: 5px 0;">Address: [Address]</p>
</td>
</tr>
</table>
<div style="text-align: center; margin-bottom: 30px;">
<img src="{{ qr }}" alt="QR Code" style="width: 75px; height: 75px;">
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body> </body>
</html> </html>

13
templates/test.html.twig Normal file

File diff suppressed because one or more lines are too long