feat: integrate with htmx
This commit is contained in:
@@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user