feat: keep rejected applications visible, enable deletion for admins
This commit is contained in:
@@ -4,8 +4,10 @@ namespace App\Controller\Admin\Application;
|
||||
|
||||
use App\Entity\Application;
|
||||
use App\Event\ApplicationDeletedEvent;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
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;
|
||||
@@ -22,20 +24,26 @@ class DeleteController extends AbstractController
|
||||
#[Route('/admin/application/delete/{uuid}', name: 'app_admin_application_delete')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
#[IsGranted('DELETE', subject: 'application')]
|
||||
public function index(Application $application): Response
|
||||
public function index(Application $application, Request $request): Response
|
||||
{
|
||||
$this->entityManager->remove($application);
|
||||
$this->entityManager->flush();
|
||||
if (true === $request->isMethod(Request::METHOD_POST)) {
|
||||
$this->entityManager->remove($application);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->eventDispatcher->dispatch(
|
||||
new ApplicationDeletedEvent($application),
|
||||
ApplicationDeletedEvent::NAME
|
||||
);
|
||||
$this->eventDispatcher->dispatch(
|
||||
new ApplicationDeletedEvent($application),
|
||||
ApplicationDeletedEvent::NAME
|
||||
);
|
||||
|
||||
$this->addFlash('success', 'Die Bewerbung wurde gelöscht');
|
||||
$this->addFlash('success', 'Die Bewerbung wurde gelöscht');
|
||||
|
||||
return $this->redirectToRoute('app_administrative_assignment_detail', [
|
||||
'uuid' => $application->getAssignment()->getUuid(),
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_assignment_detail', [
|
||||
'uuid' => $application->getAssignment()->getUuid(),
|
||||
]));
|
||||
}
|
||||
|
||||
return $this->render('admin/application/modal_delete.html.twig', [
|
||||
'application' => $application,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user