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 %} +
+ + {# Header #} +
+
+
+ E-Cosplay +
+

Contrat de Service

+

{{ contrat.reference }} - {{ contrat.typeLabel }}

+
+
+
+
+ +
+ + {# Statut #} + {% if contrat.state == 'signed' %} +
+ + + +
+

Contrat signe

+

Ce contrat a ete signe le {{ contrat.signedAt ? contrat.signedAt|date('d/m/Y H:i') : '' }}.

+
+
+ {% elseif contrat.state == 'cancelled' %} +
+ + + +
+

Contrat annule

+

Ce contrat a ete annule.

+
+
+ {% endif %} + + {# Informations du contrat #} +
+

Informations

+
+
+

Association E-Cosplay

+
+

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

+
+
+
+

Client

+
+

{{ contrat.raisonSociale }}

+

{{ contrat.email }}

+
+
+
+
+ + {# Services #} + {% if contrat.services|length > 0 %} +
+

Services inclus

+
+ + + + + + + + + + + {% set catalogLabels = { + 'esite_vitrine': 'E-Site Vitrine', + 'esite_ecommerce': 'E-Site E-Commerce', + 'esite_hors_cms': 'Site hors CMS Esy-Web', + 'email_3go': 'E-Mail 3 Go', + 'email_50go': 'E-Mail 50 Go', + 'ndd_gestion': 'Nom de domaine - Gestion', + 'ndd_renouvellement': 'Nom de domaine - Renouvellement', + 'eprotect': 'E-Protect Pro', + 'ecalendar': 'E-Calendar', + 'echat': 'E-Chat', + 'emailer': 'E-Mailer' + } %} + {% for s in contrat.services %} + + + + + + + {% endfor %} + + + + + + + +
ServiceQuantitePrix HTSous-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, ',', ' ') }} €
+
+
+ {% endif %} + + {# Conditions importantes #} +
+

Conditions importantes

+
+
+

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.

+
+
+
+ + {# Liens utiles #} + + + {# Bouton signer #} + {% if contrat.state == 'send' and contrat.submissionId %} +
+

En signant ce contrat, vous acceptez les conditions ci-dessus, les CGV et la grille tarifaire de l'Association E-Cosplay.

+ + Signer le contrat + +
+ {% endif %} + + {# Contact #} +
+

Une question sur ce contrat ?

+

+ client@e-cosplay.fr +

+

Tel : 07 66 95 70 06

+
+
+
+{% endblock %} diff --git a/templates/emails/contrat_signature.html.twig b/templates/emails/contrat_signature.html.twig index dd0eec5..c7187ec 100644 --- a/templates/emails/contrat_signature.html.twig +++ b/templates/emails/contrat_signature.html.twig @@ -33,14 +33,14 @@ - {% if signUrl %} + {% if processUrl is defined and processUrl %}

- 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