From 2fbdd169df9de567c414f63193efcd8d94b1e3ab Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 5 May 2022 14:37:56 +0200 Subject: [PATCH] admin: add AccompanyingPeriod Origin and closingMotive --- ...roller.php => ClosingMotiveController.php} | 4 +- .../Controller/OriginController.php | 26 ++++++++ .../ChillPersonExtension.php | 27 +++++++- .../ChillPersonBundle/Form/OriginType.php | 39 +++++++++++ .../Menu/AdminMenuBuilder.php | 25 +++++-- .../views/ClosingMotive/edit.html.twig | 15 ++--- .../views/ClosingMotive/index.html.twig | 10 ++- .../views/ClosingMotive/new.html.twig | 15 +++-- .../Resources/views/Origin/edit.html.twig | 11 ++++ .../Resources/views/Origin/index.html.twig | 35 ++++++++++ .../Resources/views/Origin/new.html.twig | 12 ++++ .../ChillPersonBundle/config/routes.yaml | 66 ------------------- .../translations/messages.fr.yml | 11 ++++ 13 files changed, 202 insertions(+), 94 deletions(-) rename src/Bundle/ChillPersonBundle/Controller/{AdminClosingMotiveController.php => ClosingMotiveController.php} (93%) create mode 100644 src/Bundle/ChillPersonBundle/Controller/OriginController.php create mode 100644 src/Bundle/ChillPersonBundle/Form/OriginType.php create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Origin/edit.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Origin/index.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Origin/new.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/AdminClosingMotiveController.php b/src/Bundle/ChillPersonBundle/Controller/ClosingMotiveController.php similarity index 93% rename from src/Bundle/ChillPersonBundle/Controller/AdminClosingMotiveController.php rename to src/Bundle/ChillPersonBundle/Controller/ClosingMotiveController.php index 9eee2c4a0..cf1436b99 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AdminClosingMotiveController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ClosingMotiveController.php @@ -16,10 +16,10 @@ use Chill\MainBundle\Pagination\PaginatorInterface; use Symfony\Component\HttpFoundation\Request; /** - * Class AdminClosingMotiveController + * Class ClosingMotiveController * Controller for closing motives. */ -class AdminClosingMotiveController extends CRUDController +class ClosingMotiveController extends CRUDController { /** * @param \Chill\MainBundle\CRUD\Controller\string|string $action diff --git a/src/Bundle/ChillPersonBundle/Controller/OriginController.php b/src/Bundle/ChillPersonBundle/Controller/OriginController.php new file mode 100644 index 000000000..b7caae3be --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/OriginController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 8dad7e6ff..b29d79e8e 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -146,13 +146,13 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac [ 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class, 'name' => 'closing_motive', - 'base_path' => '/admin/closing-motive', + 'base_path' => '/admin/person/closing-motive', 'form_class' => \Chill\PersonBundle\Form\ClosingMotiveType::class, - 'controller' => \Chill\PersonBundle\Controller\AdminClosingMotiveController::class, + 'controller' => \Chill\PersonBundle\Controller\ClosingMotiveController::class, 'actions' => [ 'index' => [ - 'template' => '@ChillPerson/ClosingMotive/index.html.twig', 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/ClosingMotive/index.html.twig', ], 'new' => [ 'role' => 'ROLE_ADMIN', @@ -164,6 +164,27 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], ], + [ + 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class, + 'name' => 'origin', + 'base_path' => '/admin/person/origin', + 'form_class' => \Chill\PersonBundle\Form\OriginType::class, + 'controller' => \Chill\PersonBundle\Controller\OriginController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Origin/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Origin/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/Origin/edit.html.twig', + ], + ], + ], [ 'class' => \Chill\PersonBundle\Entity\MaritalStatus::class, 'name' => 'person_marital-status', diff --git a/src/Bundle/ChillPersonBundle/Form/OriginType.php b/src/Bundle/ChillPersonBundle/Form/OriginType.php new file mode 100644 index 000000000..a9897de25 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/OriginType.php @@ -0,0 +1,39 @@ +add('label', TranslatableStringFormType::class) + ->add('noActiveAfter', ChillDateType::class, [ + 'required' => false, + 'input' => 'datetime_immutable', + 'label' => 'origin.noActiveAfter' + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', Origin::class); + } +} diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php index 9aa1ae749..1e563df86 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php @@ -45,29 +45,42 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface 'route' => 'chill_crud_person_marital-status_index', ])->setExtras(['order' => 2020]); + + $menu->addChild('person_admin.accompanying_period') + ->setAttribute('class', 'list-group-item-header') + ->setExtras(['order' => 2100, 'header' => true]); + + $menu->addChild('person_admin.closing motives', [ + 'route' => 'chill_crud_closing_motive_index', + ])->setExtras(['order' => 2110]); + + $menu->addChild('person_admin.origin', [ + 'route' => 'chill_crud_origin_index', + ])->setExtras(['order' => 2110]); + $menu->addChild('person_admin.social_work') ->setAttribute('class', 'list-group-item-header') - ->setExtras(['order' => 3000, 'header' => true]); + ->setExtras(['order' => 2200, 'header' => true]); $menu->addChild('person_admin.social_action', [ 'route' => 'chill_crud_social_action_index', - ])->setExtras(['order' => 3001]); + ])->setExtras(['order' => 2201]); $menu->addChild('person_admin.social_issue', [ 'route' => 'chill_crud_social_issue_index', - ])->setExtras(['order' => 3002]); + ])->setExtras(['order' => 2202]); $menu->addChild('person_admin.social_goal', [ 'route' => 'chill_crud_social_goal_index', - ])->setExtras(['order' => 3010]); + ])->setExtras(['order' => 2210]); $menu->addChild('person_admin.social_evaluation', [ 'route' => 'chill_crud_social_evaluation_index', - ])->setExtras(['order' => 3020]); + ])->setExtras(['order' => 2220]); $menu->addChild('person_admin.social_result', [ 'route' => 'chill_crud_social_result_index', - ])->setExtras(['order' => 3030]); + ])->setExtras(['order' => 2230]); } public static function getMenuIds(): array diff --git a/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/edit.html.twig index d132847f2..28678bf6d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/edit.html.twig @@ -1,12 +1,11 @@ -{% extends '@ChillPerson/Admin/layout.html.twig' %} +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} {% block title %} -{% include('@ChillMain/CRUD/_edit_title.html.twig') %} + {% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% endblock %} -{% block layout_wvm_content %} -{% embed '@ChillMain/CRUD/_edit_content.html.twig' %} - {% block content_form_actions_view %}{% endblock %} - {% block content_form_actions_save_and_show %}{% endblock %} -{% endembed %} -{% endblock %} \ No newline at end of file +{% block admin_content %} + {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock admin_content %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/index.html.twig index bdddd6782..6d37a8732 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/index.html.twig @@ -1,6 +1,6 @@ -{% extends '@ChillPerson/Admin/layout.html.twig' %} +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} -{% block layout_wvm_content %} +{% block admin_content %} {% embed '@ChillMain/CRUD/_index.html.twig' %} {% block table_entities_thead_tr %} {{ 'Ordering'|trans }} @@ -36,5 +36,11 @@ {% endfor %} {% endblock %} + + {% block actions_before %} +
  • + {{'Back to the admin'|trans}} +
  • + {% endblock %} {% endembed %} {% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/new.html.twig index cc6021021..3a28dd85f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/new.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/ClosingMotive/new.html.twig @@ -1,11 +1,12 @@ -{% extends '@ChillPerson/Admin/layout.html.twig' %} +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} {% block title %} -{% include('@ChillMain/CRUD/_new_title.html.twig') %} + {% include('@ChillMain/CRUD/_new_title.html.twig') %} {% endblock %} -{% block layout_wvm_content %} -{% embed '@ChillMain/CRUD/_new_content.html.twig' %} - {% block content_form_actions_save_and_show %}{% endblock %} -{% endembed %} -{% endblock %} +{% block admin_content %} + {% embed '@ChillMain/CRUD/_new_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock admin_content %} + diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Origin/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Origin/edit.html.twig new file mode 100644 index 000000000..28678bf6d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Origin/edit.html.twig @@ -0,0 +1,11 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block title %} + {% include('@ChillMain/CRUD/_edit_title.html.twig') %} +{% endblock %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock admin_content %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Origin/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Origin/index.html.twig new file mode 100644 index 000000000..22ec63f09 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Origin/index.html.twig @@ -0,0 +1,35 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + {{ 'Id'|trans }} + {{ 'Label'|trans }} + {{ 'origin.noActiveAfter'|trans }} +   + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + {{ entity.id }} + {{ entity.label|localize_translatable_string }} + {% if entity.noActiveAfter %}{{ entity.noActiveAfter|date('Y-m-d') }}{% endif %} + + + + + {% endfor %} + {% endblock %} + + {% block actions_before %} +
  • + {{'Back to the admin'|trans}} +
  • + {% endblock %} + {% endembed %} +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Origin/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Origin/new.html.twig new file mode 100644 index 000000000..3a28dd85f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Origin/new.html.twig @@ -0,0 +1,12 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block title %} + {% include('@ChillMain/CRUD/_new_title.html.twig') %} +{% endblock %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_new_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock admin_content %} + diff --git a/src/Bundle/ChillPersonBundle/config/routes.yaml b/src/Bundle/ChillPersonBundle/config/routes.yaml index 5d17d6ffe..d437a34d6 100644 --- a/src/Bundle/ChillPersonBundle/config/routes.yaml +++ b/src/Bundle/ChillPersonBundle/config/routes.yaml @@ -125,72 +125,6 @@ chill_person_admin_redirect_to_admin_index: order: 0 label: Main admin menu -chill_person_closingmotive_admin: - path: /{_locale}/admin/closing-motive - controller: cscrud_closing_motive_controller:index - options: - menus: - admin_person: - order: 90 - label: 'person_admin.closing motives' - -chill_person_maritalstatus_admin: - path: /{_locale}/admin/marital-status - controller: cscrud_marital_status_controller:index - options: - menus: - admin_person: - order: 120 - label: 'person_admin.marital status' - -chill_person_socialissue_admin: - path: /{_locale}/admin/social-work/social-issue - controller: cscrud_social_issue_controller:index - options: - menus: - admin_person: - order: 150 - label: 'person_admin.social_issue' - -chill_person_socialaction_admin: - path: /{_locale}/admin/social-work/social-action - controller: cscrud_social_action_controller:index - options: - menus: - admin_person: - order: 160 - label: 'person_admin.social_action' - - -chill_person_social_evaluation_admin: - path: /{_locale}/admin/social-work/evaluation - controller: cscrud_social_evaluation_controller:index - options: - menus: - admin_person: - order: 170 - label: 'person_admin.social_evaluation' - -chill_person_social_goal_admin: - path: /{_locale}/admin/social-work/goal - controller: cscrud_social_goal_controller:index - options: - menus: - admin_person: - order: 180 - label: 'person_admin.social_goal' - -chill_person_social_result_admin: - path: /{_locale}/admin/social-work/result - controller: cscrud_social_result_controller:index - options: - menus: - admin_person: - order: 190 - label: 'person_admin.social_result' - - - chill_person_controllers: resource: "@ChillPersonBundle/Controller" type: annotation diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 4407671e7..92718d1f5 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -372,6 +372,12 @@ crud: add_new: Ajouter un nouveau title_new: Nouveau motif de clotûre title_edit: Modifier le motif de clotûre + origin: + index: + title: Liste des origines de parcours + add_new: Ajouter une nouvelle + title_new: Nouvelle origine + title_edit: Modifier l'origine person_marital-status: index: title: Liste des états civils @@ -410,6 +416,9 @@ crud: title_new: Nouveau résultat title_edit: Modifier le résultat +origin: + noActiveAfter: désactivé après + evaluation: delay: Délai notificationDelay: Délai de notification @@ -428,12 +437,14 @@ closing_motive: Configuration of person bundle: Configuration du module "Personnes" person_admin: + accompanying_period: Parcours d'accompagnement What would you like to configure ?: Que souhaitez-vous configurer ? closing motives: Motifs de clotûre closing motives list: Liste des motifs de clotûre closing motive explanation: > Les motifs de clotûre donnent des indications sur la fermeture d'une période d'accompagnement. + origin: Origines marital status: États civils marital status list: Liste des états civils marital status explanation: >