feat: email notifications about uploaded invoices to management

This commit is contained in:
Björn Fromme
2024-04-04 15:08:52 +02:00
parent ffc33cebc5
commit 8d0babba14
5 changed files with 100 additions and 3 deletions
@@ -6,6 +6,7 @@ use App\Controller\Traits\ReturnUrlTrait;
use App\Entity\Disposition;
use App\Entity\Upload;
use App\Entity\User;
use App\Event\DocumentUploadedEvent;
use App\Form\TeamerDispositionType;
use App\Model\UploadSessionDto;
use App\Service\Upload\UploadHandler;
@@ -18,6 +19,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Workflow\WorkflowInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
class DetailController extends AbstractController
{
@@ -28,6 +30,7 @@ class DetailController extends AbstractController
private readonly EntityManagerInterface $entityManager,
#[Target('disposition')]
private readonly WorkflowInterface $workflow,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly LoggerInterface $logger
) {
}
@@ -63,7 +66,7 @@ class DetailController extends AbstractController
return $this->render('teamer/disposition/detail.html.twig', [
'disposition' => $disposition,
'form' => $form,
'form' => $form->createView(),
'returnUrl' => $this->getReturnUrl($request, 'app_teamer_index'),
]);
}
@@ -93,6 +96,8 @@ class DetailController extends AbstractController
$this->logger->info('Upload contract', [
'user' => $user->getUserIdentifier(),
]);
$this->eventDispatcher->dispatch(new DocumentUploadedEvent($upload), DocumentUploadedEvent::NAME);
}
private function uploadInvoice(Disposition $disposition, UploadSessionDto $uploadSession): void
@@ -120,5 +125,7 @@ class DetailController extends AbstractController
$this->logger->info('Upload invoice', [
'user' => $user->getUserIdentifier(),
]);
$this->eventDispatcher->dispatch(new DocumentUploadedEvent($upload), DocumentUploadedEvent::NAME);
}
}