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
@@ -3,9 +3,11 @@
namespace App\Controller\Admin\System\JobProfile;
use App\Entity\JobProfile;
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;
@@ -18,19 +20,25 @@ class DeleteController extends AbstractController
) {
}
#[Route('/admin/system/job-profile/delete/{id}', name: 'app_admin_system_job_profile_delete', methods: ['POST'])]
#[Route('/admin/system/job-profile/delete/{id}', name: 'app_admin_system_job_profile_delete')]
#[IsGranted('ROLE_ADMIN')]
public function index(JobProfile $jobProfile): Response
public function index(JobProfile $jobProfile, Request $request): Response
{
$jobProfile->setDeleted();
$this->entityManager->flush();
if (true === $request->isMethod('POST')) {
$jobProfile->setDeleted();
$this->entityManager->flush();
$this->addFlash('success', 'Das Job-Profil wurde gelöscht');
$this->logger->info('Delete job-profile', [
'job_profile_id' => $jobProfile->getId(),
'job_profile_name' => $jobProfile->getName(),
$this->addFlash('success', 'Das Job-Profil wurde gelöscht');
$this->logger->info('Delete job-profile', [
'job_profile_id' => $jobProfile->getId(),
'job_profile_name' => $jobProfile->getName(),
]);
return new HxRedirectResponse($this->generateUrl('app_admin_system_job_profile_index'));
}
return $this->render('admin/system/job_profile/modal_delete.html.twig', [
'jobProfile' => $jobProfile,
]);
return $this->redirectToRoute('app_admin_system_job_profile_index');
}
}