feat: integrate with htmx

This commit is contained in:
Björn Fromme
2024-02-07 10:15:59 +01:00
parent 4d1799ca49
commit 1e572606f8
154 changed files with 1447 additions and 1461 deletions
@@ -5,9 +5,11 @@ namespace App\Controller\Admin\Application;
use App\Entity\Application;
use App\Entity\Disposition;
use App\Event\DispositionCreatedEvent;
use App\Htmx\HxRedirectResponse;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
@@ -25,24 +27,32 @@ class DisposeController extends AbstractController
#[Route('/admin/application/dispose/{uuid}', name: 'app_admin_application_dispose')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted('DISPOSE', subject: 'application')]
public function index(Application $application): Response
public function index(Application $application, Request $request): Response
{
$disposition = new Disposition($application);
if (true === $request->isMethod('POST')) {
$disposition = new Disposition($application);
$this->entityManager->persist($disposition);
$this->entityManager->remove($application);
$this->entityManager->flush();
$this->entityManager->persist($disposition);
$this->entityManager->remove($application);
$this->entityManager->flush();
$this->eventDispatcher->dispatch(new DispositionCreatedEvent($disposition), DispositionCreatedEvent::NAME);
$this->eventDispatcher->dispatch(new DispositionCreatedEvent($disposition), DispositionCreatedEvent::NAME);
$this->addFlash('success', 'Teamer:in wurde eingeteilt');
$this->logger->info('Create disposition', [
'disposition_id' => $disposition->getId(),
'teamer' => (string) $application->getTeamer(),
]);
$this->addFlash('success', 'Teamer:in wurde eingeteilt');
$this->logger->info('Create disposition', [
'disposition_id' => $disposition->getId(),
'teamer' => (string) $application->getTeamer(),
]);
return $this->redirectToRoute('app_admin_assignment_detail', [
'uuid' => $application->getAssignment()->getUuid(),
$redirectUrl = $this->generateUrl('app_admin_assignment_detail', [
'uuid' => $application->getAssignment()->getUuid(),
]);
return new HxRedirectResponse($redirectUrl);
}
return $this->render('admin/application/modal_dispose.html.twig', [
'application' => $application,
]);
}
}