diff --git a/.env b/.env index a667205..3c06a38 100644 --- a/.env +++ b/.env @@ -40,6 +40,8 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0 MAILER_DSN=null://null ###< symfony/mailer ### +APP_BASE_URI=https://myep-team.ddev.site + APP_BPN_USER= APP_BPN_PASSWORD= APP_BPN_ENDPOINT= diff --git a/assets/mjml/layout.mjml b/assets/mjml/layout.mjml index 3176b0a..3285ded 100644 --- a/assets/mjml/layout.mjml +++ b/assets/mjml/layout.mjml @@ -9,18 +9,20 @@ h1 { font-weight: bold; - font-size: 32px; - line-height: 36px; - margin-bottom: 0; - padding-bottom: 16px; - } - h2 { - font-weight: normal; font-size: 24px; line-height: 28px; margin-bottom: 0; + padding-bottom: 8px; + } + h2 { + font-weight: normal; + font-size: 20px; + line-height: 24px; + margin-bottom: 0; + padding-bottom: 0; } p { + font-size: 16px; padding-bottom: 16px; } p.small { @@ -43,11 +45,14 @@ padding: 8px 16px; border-radius: 4px; } + strong { + font-weight: bold; + } - - + + @@ -65,7 +70,7 @@

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto culpa delectus dolores - earum eius fugiat in nesciunt quas quidem vitae? + earum eius fugiat in nesciunt quas quidem vitae?

diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 6d85c29..e71c015 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -18,6 +18,9 @@ framework: php_errors: log: true + router: + default_uri: '%env(APP_BASE_URI)%' + when@test: framework: test: true diff --git a/config/packages/messenger.yaml b/config/packages/messenger.yaml index 587083a..4ce32b7 100644 --- a/config/packages/messenger.yaml +++ b/config/packages/messenger.yaml @@ -13,10 +13,10 @@ framework: max_retries: 3 multiplier: 2 failed: 'doctrine://default?queue_name=failed' - # sync: 'sync://' + sync: 'sync://' routing: - Symfony\Component\Mailer\Messenger\SendEmailMessage: async + Symfony\Component\Mailer\Messenger\SendEmailMessage: sync Symfony\Component\Notifier\Message\ChatMessage: async Symfony\Component\Notifier\Message\SmsMessage: async diff --git a/src/Controller/Admin/Application/DisposeController.php b/src/Controller/Admin/Application/DisposeController.php index 73ad36a..dfe0570 100644 --- a/src/Controller/Admin/Application/DisposeController.php +++ b/src/Controller/Admin/Application/DisposeController.php @@ -4,17 +4,20 @@ namespace App\Controller\Admin\Application; use App\Entity\Application; use App\Entity\Disposition; +use App\Event\DispositionCreatedEvent; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Http\Attribute\IsGranted; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class DisposeController extends AbstractController { public function __construct( private readonly EntityManagerInterface $entityManager, + private readonly EventDispatcherInterface $eventDispatcher, private readonly LoggerInterface $logger ) { } @@ -30,6 +33,8 @@ class DisposeController extends AbstractController $this->entityManager->remove($application); $this->entityManager->flush(); + $this->eventDispatcher->dispatch(new DispositionCreatedEvent($disposition), DispositionCreatedEvent::NAME); + $this->addFlash('success', 'Der Teamer wurde eingeteilt'); $this->logger->info('Create disposition', [ 'disposition_id' => $disposition->getId(), diff --git a/src/Email/WelcomeEmailMailer.php b/src/Email/WelcomeEmailMailer.php deleted file mode 100644 index 62d61b9..0000000 --- a/src/Email/WelcomeEmailMailer.php +++ /dev/null @@ -1,28 +0,0 @@ -mailer->createAndSendEmail([ - 'user' => $user, - ], [ - 'to' => $user->getEmail(), - 'subject' => 'Willkommen bei MyE&P Team', - 'template' => 'email/welcome.html.twig', - ]); - - $this->logger->info('Send welcome email', [ - 'user_id' => $user->getId(), - 'user_email' => $user->getEmail(), - ]); - } -} diff --git a/src/Entity/Destination.php b/src/Entity/Destination.php index 0948df0..1ad08e5 100644 --- a/src/Entity/Destination.php +++ b/src/Entity/Destination.php @@ -51,11 +51,10 @@ class Destination implements TimestampableEntityInterface, SoftDeletableEntityIn public function __toString(): string { - return sprintf('%s - %s: %s, %s', + return sprintf('%s - %s %s', $this->getDateFrom()->format('d.m.y'), $this->getDateTo()->format('d.m.y'), - $this->getProduct(), - $this->getHotel() + $this->getProduct() ); } diff --git a/src/Event/DispositionCreatedEvent.php b/src/Event/DispositionCreatedEvent.php new file mode 100644 index 0000000..fad11ea --- /dev/null +++ b/src/Event/DispositionCreatedEvent.php @@ -0,0 +1,19 @@ +disposition; + } +} \ No newline at end of file diff --git a/src/EventListener/EmailNotificationSubscriber.php b/src/EventListener/EmailNotificationSubscriber.php new file mode 100644 index 0000000..b943431 --- /dev/null +++ b/src/EventListener/EmailNotificationSubscriber.php @@ -0,0 +1,35 @@ + 'onDispositionCreated', + ]; + } + + public function onDispositionCreated(DispositionCreatedEvent $event): void + { + $disposition = $event->getDisposition(); + $teamer = $disposition->getTeamer(); + + $this->mailer->createAndSendEmail([ + 'disposition' => $disposition, + ], [ + 'to' => $teamer->getCommunication()->getEmail(), + 'subject' => 'Dein Einsatz wurde angenommen', + 'template' => 'email/application_accepted.html.twig', + ]); + } +} \ No newline at end of file diff --git a/templates/_partials/_assignment_info.html.twig b/templates/_partials/_assignment_info.html.twig index ed4f2d4..65186b1 100644 --- a/templates/_partials/_assignment_info.html.twig +++ b/templates/_partials/_assignment_info.html.twig @@ -12,7 +12,7 @@ Destination

