feat: special agreements for disposition

This commit is contained in:
Björn Fromme
2024-04-04 13:06:35 +02:00
parent 4d1ea7aad7
commit 26239488ba
19 changed files with 310 additions and 31 deletions
@@ -5,6 +5,7 @@ namespace App\Controller\Admin\Application;
use App\Entity\Application;
use App\Entity\Disposition;
use App\Event\DispositionCreatedEvent;
use App\Form\SpecialAgreementsType;
use App\Htmx\HxRedirectResponse;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
@@ -29,9 +30,11 @@ class DisposeController extends AbstractController
#[IsGranted('DISPOSE', subject: 'application')]
public function index(Application $application, Request $request): Response
{
if (true === $request->isMethod('POST')) {
$disposition = new Disposition($application);
$disposition = new Disposition($application);
$form = $this->createForm(SpecialAgreementsType::class, $disposition, ['hx_post' => $request->getUri()]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->entityManager->persist($disposition);
$this->entityManager->remove($application);
$this->entityManager->flush();
@@ -53,6 +56,7 @@ class DisposeController extends AbstractController
return $this->render('admin/application/modal_dispose.html.twig', [
'application' => $application,
'form' => $form->createView(),
]);
}
}