controller with crud logic + templates fixed for dispositif

This commit is contained in:
2024-04-24 14:52:19 +02:00
parent adca4f0d6a
commit 28c986fddf
9 changed files with 33 additions and 24 deletions

View File

@@ -22,6 +22,7 @@ use Symfony\Component\Routing\Annotation\Route;
class CSPersonController extends OneToOneEntityPersonCRUDController
{
#[Route(path: '{_locale}/person/job/personal_situation/{id}/edit', name: 'chill_crud_job_personal_situation_edit')]
public function personalSituationEdit(Request $request, $id): Response
{
return $this->formEditAction(
@@ -32,6 +33,7 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
);
}
#[Route(path: '{_locale}/person/job/dispositifs/{id}/edit', name: 'chill_crud_job_dispositifs_edit')]
public function dispositifsEdit(Request $request, $id)
{
return $this->formEditAction(
@@ -42,13 +44,13 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
);
}
#[Route(path: '{_locale}/person/job/{person}/personal_situation', name: 'chill_job_personal_situation_view')]
#[Route(path: '{_locale}/person/job/{person}/personal_situation', name: 'chill_crud_job_personal_situation_view')]
public function personalSituationView(Request $request, $person): Response
{
return $this->viewAction('ps_situation_view', $request, $person);
}
#[Route(path: '{_locale}/person/job/{person}/dispositifs', name: 'chill_job_dispositifs_view')]
#[Route(path: '{_locale}/person/job/{person}/dispositifs', name: 'chill_crud_job_dispositifs_view')]
public function dispositifsView(Request $request, $person): Response
{
return $this->viewAction('dispositifs_view', $request, $person);
@@ -60,10 +62,10 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
switch ($action) {
case 'ps_situation_view':
$route = 'chill_crud_csperson_personal_situation_edit';
$route = 'chill_crud_job_personal_situation_edit';
break;
case 'dispositifs_view':
$route = 'chill_crud_csperson_dispositifs_edit';
$route = 'chill_crud_job_dispositifs_edit';
break;
default:
parent::generateRedirectOnCreateRoute($action, $request, $entity);
@@ -91,12 +93,12 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
{
return match ($action) {
'ps_situation_edit' => $this->redirectToRoute(
'chill_crud_'.$this->getCrudName().'_personal_situation_view',
['id' => $entity->getId()]
'chill_crud_' .$this->getCrudName().'_personal_situation_view',
['person' => $entity->getId()]
),
'dispositifs_edit' => $this->redirectToRoute(
'chill_crud_'.$this->getCrudName().'_dispositifs_view',
['id' => $entity->getId()]
['person' => $entity->getId()]
),
default => null,
};