mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +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
|
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
|
public function personalSituationEdit(Request $request, $id): Response
|
||||||
{
|
{
|
||||||
return $this->formEditAction(
|
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)
|
public function dispositifsEdit(Request $request, $id)
|
||||||
{
|
{
|
||||||
return $this->formEditAction(
|
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
|
public function personalSituationView(Request $request, $person): Response
|
||||||
{
|
{
|
||||||
return $this->viewAction('ps_situation_view', $request, $person);
|
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
|
public function dispositifsView(Request $request, $person): Response
|
||||||
{
|
{
|
||||||
return $this->viewAction('dispositifs_view', $request, $person);
|
return $this->viewAction('dispositifs_view', $request, $person);
|
||||||
@ -60,10 +62,10 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
|
|||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'ps_situation_view':
|
case 'ps_situation_view':
|
||||||
$route = 'chill_crud_csperson_personal_situation_edit';
|
$route = 'chill_crud_job_personal_situation_edit';
|
||||||
break;
|
break;
|
||||||
case 'dispositifs_view':
|
case 'dispositifs_view':
|
||||||
$route = 'chill_crud_csperson_dispositifs_edit';
|
$route = 'chill_crud_job_dispositifs_edit';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
parent::generateRedirectOnCreateRoute($action, $request, $entity);
|
parent::generateRedirectOnCreateRoute($action, $request, $entity);
|
||||||
@ -91,12 +93,12 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
|
|||||||
{
|
{
|
||||||
return match ($action) {
|
return match ($action) {
|
||||||
'ps_situation_edit' => $this->redirectToRoute(
|
'ps_situation_edit' => $this->redirectToRoute(
|
||||||
'chill_crud_'.$this->getCrudName().'_personal_situation_view',
|
'chill_crud_' .$this->getCrudName().'_personal_situation_view',
|
||||||
['id' => $entity->getId()]
|
['person' => $entity->getId()]
|
||||||
),
|
),
|
||||||
'dispositifs_edit' => $this->redirectToRoute(
|
'dispositifs_edit' => $this->redirectToRoute(
|
||||||
'chill_crud_'.$this->getCrudName().'_dispositifs_view',
|
'chill_crud_'.$this->getCrudName().'_dispositifs_view',
|
||||||
['id' => $entity->getId()]
|
['person' => $entity->getId()]
|
||||||
),
|
),
|
||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,7 @@ class ChillJobExtension extends Extension implements PrependExtensionInterface
|
|||||||
[
|
[
|
||||||
'class' => CSPerson::class,
|
'class' => CSPerson::class,
|
||||||
'controller' => CSPersonController::class,
|
'controller' => CSPersonController::class,
|
||||||
'name' => 'admin_personal_situation',
|
'name' => 'job',
|
||||||
'base_role' => 'ROLE_USER',
|
'base_role' => 'ROLE_USER',
|
||||||
'base_path' => '/person/job/',
|
'base_path' => '/person/job/',
|
||||||
/* 'form_class' => CSPersonPersonalSituationType::class,
|
/* 'form_class' => CSPersonPersonalSituationType::class,
|
||||||
|
@ -1186,7 +1186,7 @@ class CSPerson
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDateContratIEJ(): \DateTimeInterface
|
public function getDateContratIEJ(): ?\DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->dateContratIEJ;
|
return $this->dateContratIEJ;
|
||||||
}
|
}
|
||||||
@ -1210,7 +1210,7 @@ class CSPerson
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDateAvenantIEJ(): \DateTimeInterface
|
public function getDateAvenantIEJ(): ?\DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->dateAvenantIEJ;
|
return $this->dateAvenantIEJ;
|
||||||
}
|
}
|
||||||
|
@ -92,9 +92,9 @@ class CSPersonDispositifsType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('prescripteur', PickThirdpartyDynamicType::class, [
|
->add('prescripteur', PickThirdpartyDynamicType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'types' => ['prescripteur'],
|
// 'types' => ['prescripteur'],
|
||||||
'label' => 'Prescripteur',
|
'label' => 'Prescripteur',
|
||||||
'center' => $options['center'],
|
// 'center' => $options['center'],
|
||||||
])
|
])
|
||||||
->add('dispositifsNotes', TextareaType::class, [
|
->add('dispositifsNotes', TextareaType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
@ -149,8 +149,8 @@ class CSPersonPersonalSituationType extends AbstractType
|
|||||||
'choice_label' => fn ($k) => 'handicap_recommandation.'.$k,
|
'choice_label' => fn ($k) => 'handicap_recommandation.'.$k,
|
||||||
])
|
])
|
||||||
->add('handicapAccompagnement', PickThirdpartyDynamicType::class, [
|
->add('handicapAccompagnement', PickThirdpartyDynamicType::class, [
|
||||||
'center' => $options['center'],
|
// 'center' => $options['center'],
|
||||||
'types' => ['prescripteur'],
|
// 'types' => ['prescripteur'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'multiple' => false,
|
'multiple' => false,
|
||||||
])
|
])
|
||||||
|
@ -35,7 +35,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
|
|||||||
|
|
||||||
// if ($this->authorizationChecker->isGranted(CSConnectesVoter::REPORT_NEW, $person)) {
|
// if ($this->authorizationChecker->isGranted(CSConnectesVoter::REPORT_NEW, $person)) {
|
||||||
$menu->addChild('Situation personnelle', [
|
$menu->addChild('Situation personnelle', [
|
||||||
'route' => 'chill_job_personal_situation_view',
|
'route' => 'chill_crud_job_personal_situation_view',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'person' => $person->getId(),
|
'person' => $person->getId(),
|
||||||
],
|
],
|
||||||
@ -44,7 +44,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'order' => 50,
|
'order' => 50,
|
||||||
]);
|
]);
|
||||||
$menu->addChild('Dispositifs', [
|
$menu->addChild('Dispositifs', [
|
||||||
'route' => 'chill_job_dispositifs_view',
|
'route' => 'chill_crud_job_dispositifs_view',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'person' => $person->getId(),
|
'person' => $person->getId(),
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
{% extends '@ChillPerson/CRUD/edit.html.twig' %}
|
{% 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 title 'Dispositifs de ' ~ entity.person.firstName ~ ' ' ~ entity.person.lastName %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
@ -84,6 +88,7 @@
|
|||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
|
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||||
<script type="text/javascript" src="{{ asset('build/dispositifs_edit.js') }}"></script>
|
<script type="text/javascript" src="{{ asset('build/dispositifs_edit.js') }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{% extends "ChillPersonBundle::layout.html.twig" %}
|
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||||
|
|
||||||
{% set person = entity.getPerson() %}
|
{% set person = entity.getPerson() %}
|
||||||
|
|
||||||
{% set activeRouteKey = '' %}
|
{% 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 %}
|
{% import '@ChillDocStore/Macro/macro.html.twig' as doc %}
|
||||||
@ -116,10 +116,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<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>
|
</ul>
|
||||||
|
|
||||||
{% endblock personcontent %}
|
{% endblock content %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
<link rel="stylesheet" href="{{ asset('build/thirdparty_styles.css') }}"/>
|
<link rel="stylesheet" href="{{ asset('build/thirdparty_styles.css') }}"/>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% set formId = crudMainFormId|default('crud_main_form') %}
|
{% set formId = crudMainFormId|default('crud_main_form') %}
|
||||||
|
|
||||||
{% block crud_content_header %}
|
{% block crud_content_header %}
|
||||||
<h1 class="mb-5">{{ ('crud.'~crud_name~'.title_edit')|trans }}</h1>
|
<h1 class="mb-5">{{ ('crud.'~crud_name~'.title_edit')|trans }}</h1>
|
||||||
{% endblock crud_content_header %}
|
{% endblock crud_content_header %}
|
||||||
@ -21,9 +21,9 @@
|
|||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
{% block content_form_actions_back %}
|
{% block content_form_actions_back %}
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">
|
{# <a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">#}
|
||||||
{{ 'Cancel'|trans }}
|
{# {{ 'Cancel'|trans }}#}
|
||||||
</a>
|
{# </a>#}
|
||||||
</li>
|
</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content_form_actions_before %}{% endblock %}
|
{% block content_form_actions_before %}{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user