Page process contrat avec :
- Header avec reference et type
- Statut (signe/annule)
- Infos association (SIRET, RNA, president, contact)
- Infos client (raison sociale, email)
- Tableau services inclus avec total HT/mois
- Conditions importantes (paiement, impayes, avertissements)
- Liens utiles (page migration, tarifs, CGV)
- Bouton "Signer le contrat" (redirige vers DocuSeal)
- Contact
Controller ContratProcessController :
- /process/contrat/{id} : page de detail
- /process/contrat/{id}/sign : redirection vers DocuSeal
Email contrat_signature : lien vers /process/contrat/{id}
au lieu du lien DocuSeal direct
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
50 lines
1.7 KiB
PHP
50 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Entity\Contrat;
|
|
use App\Service\DocuSealService;
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
|
|
class ContratProcessController extends AbstractController
|
|
{
|
|
#[Route('/process/contrat/{id}', name: 'app_contrat_process', requirements: ['id' => '\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.');
|
|
}
|
|
}
|