feat: additional and updated email notifications
This commit is contained in:
@@ -3,8 +3,11 @@
|
|||||||
namespace App\EventListener;
|
namespace App\EventListener;
|
||||||
|
|
||||||
use App\Email\Mailer;
|
use App\Email\Mailer;
|
||||||
|
use App\Entity\Application;
|
||||||
use App\Entity\Upload;
|
use App\Entity\Upload;
|
||||||
|
use App\Event\ApplicationStatusEvent;
|
||||||
use App\Event\DispositionCreatedEvent;
|
use App\Event\DispositionCreatedEvent;
|
||||||
|
use App\Event\DocumentRejectedEvent;
|
||||||
use App\Event\DocumentUploadedEvent;
|
use App\Event\DocumentUploadedEvent;
|
||||||
use App\Repository\UserRepository;
|
use App\Repository\UserRepository;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
@@ -22,9 +25,14 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
|||||||
return [
|
return [
|
||||||
DispositionCreatedEvent::NAME => 'onDispositionCreated',
|
DispositionCreatedEvent::NAME => 'onDispositionCreated',
|
||||||
DocumentUploadedEvent::NAME => 'onDocumentUploaded',
|
DocumentUploadedEvent::NAME => 'onDocumentUploaded',
|
||||||
|
DocumentRejectedEvent::NAME => 'onDocumentRejected',
|
||||||
|
ApplicationStatusEvent::NAME => 'onApplicationStatus',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify teamer about accepted application
|
||||||
|
*/
|
||||||
public function onDispositionCreated(DispositionCreatedEvent $event): void
|
public function onDispositionCreated(DispositionCreatedEvent $event): void
|
||||||
{
|
{
|
||||||
$disposition = $event->getDisposition();
|
$disposition = $event->getDisposition();
|
||||||
@@ -39,6 +47,9 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify managers about uploaded documents
|
||||||
|
*/
|
||||||
public function onDocumentUploaded(DocumentUploadedEvent $event): void
|
public function onDocumentUploaded(DocumentUploadedEvent $event): void
|
||||||
{
|
{
|
||||||
$document = $event->getDocument();
|
$document = $event->getDocument();
|
||||||
@@ -67,4 +78,52 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify teamer about rejected document
|
||||||
|
*/
|
||||||
|
public function onDocumentRejected(DocumentRejectedEvent $event): void
|
||||||
|
{
|
||||||
|
$document = $event->getDocument();
|
||||||
|
$disposition = $document->getDisposition();
|
||||||
|
$teamer = $disposition->getTeamer();
|
||||||
|
|
||||||
|
$documentTypeLabel = match ($document->getType()) {
|
||||||
|
Upload::TYPE_CONTRACT => 'dein Honorarvertrag',
|
||||||
|
Upload::TYPE_INVOICE => 'deine Honorarnote',
|
||||||
|
default => 'Dokument '.$document->getOriginalFilename(),
|
||||||
|
};
|
||||||
|
|
||||||
|
$this->mailer->createAndSendEmail([
|
||||||
|
'disposition' => $disposition,
|
||||||
|
'documentTypeLabel' => $documentTypeLabel,
|
||||||
|
'comment' => $event->getComment(),
|
||||||
|
], [
|
||||||
|
'to' => $teamer->getCommunication()->getEmail(),
|
||||||
|
'subject' => ucfirst($documentTypeLabel).' wurde abgelehnt',
|
||||||
|
'template' => 'email/document_rejected.html.twig',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify teamer about rejected application
|
||||||
|
*/
|
||||||
|
public function onApplicationStatus(ApplicationStatusEvent $event): void
|
||||||
|
{
|
||||||
|
$application = $event->getApplication();
|
||||||
|
|
||||||
|
if (Application::STATUS_REJECTED !== $application->getStatus()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$teamer = $application->getTeamer();
|
||||||
|
|
||||||
|
$this->mailer->createAndSendEmail([
|
||||||
|
'appplication' => $application,
|
||||||
|
], [
|
||||||
|
'to' => $teamer->getCommunication()->getEmail(),
|
||||||
|
'subject' => 'Deine Bewerbung wurde abgelehnt',
|
||||||
|
'template' => 'email/application_rejected.html.twig',
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{% extends 'email/layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>
|
||||||
|
Hallo aus Köln,
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
leider konnte deine Bewerbung für den vorliegenden Einsatz nicht angenommen werden. Dies kann unterschiedliche
|
||||||
|
Gründe haben, wie bspw. Unpassende Buszustiege, zu späte Bewerbung, unpassendes Jobprofil, zu viele andere
|
||||||
|
Bewerbungen o.ä.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Bewirb dich doch gerne auf weitere Einsätze, vielleicht hast du diesmal Glück! 😊
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="{{ url('app_teamer_index') }}" class="button">
|
||||||
|
Zum Portal
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{% extends 'email/layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>
|
||||||
|
Hallo aus Köln,
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
leider wurde {{ documentTypeLabel }} für den Einsatz {{ disposition.assignment.destination}} mit folgender
|
||||||
|
Begründung abgelehnt:
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{ comment | nl2br }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Überarbeite das Dokument bitte und lade es erneut hoch.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="{{ url('app_teamer_index') }}" class="button">
|
||||||
|
Zum Portal
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
@@ -2,21 +2,17 @@
|
|||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>
|
<h1>
|
||||||
Reminder zu fehlenden Dokumenten
|
Hallo aus Köln,
|
||||||
</h1>
|
</h1>
|
||||||
|
<p>
|
||||||
|
bitte denke daran, deinen ausgefüllten Honorarvertrag für folgenden Einsatz hochzuladen. Vorher können wir nicht
|
||||||
|
fest mit dir planen und behalten uns vor den Einsatz anderweitig zu vergeben.
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>
|
<strong>
|
||||||
Honorarvertrag zu deinem Einsatz <a href="{{ url('app_teamer_disposition_detail', { 'uuid': disposition.uuid }) }}">{{ disposition.assignment.destination}}</a>.
|
<a href="{{ url('app_teamer_disposition_detail', { 'uuid': disposition.uuid }) }}">{{ disposition.assignment.destination}}</a>.
|
||||||
</strong>
|
</strong>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
Dein Honorarvertrag wurde noch nicht ausgefüllt. Du hast noch 3 Tage Zeit diesen ausgefüllt hochzuladen. Hältst
|
|
||||||
du diese Frist nicht ein, verfällt das Einsatzangebot und deine Teamkolleg:innen erhalten die Chance, diesen
|
|
||||||
Einsatz zu besetzen.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Setz dich am besten direkt dran, damit du es nicht vergisst! 😊
|
|
||||||
</p>
|
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ url('app_teamer_index') }}" class="button">
|
<a href="{{ url('app_teamer_index') }}" class="button">
|
||||||
Zum Portal
|
Zum Portal
|
||||||
|
|||||||
@@ -2,19 +2,12 @@
|
|||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>
|
<h1>
|
||||||
Reminder zu fehlenden Dokumenten
|
Hallo aus Köln,
|
||||||
</h1>
|
</h1>
|
||||||
<p>
|
<p>
|
||||||
<strong>
|
vielen Dank für deinen Einsatz {{ disposition.assignment.destination}}. Bitte lade deine Honorarnote innerhalb
|
||||||
Honorarnote zu deinem Einsatz <a href="{{ url('app_teamer_disposition_detail', { 'uuid': disposition.uuid }) }}">{{ disposition.assignment.destination}}</a>.
|
der nächsten 14 Tage hoch, damit wir dein Honorar bearbeiten können. Solltest du deine Honorarnote zu spät
|
||||||
</strong>
|
hochladen, können wir sie eventuell nicht mehr annehmen.
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Deine Honorarnote wurde noch nicht ausgefüllt. Du hast noch 3 Tage Zeit diese ausgefüllt hochzuladen. Hältst du
|
|
||||||
diese Frist nicht ein, verfällt die Honorarnote und du erhältst kein Geld mehr!
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Setz dich am besten direkt dran, damit du es nicht vergisst! 😊
|
|
||||||
</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