mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
controller with crud logic + templates fixed for dispositif
This commit is contained in:
parent
adca4f0d6a
commit
28c986fddf
@ -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,
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ class ChillJobExtension extends Extension implements PrependExtensionInterface
|
||||
[
|
||||
'class' => CSPerson::class,
|
||||
'controller' => CSPersonController::class,
|
||||
'name' => 'admin_personal_situation',
|
||||
'name' => 'job',
|
||||
'base_role' => 'ROLE_USER',
|
||||
'base_path' => '/person/job/',
|
||||
/* 'form_class' => CSPersonPersonalSituationType::class,
|
||||
|
@ -1186,7 +1186,7 @@ class CSPerson
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateContratIEJ(): \DateTimeInterface
|
||||
public function getDateContratIEJ(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateContratIEJ;
|
||||
}
|
||||
@ -1210,7 +1210,7 @@ class CSPerson
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAvenantIEJ(): \DateTimeInterface
|
||||
public function getDateAvenantIEJ(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateAvenantIEJ;
|
||||
}
|
||||
|
@ -92,9 +92,9 @@ class CSPersonDispositifsType extends AbstractType
|
||||
])
|
||||
->add('prescripteur', PickThirdpartyDynamicType::class, [
|
||||
'required' => false,
|
||||
'types' => ['prescripteur'],
|
||||
// 'types' => ['prescripteur'],
|
||||
'label' => 'Prescripteur',
|
||||
'center' => $options['center'],
|
||||
// 'center' => $options['center'],
|
||||
])
|
||||
->add('dispositifsNotes', TextareaType::class, [
|
||||
'required' => false,
|
||||
|
@ -149,8 +149,8 @@ class CSPersonPersonalSituationType extends AbstractType
|
||||
'choice_label' => fn ($k) => 'handicap_recommandation.'.$k,
|
||||
])
|
||||
->add('handicapAccompagnement', PickThirdpartyDynamicType::class, [
|
||||
'center' => $options['center'],
|
||||
'types' => ['prescripteur'],
|
||||
// 'center' => $options['center'],
|
||||
// 'types' => ['prescripteur'],
|
||||
'required' => false,
|
||||
'multiple' => false,
|
||||
])
|
||||
|
@ -35,7 +35,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
// if ($this->authorizationChecker->isGranted(CSConnectesVoter::REPORT_NEW, $person)) {
|
||||
$menu->addChild('Situation personnelle', [
|
||||
'route' => 'chill_job_personal_situation_view',
|
||||
'route' => 'chill_crud_job_personal_situation_view',
|
||||
'routeParameters' => [
|
||||
'person' => $person->getId(),
|
||||
],
|
||||
@ -44,7 +44,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
|
||||
'order' => 50,
|
||||
]);
|
||||
$menu->addChild('Dispositifs', [
|
||||
'route' => 'chill_job_dispositifs_view',
|
||||
'route' => 'chill_crud_job_dispositifs_view',
|
||||
'routeParameters' => [
|
||||
'person' => $person->getId(),
|
||||
],
|
||||
|
@ -1,5 +1,9 @@
|
||||
{% extends '@ChillPerson/CRUD/edit.html.twig' %}
|
||||
|
||||
{% block css %}
|
||||
{{ encore_entry_link_tags('mod_pickentity_type') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block title 'Dispositifs de ' ~ entity.person.firstName ~ ' ' ~ entity.person.lastName %}
|
||||
|
||||
{% block personcontent %}
|
||||
@ -84,6 +88,7 @@
|
||||
|
||||
{% block js %}
|
||||
{{ parent() }}
|
||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||
<script type="text/javascript" src="{{ asset('build/dispositifs_edit.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
{% extends "ChillPersonBundle::layout.html.twig" %}
|
||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||
|
||||
{% set person = entity.getPerson() %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
{% set accompagnements = constant('CSConnectes\\SPBundle\\Entity\\CSPerson::ACCOMPAGNEMENTS') %}
|
||||
{% set accompagnements = constant('Chill\\JobBundle\\Entity\\CSPerson::ACCOMPAGNEMENTS') %}
|
||||
|
||||
|
||||
{% import '@ChillDocStore/Macro/macro.html.twig' as doc %}
|
||||
@ -116,10 +116,12 @@
|
||||
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li><a class="sc-button bt-update" href="{{ path('chill_crud_csperson_dispositifs_edit', { 'id': entity.person.id }) }}">Modifier</a></li>
|
||||
<li>
|
||||
<a class="btn btn-update" href="{{ path('chill_crud_job_dispositifs_edit', { 'id': entity.person.id }) }}">Modifier</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endblock personcontent %}
|
||||
{% endblock content %}
|
||||
|
||||
{% block css %}
|
||||
<link rel="stylesheet" href="{{ asset('build/thirdparty_styles.css') }}"/>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% set formId = crudMainFormId|default('crud_main_form') %}
|
||||
|
||||
|
||||
{% block crud_content_header %}
|
||||
<h1 class="mb-5">{{ ('crud.'~crud_name~'.title_edit')|trans }}</h1>
|
||||
{% endblock crud_content_header %}
|
||||
@ -21,9 +21,9 @@
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
{% block content_form_actions_back %}
|
||||
<li class="cancel">
|
||||
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">
|
||||
{{ 'Cancel'|trans }}
|
||||
</a>
|
||||
{# <a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">#}
|
||||
{# {{ 'Cancel'|trans }}#}
|
||||
{# </a>#}
|
||||
</li>
|
||||
{% endblock %}
|
||||
{% block content_form_actions_before %}{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user