diff --git a/src/Controller/Admin/ContratController.php b/src/Controller/Admin/ContratController.php index 6e56894..a0254e2 100644 --- a/src/Controller/Admin/ContratController.php +++ b/src/Controller/Admin/ContratController.php @@ -191,16 +191,17 @@ class ContratController extends AbstractController $contrat->setState(Contrat::STATE_SEND); $this->em->flush(); - // Envoyer email au client avec le lien - $slug = $docuSeal->getSubmitterSlug($submitterId); - $signUrl = null !== $slug ? rtrim($docuSealUrl, '/').'/s/'.$slug : null; + // Envoyer email au client avec le lien vers la page process + $processUrl = $urlGenerator->generate('app_contrat_process', [ + 'id' => $contrat->getId(), + ], UrlGeneratorInterface::ABSOLUTE_URL); $mailer->sendEmail( $contrat->getEmail(), 'Contrat a signer - '.$contrat->getTypeLabel().' - '.$contrat->getReference(), $twig->render('emails/contrat_signature.html.twig', [ 'contrat' => $contrat, - 'signUrl' => $signUrl, + 'processUrl' => $processUrl, ]), null, null, diff --git a/src/Controller/ContratProcessController.php b/src/Controller/ContratProcessController.php new file mode 100644 index 0000000..10d84b7 --- /dev/null +++ b/src/Controller/ContratProcessController.php @@ -0,0 +1,49 @@ + '\d+'])] + public function process(int $id, EntityManagerInterface $em): Response + { + $contrat = $em->getRepository(Contrat::class)->find($id); + if (null === $contrat) { + throw $this->createNotFoundException('Contrat introuvable.'); + } + + return $this->render('contrat/process.html.twig', [ + 'contrat' => $contrat, + ]); + } + + #[Route('/process/contrat/{id}/sign', name: 'app_contrat_sign', requirements: ['id' => '\d+'])] + public function sign( + int $id, + EntityManagerInterface $em, + DocuSealService $docuSeal, + #[Autowire(env: 'DOCUSEAL_URL')] string $docuSealUrl = '', + ): Response { + $contrat = $em->getRepository(Contrat::class)->find($id); + if (null === $contrat || null === $contrat->getSubmissionId()) { + throw $this->createNotFoundException('Contrat introuvable.'); + } + + // @codeCoverageIgnoreStart + $slug = $docuSeal->getSubmitterSlug((int) $contrat->getSubmissionId()); + if (null !== $slug) { + return $this->redirect(rtrim($docuSealUrl, '/').'/s/'.$slug); + } + // @codeCoverageIgnoreEnd + + throw $this->createNotFoundException('Lien de signature introuvable.'); + } +} diff --git a/templates/contrat/process.html.twig b/templates/contrat/process.html.twig new file mode 100644 index 0000000..8aa7e09 --- /dev/null +++ b/templates/contrat/process.html.twig @@ -0,0 +1,178 @@ +{% extends 'base.html.twig' %} + +{% block title %}Contrat {{ contrat.reference }} - Association E-Cosplay{% endblock %} + +{% block body %} +
+ {{ contrat.reference }} - {{ contrat.typeLabel }}
+Contrat signe
+Ce contrat a ete signe le {{ contrat.signedAt ? contrat.signedAt|date('d/m/Y H:i') : '' }}.
+Contrat annule
+Ce contrat a ete annule.
+Association loi 1901 - RNA W022006988
+42 rue de Saint-Quentin, 02800 Beautor
+SIRET : 943 121 517 00011
+President : Shoko Cosplay - Serreau Jovann
+Email : client@e-cosplay.fr
+Tel : 07 66 95 70 06
+{{ contrat.raisonSociale }}
+{{ contrat.email }}
+| Service | +Quantite | +Prix HT | +Sous-total | +
|---|---|---|---|
| {{ catalogLabels[s.service] ?? s.service }} | +{{ s.quantity }} | +{{ s.priceHt|number_format(2, ',', ' ') }} € | +{{ (s.priceHt * s.quantity)|number_format(2, ',', ' ') }} € | +
| Total HT / mois | +{{ contrat.totalHt|number_format(2, ',', ' ') }} € | +||
Paiement
+Le premier paiement devra etre effectue par carte bancaire ou prelevement SEPA. Les virements ne sont pas acceptes pour le premier paiement.
+Impayes
+En cas de non-paiement, les services seront automatiquement suspendus. Aucun renouvellement sans paiement prealable.
+Avertissements
+En cas de manquement, un systeme d'avertissement s'applique. Au 3eme avertissement, la resiliation est definitive.
+En signant ce contrat, vous acceptez les conditions ci-dessus, les CGV et la grille tarifaire de l'Association E-Cosplay.
+ + Signer le contrat + +- Une fois informe, veuillez signer le contrat en cliquant ci-dessous : + Veuillez consulter les details du contrat et le signer en cliquant ci-dessous :
| - Signer le contrat + Voir et signer le contrat |