diff --git a/src/Controller/Admin/EcheancierController.php b/src/Controller/Admin/EcheancierController.php index d7812b3..10477b1 100644 --- a/src/Controller/Admin/EcheancierController.php +++ b/src/Controller/Admin/EcheancierController.php @@ -294,10 +294,15 @@ class EcheancierController extends AbstractController $slug = $docuSeal->getSubmitterSlug($submitterId); $signUrl = null !== $slug ? rtrim($docuSealUrl, '/').'/s/'.$slug : null; + $processUrl = $urlGenerator->generate('app_echeancier_process', [ + 'id' => $echeancier->getId(), + ], UrlGeneratorInterface::ABSOLUTE_URL); + $html = $twig->render('emails/echeancier_signature.html.twig', [ 'customer' => $customer, 'echeancier' => $echeancier, 'signUrl' => $signUrl, + 'processUrl' => $processUrl, ]); $mailer->sendEmail( diff --git a/src/Controller/EcheancierProcessController.php b/src/Controller/EcheancierProcessController.php index aff9f05..cf44d7f 100644 --- a/src/Controller/EcheancierProcessController.php +++ b/src/Controller/EcheancierProcessController.php @@ -15,6 +15,30 @@ class EcheancierProcessController extends AbstractController ) { } + /** + * Page de detail echeancier avant signature (publique). + */ + #[Route('/echeancier/process/{id}', name: 'app_echeancier_process', requirements: ['id' => '\d+'])] + public function process(int $id): Response + { + $echeancier = $this->em->getRepository(Echeancier::class)->find($id); + if (null === $echeancier) { + throw $this->createNotFoundException('Echeancier introuvable.'); + } + + if (\in_array($echeancier->getState(), [Echeancier::STATE_SIGNED, Echeancier::STATE_ACTIVE, Echeancier::STATE_COMPLETED], true)) { + return $this->render('echeancier/signed.html.twig', [ + 'echeancier' => $echeancier, + 'customer' => $echeancier->getCustomer(), + ]); + } + + return $this->render('echeancier/process.html.twig', [ + 'echeancier' => $echeancier, + 'customer' => $echeancier->getCustomer(), + ]); + } + /** * Callback DocuSeal apres signature du client. */ diff --git a/templates/admin/echeancier/show.html.twig b/templates/admin/echeancier/show.html.twig index 8b0f56e..280b9a1 100644 --- a/templates/admin/echeancier/show.html.twig +++ b/templates/admin/echeancier/show.html.twig @@ -84,19 +84,9 @@ Voir PDF {% endif %} - {% if echeancier.state == 'draft' and echeancier.pdfUnsigned %} -
- {% endif %} {% if echeancier.state in ['draft', 'send'] and echeancier.pdfUnsigned %} - - {% endif %} - {% if echeancier.state == 'send' %} - {% endif %} {% if echeancier.state == 'signed' %} diff --git a/templates/echeancier/process.html.twig b/templates/echeancier/process.html.twig new file mode 100644 index 0000000..4bf241a --- /dev/null +++ b/templates/echeancier/process.html.twig @@ -0,0 +1,87 @@ +{% extends 'base.html.twig' %} + +{% block title %}Echeancier de paiement - Association E-Cosplay{% endblock %} + +{% block body %} +
+ Association E-Cosplay
++ {% if customer.raisonSociale %}Chez {{ customer.raisonSociale }}{% else %}Bonjour {{ customer.firstName }}{% endif %}, + veuillez trouver ci-dessous le detail de votre echeancier de paiement. +
+ + {# Motif #} +{{ echeancier.description }}
+Total HT
+{{ echeancier.totalAmountHt|number_format(2, ',', ' ') }} €
+Echeances
+{{ echeancier.nbLines }} mois
+Mensualite
+{{ echeancier.monthlyAmount|number_format(2, ',', ' ') }} €
+| N | +Date prevue | +Montant | +
|---|---|---|
| {{ line.position }} | +{{ line.scheduledAt|date('d/m/Y') }} | +{{ line.amount|number_format(2, ',', ' ') }} € | +
Conditions
+1. Le prelevement sera effectue automatiquement a chaque date prevue via Stripe.
+2. En cas d'echec de prelevement, une relance sera envoyee par email.
+3. Apres 2 echecs consecutifs, l'echeancier sera considere en defaut.
+4. Majoration de 5% du montant total conformement aux CGV (article 11).
++ En signant ce document, vous autorisez le prelevement automatique mensuel du montant indique. +
+ ++ Pour toute question : contact@e-cosplay.fr +
+| + Voir les details + | +
| Signer l'echeancier |