feat: additional email notifications
This commit is contained in:
@@ -53,8 +53,9 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
|||||||
public function onDocumentUploaded(DocumentUploadedEvent $event): void
|
public function onDocumentUploaded(DocumentUploadedEvent $event): void
|
||||||
{
|
{
|
||||||
$document = $event->getDocument();
|
$document = $event->getDocument();
|
||||||
|
$documentType = $document->getType();
|
||||||
|
|
||||||
if (Upload::TYPE_INVOICE === $document->getType()) {
|
if (in_array($documentType, [Upload::TYPE_INVOICE, Upload::TYPE_CONTRACT])) {
|
||||||
$disposition = $document->getDisposition();
|
$disposition = $document->getDisposition();
|
||||||
$hotelCode = $disposition
|
$hotelCode = $disposition
|
||||||
->getAssignment()
|
->getAssignment()
|
||||||
@@ -67,16 +68,25 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
|||||||
->getUsersByRoleAndHotelCode('ROLE_MANAGER', $hotelCode)
|
->getUsersByRoleAndHotelCode('ROLE_MANAGER', $hotelCode)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
if (Upload::TYPE_INVOICE === $documentType) {
|
||||||
|
$subject = 'Honorarnote hochgeladen';
|
||||||
|
$template = 'email/invoice_uploaded.html.twig';
|
||||||
|
} else {
|
||||||
|
$subject = 'Honorarvertrag hochgeladen';
|
||||||
|
$template = 'email/contract_uploaded.html.twig';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($managers as $manager) {
|
foreach ($managers as $manager) {
|
||||||
if (true === $manager->isMuteNotifications()) {
|
if (true === $manager->isMuteNotifications()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->mailer->createAndSendEmail([
|
$this->mailer->createAndSendEmail([
|
||||||
'disposition' => $disposition,
|
'disposition' => $disposition,
|
||||||
], [
|
], [
|
||||||
'to' => $manager->getEmail(),
|
'to' => $manager->getEmail(),
|
||||||
'subject' => 'Honorarnote hochgeladen',
|
'subject' => $subject,
|
||||||
'template' => 'email/invoice_uploaded.html.twig',
|
'template' => $template,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{% extends 'email/layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>
|
||||||
|
Honorvertrag hochgeladen
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
Es wurde ein neuer Honorarvertrag von {{ disposition.teamer }} hochgeladen, schau ihn dir an.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="{{ url('app_teamer_index') }}" class="button">
|
||||||
|
Zum Portal
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
@@ -5,9 +5,7 @@
|
|||||||
Honorarnote hochgeladen
|
Honorarnote hochgeladen
|
||||||
</h1>
|
</h1>
|
||||||
<p>
|
<p>
|
||||||
<strong>{{ disposition.teamer }}</strong> hat eine Honorarnote zum Einsatz
|
Es wurde eine neue Honorarnote von {{ disposition.teamer }} hochgeladen, gib diese bitte frei.
|
||||||
<strong>{{ disposition.assignment.jobProfile.name }} {{ disposition.assignment.destination}}</strong>
|
|
||||||
hochgeladen.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ url('app_teamer_index') }}" class="button">
|
<a href="{{ url('app_teamer_index') }}" class="button">
|
||||||
|
|||||||
Reference in New Issue
Block a user