feat: send disposition reminder email on contract confirmation
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Entity\Upload;
|
|||||||
use App\Event\ApplicationStatusEvent;
|
use App\Event\ApplicationStatusEvent;
|
||||||
use App\Event\AssignmentCalledOffEvent;
|
use App\Event\AssignmentCalledOffEvent;
|
||||||
use App\Event\DispositionCreatedEvent;
|
use App\Event\DispositionCreatedEvent;
|
||||||
|
use App\Event\DocumentConfirmedEvent;
|
||||||
use App\Event\DocumentRejectedEvent;
|
use App\Event\DocumentRejectedEvent;
|
||||||
use App\Event\DocumentUploadedEvent;
|
use App\Event\DocumentUploadedEvent;
|
||||||
use App\Model\EmailAttachmentDto;
|
use App\Model\EmailAttachmentDto;
|
||||||
@@ -32,6 +33,7 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
|||||||
DocumentRejectedEvent::NAME => 'onDocumentRejected',
|
DocumentRejectedEvent::NAME => 'onDocumentRejected',
|
||||||
ApplicationStatusEvent::NAME => 'onApplicationStatus',
|
ApplicationStatusEvent::NAME => 'onApplicationStatus',
|
||||||
AssignmentCalledOffEvent::NAME => 'onAssignmentCalledOff',
|
AssignmentCalledOffEvent::NAME => 'onAssignmentCalledOff',
|
||||||
|
DocumentConfirmedEvent::NAME => 'onDocumentConfirmed',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +66,34 @@ class EmailNotificationSubscriber implements EventSubscriberInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onDocumentConfirmed(DocumentConfirmedEvent $event): void
|
||||||
|
{
|
||||||
|
$document = $event->getDocument();
|
||||||
|
|
||||||
|
if (Upload::TYPE_CONTRACT !== $document->getType()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$disposition = $document->getDisposition();
|
||||||
|
$teamer = $disposition->getTeamer();
|
||||||
|
$assignment = $disposition->getAssignment();
|
||||||
|
$destination = $assignment->getDestination();
|
||||||
|
|
||||||
|
$dueDate = (new \DateTimeImmutable())->modify('+5 days');
|
||||||
|
|
||||||
|
if ($destination->getDateFrom() > $dueDate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mailer->createAndSendEmail([
|
||||||
|
'disposition' => $disposition,
|
||||||
|
], [
|
||||||
|
'to' => $teamer->getCommunication()->getEmail(),
|
||||||
|
'subject' => 'Reminder: Dein Einsatz '.$destination,
|
||||||
|
'template' => 'email/reminder_pre_disposition.html.twig',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify managers about uploaded documents
|
* Notify managers about uploaded documents
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user