- {{ assignment.destination.product }}, {{ assignment.destination.hotel }} + {{ assignment.destination.product }}
diff --git a/templates/_partials/_assignment_info_compact.html.twig b/templates/_partials/_assignment_info_compact.html.twig index 32f8474..b92c0db 100644 --- a/templates/_partials/_assignment_info_compact.html.twig +++ b/templates/_partials/_assignment_info_compact.html.twig @@ -13,7 +13,7 @@ Destination
- {{ assignment.destination.product }}, {{ assignment.destination.hotel }} + {{ assignment.destination.product }}
diff --git a/templates/email/application_accepted.html.twig b/templates/email/application_accepted.html.twig new file mode 100644 index 0000000..871a6dd --- /dev/null +++ b/templates/email/application_accepted.html.twig @@ -0,0 +1,29 @@ +{% extends 'email/layout.html.twig' %} + +{% block body %} +

+ Herzlichen Glückwunsch! +

+

+ + Dein Einsatz {{ disposition.assignment.destination}} + wurde angenommen! + +

+

+ Schau einmal in das My E&P-Team Portal, + um die Einsatzdetails einzusehen und deinen Honorarvertrag zu unterschreiben. +

+

+ Mit dem Erhalt dieser E-Mail hast du 7 Tage Zeit deinen Einsatz zu bestätigen, indem du den unterschriebenen + Vertrag hochlädst. Ist diese Frist vergangen, wird der Einsatz für deine Teamkolleg:innen freigeschaltet. +

+

+ Schön, dass du dabei bist und ganz viel Spaß in den Bergen! 😊 +

+

+ + Zum Portal + +

+{% endblock %} \ No newline at end of file diff --git a/templates/email/layout.html.twig b/templates/email/layout.html.twig index 2ac3813..37a44ef 100644 --- a/templates/email/layout.html.twig +++ b/templates/email/layout.html.twig @@ -105,20 +105,22 @@ @@ -158,7 +164,7 @@ - +
@@ -172,8 +178,8 @@
- @@ -209,7 +215,7 @@
{% block body %}

Lorem ipsum dolor sit amet

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto culpa delectus dolores earum eius fugiat in nesciunt quas quidem vitae?

Lorem ipsum dolor

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto culpa delectus dolores earum eius fugiat in nesciunt quas quidem vitae?

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto culpa delectus dolores earum eius fugiat in nesciunt quas quidem vitae?

Button

diff --git a/templates/email/welcome.html.twig b/templates/email/welcome.html.twig deleted file mode 100644 index 274f33e..0000000 --- a/templates/email/welcome.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% extends 'email/layout.html.twig' %} - -{% block body %} -

- Willkommen bei MyE&P Team -

-

- Hallo {{ user.firstName }}, -

-

- Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquid asperiores atque, commodi deleniti - dignissimos dolorum earum ex facere facilis necessitatibus non omnis pariatur possimus quas repudiandae sit - soluta tenetur, voluptatem. -

-{% endblock %} \ No newline at end of file
- Logo E&P + + Logo E&P