From d2c631ae208e6c8723424b1a42c2e9baa6c9e115 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 16 Jul 2021 09:52:54 +0200 Subject: [PATCH 001/174] prepare thirdparty index template --- .../Resources/public/sass/thirdparty.scss | 10 +- .../views/ThirdParty/index.html.twig | 149 +++++++++++------- .../translations/messages.fr.yml | 5 +- 3 files changed, 105 insertions(+), 59 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/sass/thirdparty.scss b/src/Bundle/ChillThirdPartyBundle/Resources/public/sass/thirdparty.scss index 952b011ec..c4194a20e 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/sass/thirdparty.scss +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/sass/thirdparty.scss @@ -48,4 +48,12 @@ div.chill_contact { content: '\f095'; } } -} \ No newline at end of file +} +div.thirdparty-list { + label.counter { + float: right; + span { + font-weight: bold; + } + } +} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig index c741dd6c9..12f4560c2 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig @@ -3,64 +3,101 @@ {% block title 'List of third parties'|trans %} {% block content %} -
-

{{ 'List of third parties'|trans }}

- - {% if third_parties|length == 0 %} -

{{ 'No third parties'|trans }}

- {% else %} - - - - - - - - - - - - - {% for tp in third_parties %} - - - - {% set types = [] %} - {% for t in tp.type %} - {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %} - {% endfor %} - - - - {% endfor %} - -
{{ 'Name'|trans }}{{ 'Category'|trans }} 
{{ (tp.active ? '' : '')|raw }}{{ tp.name }}{{ types|join(', ') }} -
    - {% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %} -
  • - -
  • - {% endif %} - {% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %} -
  • - -
  • - {% endif %} -
-
+
+
+
- {% if third_parties|length < pagination.getTotalItems %} - {{ chill_pagination(pagination) }} - {% endif %} +

{{ 'List of third parties'|trans }}

- {% endif %} + {% if third_parties|length == 0 %} +

{{ 'No third parties'|trans }}

+ {% else %} - {% if is_granted('CHILL_3PARTY_3PARTY_CREATE') %} -
+
+
+
+ + + + + + + + + + + + + + + {% for tp in third_parties %} + + + + {% set types = [] %} + {% for t in tp.type %} + {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %} + {% endfor %} + + + + + {% endfor %} + +
{{ 'Name'|trans }} + + {{ 'Category'|trans }} + + {{ 'Address'|trans }} + +
{{ (tp.active ? '' : '')|raw }}{{ tp.name }}{{ types|join(', ') }} + {{ tp.address|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }} + +
    + {% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %} +
  • + +
  • + {% endif %} + {% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %} +
  • + +
  • + {% endif %} +
+
+ + {% if third_parties|length < pagination.getTotalItems %} + {{ chill_pagination(pagination, 'long') }} + {% endif %} + + {% endif %} + + + +
+
{% endblock %} diff --git a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml index 5ca560f88..808c37d19 100644 --- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml @@ -1,5 +1,6 @@ Third party: Tiers Third parties: Tiers +third parties: tiers name: Nom telephone: Téléphone adress: Adresse @@ -11,7 +12,7 @@ thirdparty.No_phonenumber: Aucun numéro de téléphone thirdparty.No_email: Aucun email thirdparty.No_comment: Aucun commentaire -New third party: Nouveau tiers +New third party: Ajouter un nouveau tiers Show third party %name%: Tiers "%name%" Create third party: Créer un tiers Update third party %name%: Mettre à jour "%name%" @@ -28,4 +29,4 @@ No third parties: Aucun tiers # ROLES CHILL_3PARTY_3PARTY_CREATE: Ajouter un Tiers CHILL_3PARTY_3PARTY_SHOW: Voir un Tiers -CHILL_3PARTY_3PARTY_UPDATE: Modifier un Tiers \ No newline at end of file +CHILL_3PARTY_3PARTY_UPDATE: Modifier un Tiers From 3ee676600e5bea1da105281cc9dbbf02ad68119f Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 16 Jul 2021 13:23:10 +0200 Subject: [PATCH 002/174] adding twig extensions to select how many items per page * twig anchor: {{ chill_items_per_page(pagination) }} * select field changed with javascript event listener --- .../Pagination/ChillItemsPerPageTwig.php | 67 +++++++++++++++++++ .../Pagination/PaginatorFactory.php | 2 +- .../views/Pagination/items_per_page.html.twig | 20 ++++++ .../config/services/pagination.yaml | 7 +- .../translations/messages.fr.yml | 1 + .../Controller/ThirdPartyController.php | 2 - .../views/ThirdParty/index.html.twig | 9 +-- 7 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Pagination/items_per_page.html.twig diff --git a/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php b/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php new file mode 100644 index 000000000..2cfb45d4a --- /dev/null +++ b/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php @@ -0,0 +1,67 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\MainBundle\Pagination; + +use Twig\Environment; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * add twig function to render pagination + * + * @author Mathieu Jaumotte + * @author Champs Libres + */ +class ChillItemsPerPageTwig extends AbstractExtension +{ + public function getName() + { + return 'chill_items_per_page'; + } + + public function getFunctions() + { + return array( + new TwigFunction( + 'chill_items_per_page', + array($this, 'paginationRender'), + array( + 'needs_environment' => true, + 'is_safe' => ['html'] + ) + ) + ); + } + + public function paginationRender( + Environment $env, + PaginatorInterface $paginator, + $template = '@ChillMain/Pagination/items_per_page.html.twig' + ) { + + return $env->render($template, array( + 'paginator' => $paginator, + 'current' => $paginator->getItemsPerPage() + )); + } +} diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php index 0e8338da3..c386a9757 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php +++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php @@ -61,7 +61,7 @@ class PaginatorFactory public function __construct( RequestStack $requestStack, RouterInterface $router, - $itemPerPage = 50 + $itemPerPage = 20 ) { $this->itemPerPage = $itemPerPage; $this->requestStack = $requestStack; diff --git a/src/Bundle/ChillMainBundle/Resources/views/Pagination/items_per_page.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Pagination/items_per_page.html.twig new file mode 100644 index 000000000..52b849163 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Pagination/items_per_page.html.twig @@ -0,0 +1,20 @@ + + diff --git a/src/Bundle/ChillMainBundle/config/services/pagination.yaml b/src/Bundle/ChillMainBundle/config/services/pagination.yaml index f6282a39f..aecf55fa5 100644 --- a/src/Bundle/ChillMainBundle/config/services/pagination.yaml +++ b/src/Bundle/ChillMainBundle/config/services/pagination.yaml @@ -8,8 +8,13 @@ services: - "%chill_main.pagination.item_per_page%" Chill\MainBundle\Pagination\PaginatorFactory: '@chill_main.paginator_factory' - + chill_main.paginator.twig_extensions: class: Chill\MainBundle\Pagination\ChillPaginationTwig tags: - { name: twig.extension } + + chill_main.paginator.items_per_page.twig_extensions: + class: Chill\MainBundle\Pagination\ChillItemsPerPageTwig + tags: + - { name: twig.extension } diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index dc282ec52..b230b6ac1 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -85,6 +85,7 @@ Search %pattern%: Recherche de "%pattern%" Results %start%-%end% of %total%: Résultats %start%-%end% sur %total% See all results: Voir tous les résultats Advanced search: Recherche avancée +results: résultats # timeline Global timeline: Historique global diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php index 59a56af28..d16934b18 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php @@ -70,8 +70,6 @@ class ThirdPartyController extends Controller $nbThirdParties = $repository->countByMemberOfCenters($centers); $pagination = $this->paginatorFactory->create($nbThirdParties); - $pagination->setItemsPerPage(20); - $thirdParties = $repository->findByMemberOfCenters( $centers, $pagination->getCurrentPage()->getFirstItemNumber(), diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig index 12f4560c2..aa3f61088 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig @@ -15,6 +15,7 @@
@@ -23,7 +24,7 @@
@@ -82,11 +83,7 @@ + @@ -56,6 +59,13 @@ + + + + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + + + + + {% endfor %} + {% endblock %} + {% endembed %} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/new.html.twig new file mode 100644 index 000000000..cc6021021 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/new.html.twig @@ -0,0 +1,11 @@ +{% extends '@ChillPerson/Admin/layout.html.twig' %} + +{% block title %} +{% 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 %} diff --git a/src/Bundle/ChillPersonBundle/config/routes.yaml b/src/Bundle/ChillPersonBundle/config/routes.yaml index cd0de3ea3..8b5065bff 100644 --- a/src/Bundle/ChillPersonBundle/config/routes.yaml +++ b/src/Bundle/ChillPersonBundle/config/routes.yaml @@ -136,6 +136,16 @@ chill_person_maritalstatus_admin: order: 120 label: 'person_admin.marital status' +chill_person_socialissue_admin: + path: /{_locale}/admin/social-issue + controller: cscrud_social_issue_controller:index + options: + menus: + admin_person: + order: 150 + label: 'person_admin.social_issue' + + chill_person_controllers: resource: "@ChillPersonBundle/Controller" type: annotation diff --git a/src/Bundle/ChillPersonBundle/config/services.yaml b/src/Bundle/ChillPersonBundle/config/services.yaml index 922081d05..aedea4396 100644 --- a/src/Bundle/ChillPersonBundle/config/services.yaml +++ b/src/Bundle/ChillPersonBundle/config/services.yaml @@ -2,12 +2,9 @@ parameters: # cl_chill_person.example.class: Chill\PersonBundle\Example services: -<<<<<<< HEAD _defaults: autowire: true autoconfigure: true -======= ->>>>>>> Removing spaces at the end of line Chill\PersonBundle\Service\: resource: '../Service/' diff --git a/src/Bundle/ChillPersonBundle/config/services/form.yaml b/src/Bundle/ChillPersonBundle/config/services/form.yaml index aa6f36b28..0f415acac 100644 --- a/src/Bundle/ChillPersonBundle/config/services/form.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/form.yaml @@ -32,7 +32,7 @@ services: chill.person.form.type.pick_person: class: Chill\PersonBundle\Form\Type\PickPersonType arguments: - - "@chill.person.repository.person" + - '@Chill\PersonBundle\Repository\PersonRepository' - "@security.token_storage" - "@chill.main.security.authorization.helper" - '@Symfony\Component\Routing\Generator\UrlGeneratorInterface' @@ -53,3 +53,9 @@ services: $em: '@Doctrine\ORM\EntityManagerInterface' tags: - { name: form.type } + + Chill\PersonBundle\Form\SocialWork\SocialIssueType: + arguments: + $translatableStringHelper: '@chill.main.helper.translatable_string' + tags: + - { name: form.type } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 52254295b..5871c4733 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -304,6 +304,12 @@ crud: add_new: Ajouter un nouveau title_new: Nouvel état civil title_edit: Modifier l'état civil + social_issue: + index: + title: Liste des problématiques sociales + add_new: Ajouter une nouvelle problématique sociale + title_new: Nouvelle problématique sociale + title_edit: Modifier la problématique sociale # specific to closing motive closing_motive: @@ -322,6 +328,7 @@ person_admin: marital status list: Liste des états civils marital status explanation: > Configurer la liste des états civils. + social_issue: Problématiques sociales # specific to accompanying period accompanying_period: From 88847cb19c9df824e9b88e81f34f6dce9618917a Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Wed, 19 May 2021 14:48:26 +0200 Subject: [PATCH 059/174] Other social entities became editable via admin --- .../SocialWork/AdminEvaluationController.php | 33 +++++++ .../SocialWork/AdminGoalController.php | 33 +++++++ .../SocialWork/AdminResultController.php | 33 +++++++ .../AdminSocialActionController.php | 33 +++++++ .../ChillPersonExtension.php | 92 ++++++++++++++++++- .../Form/SocialWork/EvaluationType.php | 87 ++++++++++++++++++ .../Form/SocialWork/GoalType.php | 87 ++++++++++++++++++ .../Form/SocialWork/ResultType.php | 76 +++++++++++++++ .../Form/SocialWork/SocialActionType.php | 90 ++++++++++++++++++ .../Form/SocialWork/SocialIssueType.php | 6 +- .../SocialWork/Evaluation/index.html.twig | 27 ++++++ .../views/SocialWork/Goal/index.html.twig | 27 ++++++ .../views/SocialWork/Result/index.html.twig | 27 ++++++ .../SocialWork/SocialAction/index.html.twig | 27 ++++++ .../{SocialIssue => }/edit.html.twig | 0 .../{SocialIssue => }/new.html.twig | 0 .../ChillPersonBundle/config/routes.yaml | 40 +++++++- .../config/services/form.yaml | 26 ++++++ .../translations/messages.fr.yml | 23 +++++ 19 files changed, 759 insertions(+), 8 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php create mode 100644 src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminGoalController.php create mode 100644 src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminResultController.php create mode 100644 src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialActionController.php create mode 100644 src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php create mode 100644 src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php create mode 100644 src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php create mode 100644 src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Evaluation/index.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Result/index.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialAction/index.html.twig rename src/Bundle/ChillPersonBundle/Resources/views/SocialWork/{SocialIssue => }/edit.html.twig (100%) rename src/Bundle/ChillPersonBundle/Resources/views/SocialWork/{SocialIssue => }/new.html.twig (100%) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php new file mode 100644 index 000000000..134cedc74 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php @@ -0,0 +1,33 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\PersonBundle\Controller\SocialWork; + +use Chill\MainBundle\CRUD\Controller\CRUDController; + +/** + * Class AdminSocialIssueController + * Controller for social issues + * + * @package Chill\PersonBundle\Controller + */ +class AdminEvaluationController extends CRUDController +{ +} diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminGoalController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminGoalController.php new file mode 100644 index 000000000..18e1c9f3b --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminGoalController.php @@ -0,0 +1,33 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\PersonBundle\Controller\SocialWork; + +use Chill\MainBundle\CRUD\Controller\CRUDController; + +/** + * Class AdminSocialIssueController + * Controller for social issues + * + * @package Chill\PersonBundle\Controller + */ +class AdminGoalController extends CRUDController +{ +} diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminResultController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminResultController.php new file mode 100644 index 000000000..80d552282 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminResultController.php @@ -0,0 +1,33 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\PersonBundle\Controller\SocialWork; + +use Chill\MainBundle\CRUD\Controller\CRUDController; + +/** + * Class AdminSocialIssueController + * Controller for social issues + * + * @package Chill\PersonBundle\Controller + */ +class AdminResultController extends CRUDController +{ +} diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialActionController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialActionController.php new file mode 100644 index 000000000..695ec75a1 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialActionController.php @@ -0,0 +1,33 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\PersonBundle\Controller\SocialWork; + +use Chill\MainBundle\CRUD\Controller\CRUDController; + +/** + * Class AdminSocialIssueController + * Controller for social issues + * + * @package Chill\PersonBundle\Controller + */ +class AdminSocialActionController extends CRUDController +{ +} diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index ecc390f59..9cc026909 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -348,7 +348,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac [ 'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class, 'name' => 'social_issue', - 'base_path' => '/admin/social-issue', + 'base_path' => '/admin/social-work/social-issue', 'form_class' => \Chill\PersonBundle\Form\SocialWork\SocialIssueType::class, 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminSocialIssueController::class, 'actions' => [ @@ -358,14 +358,98 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], 'new' => [ 'role' => 'ROLE_ADMIN', - 'template' => '@ChillPerson/SocialWork/SocialIssue/new.html.twig', + 'template' => '@ChillPerson/SocialWork/new.html.twig', ], 'edit' => [ 'role' => 'ROLE_ADMIN', - 'template' => '@ChillPerson/SocialWork/SocialIssue/edit.html.twig', + 'template' => '@ChillPerson/SocialWork/edit.html.twig', ] ] - ] + ], + [ + 'class' => \Chill\PersonBundle\Entity\SocialWork\SocialAction::class, + 'name' => 'social_action', + 'base_path' => '/admin/social-work/social-action', + 'form_class' => \Chill\PersonBundle\Form\SocialWork\SocialActionType::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminSocialActionController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/SocialAction/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/edit.html.twig', + ] + ] + ], + [ + 'class' => \Chill\PersonBundle\Entity\SocialWork\Goal::class, + 'name' => 'social_goal', + 'base_path' => '/admin/social-work/goal', + 'form_class' => \Chill\PersonBundle\Form\SocialWork\GoalType::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminGoalController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/Goal/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/edit.html.twig', + ] + ] + ], + [ + 'class' => \Chill\PersonBundle\Entity\SocialWork\Result::class, + 'name' => 'social_result', + 'base_path' => '/admin/social-work/result', + 'form_class' => \Chill\PersonBundle\Form\SocialWork\ResultType::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminResultController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/Result/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/edit.html.twig', + ] + ] + ], + [ + 'class' => \Chill\PersonBundle\Entity\SocialWork\Evaluation::class, + 'name' => 'social_evaluation', + 'base_path' => '/admin/social-work/evaluation', + 'form_class' => \Chill\PersonBundle\Form\SocialWork\EvaluationType::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminEvaluationController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/Evaluation/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/edit.html.twig', + ] + ] + ], ], 'apis' => [ [ diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php new file mode 100644 index 000000000..41f44a8fd --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php @@ -0,0 +1,87 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +namespace Chill\PersonBundle\Form\SocialWork; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Chill\MainBundle\Form\Type\TranslatableStringFormType; +use Symfony\Component\Form\Extension\Core\Type\DateType; +use Chill\MainBundle\Templating\TranslatableStringHelper; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Chill\PersonBundle\Entity\SocialWork\Evaluation; + +/** + * Class EvaluationType + * + * @package Chill\PersonBundle\Form + */ +class EvaluationType extends AbstractType +{ + /** + * + * @var TranslatableStringHelper + */ + protected $translatableStringHelper; + + public function __construct(TranslatableStringHelper $translatableStringHelper) { + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('title', TranslatableStringFormType::class, [ + 'label' => 'Nom', + ]) + ->add('delay') + + ->add('notificationDelay'); + /* ]) + + ->add('parent', EntityType::class, [ + 'class' => SocialIssue::class, + 'required' => false, + 'choice_label' => function (SocialIssue $issue) { + return $this->translatableStringHelper->localize($issue->getTitle()); + } + ]) + + ->add('desactivationDate', DateType::class, array( + 'attr' => array('class' => 'datepicker'), + 'widget'=> 'single_text', + 'format' => 'dd-MM-yyyy', + 'required' => false, */ + // ]); +} + + /** + * @param OptionsResolver $resolver + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', Evaluation::class) + ; + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php new file mode 100644 index 000000000..9cf9013dc --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php @@ -0,0 +1,87 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +namespace Chill\PersonBundle\Form\SocialWork; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Chill\MainBundle\Form\Type\TranslatableStringFormType; +use Symfony\Component\Form\Extension\Core\Type\DateType; +use Chill\MainBundle\Templating\TranslatableStringHelper; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Chill\PersonBundle\Entity\SocialWork\Goal; +use Chill\PersonBundle\Entity\SocialWork\SocialAction; + +/** + * Class GoalType + * + * @package Chill\PersonBundle\Form + */ +class GoalType extends AbstractType +{ + /** + * + * @var TranslatableStringHelper + */ + protected $translatableStringHelper; + + public function __construct(TranslatableStringHelper $translatableStringHelper) { + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('title', TranslatableStringFormType::class, [ + 'label' => 'Nom' + ]) + + // ->add('socialActions') + + ->add('socialActions', EntityType::class, [ + 'class' => SocialAction::class, + 'required' => false, + 'multiple' => true, + 'choice_label' => function (SocialAction $issue) { + return $this->translatableStringHelper->localize($issue->getTitle()); + } + ]) + + ->add('desactivationDate', DateType::class, [ + 'attr' => array('class' => 'datepicker'), + 'widget'=> 'single_text', + 'format' => 'dd-MM-yyyy', + 'required' => false, + ]); +} + + /** + * @param OptionsResolver $resolver + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', Goal::class) + ; + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php new file mode 100644 index 000000000..ee2cefe48 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php @@ -0,0 +1,76 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +namespace Chill\PersonBundle\Form\SocialWork; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Chill\MainBundle\Form\Type\TranslatableStringFormType; +use Symfony\Component\Form\Extension\Core\Type\DateType; +use Chill\MainBundle\Templating\TranslatableStringHelper; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Chill\PersonBundle\Entity\SocialWork\Result; + +/** + * Class ResultType + * + * @package Chill\PersonBundle\Form + */ +class ResultType extends AbstractType +{ + /** + * + * @var TranslatableStringHelper + */ + protected $translatableStringHelper; + + public function __construct(TranslatableStringHelper $translatableStringHelper) { + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('title', TranslatableStringFormType::class, [ + 'label' => 'Nom' + ]) + ->add('accompanyingPeriodWorks') + ->add('accompanyingPeriodWorkGoals') + ->add('desactivationDate', DateType::class, [ + 'attr' => array('class' => 'datepicker'), + 'widget'=> 'single_text', + 'format' => 'dd-MM-yyyy', + 'required' => false, + ]); +} + + /** + * @param OptionsResolver $resolver + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', Result::class) + ; + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php new file mode 100644 index 000000000..7613bc2c7 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php @@ -0,0 +1,90 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +namespace Chill\PersonBundle\Form\SocialWork; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Chill\MainBundle\Form\Type\TranslatableStringFormType; +use Symfony\Component\Form\Extension\Core\Type\DateType; +use Chill\MainBundle\Templating\TranslatableStringHelper; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Chill\PersonBundle\Entity\SocialWork\SocialAction; +use Chill\PersonBundle\Entity\SocialWork\SocialIssue; + + +/** + * Class SocialActionType + * + * @package Chill\PersonBundle\Form + */ +class SocialActionType extends AbstractType +{ + /** + * + * @var TranslatableStringHelper + */ + protected $translatableStringHelper; + + public function __construct(TranslatableStringHelper $translatableStringHelper) { + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('title', TranslatableStringFormType::class, [ + 'label' => 'Nom' + ]) + ->add('issue', EntityType::class, [ + 'class' => SocialIssue::class, + 'choice_label' => function (SocialIssue $issue) { + return $this->translatableStringHelper->localize($issue->getTitle()); + } + ]) + ->add('parent', EntityType::class, [ + 'class' => SocialAction::class, + 'required' => false, + 'choice_label' => function (SocialAction $issue) { + return $this->translatableStringHelper->localize($issue->getTitle()); + } + ]) + ->add('defaultNotificationDelay') + ->add('desactivationDate', DateType::class, [ + 'attr' => array('class' => 'datepicker'), + 'widget'=> 'single_text', + 'format' => 'dd-MM-yyyy', + 'required' => false, + ]); +} + + /** + * @param OptionsResolver $resolver + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', SocialIssue::class) + ; + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php index 482ff60f3..1f21defd9 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php @@ -63,12 +63,12 @@ class SocialIssueType extends AbstractType } ]) - ->add('desactivationDate', DateType::class, array( - 'attr' => array('class' => 'datepicker'), + ->add('desactivationDate', DateType::class, [ + 'attr' => ['class' => 'datepicker'], 'widget'=> 'single_text', 'format' => 'dd-MM-yyyy', 'required' => false, - )); + ]); } /** diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Evaluation/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Evaluation/index.html.twig new file mode 100644 index 000000000..186b2f3ec --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Evaluation/index.html.twig @@ -0,0 +1,27 @@ +{% extends '@ChillPerson/Admin/layout.html.twig' %} + +{% block layout_wvm_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + + + + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + + + + + {% endfor %} + {% endblock %} + {% endembed %} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig new file mode 100644 index 000000000..aa7c239ba --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig @@ -0,0 +1,27 @@ +{% extends '@ChillPerson/Admin/layout.html.twig' %} + +{% block layout_wvm_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + + + + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + + + + + {% endfor %} + {% endblock %} + {% endembed %} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Result/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Result/index.html.twig new file mode 100644 index 000000000..f1081aebe --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Result/index.html.twig @@ -0,0 +1,27 @@ +{% extends '@ChillPerson/Admin/layout.html.twig' %} + +{% block layout_wvm_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + + + + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + + + + + {% endfor %} + {% endblock %} + {% endembed %} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialAction/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialAction/index.html.twig new file mode 100644 index 000000000..4c1d5a59d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialAction/index.html.twig @@ -0,0 +1,27 @@ +{% extends '@ChillPerson/Admin/layout.html.twig' %} + +{% block layout_wvm_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + + + + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + + + + + {% endfor %} + {% endblock %} + {% endembed %} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/edit.html.twig similarity index 100% rename from src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/edit.html.twig rename to src/Bundle/ChillPersonBundle/Resources/views/SocialWork/edit.html.twig diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/new.html.twig similarity index 100% rename from src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/new.html.twig rename to src/Bundle/ChillPersonBundle/Resources/views/SocialWork/new.html.twig diff --git a/src/Bundle/ChillPersonBundle/config/routes.yaml b/src/Bundle/ChillPersonBundle/config/routes.yaml index 8b5065bff..bbcb7c39b 100644 --- a/src/Bundle/ChillPersonBundle/config/routes.yaml +++ b/src/Bundle/ChillPersonBundle/config/routes.yaml @@ -137,7 +137,7 @@ chill_person_maritalstatus_admin: label: 'person_admin.marital status' chill_person_socialissue_admin: - path: /{_locale}/admin/social-issue + path: /{_locale}/admin/social-work/social-issue controller: cscrud_social_issue_controller:index options: menus: @@ -145,6 +145,44 @@ chill_person_socialissue_admin: 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" diff --git a/src/Bundle/ChillPersonBundle/config/services/form.yaml b/src/Bundle/ChillPersonBundle/config/services/form.yaml index 0f415acac..b61de615d 100644 --- a/src/Bundle/ChillPersonBundle/config/services/form.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/form.yaml @@ -59,3 +59,29 @@ services: $translatableStringHelper: '@chill.main.helper.translatable_string' tags: - { name: form.type } + + Chill\PersonBundle\Form\SocialWork\SocialActionType: + arguments: + $translatableStringHelper: '@chill.main.helper.translatable_string' + tags: + - { name: form.type } + + Chill\PersonBundle\Form\SocialWork\EvaluationType: + arguments: + $translatableStringHelper: '@chill.main.helper.translatable_string' + tags: + - { name: form.type } + + + Chill\PersonBundle\Form\SocialWork\GoalType: + arguments: + $translatableStringHelper: '@chill.main.helper.translatable_string' + tags: + - { name: form.type } + + + Chill\PersonBundle\Form\SocialWork\ResultType: + arguments: + $translatableStringHelper: '@chill.main.helper.translatable_string' + tags: + - { name: form.type } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 5871c4733..98523a762 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -310,6 +310,25 @@ crud: add_new: Ajouter une nouvelle problématique sociale title_new: Nouvelle problématique sociale title_edit: Modifier la problématique sociale + social_action: + index: + title: Liste des actions d'accompagnements + add_new: Ajouter une nouvelle action d'accompagnements + title_new: Nouvelle action d'accompagnements + title_edit: Modifier l'action d'accompagnements + social_goal: + index: + title: Liste des objectifs d'action d'accompagnements + add_new: Ajouter un nouvel objectif d'action d'accompagnements + title_new: Nouvel objectif + title_edit: Modifier l'objectif + social_result: + index: + title: Liste des résultats d'action d'accompagnements + add_new: Ajouter un nouveau résultat d'action d'accompagnements + title_new: Nouveau résultat + title_edit: Modifier le résultat + # specific to closing motive closing_motive: @@ -329,6 +348,10 @@ person_admin: marital status explanation: > Configurer la liste des états civils. social_issue: Problématiques sociales + social_action: Actions d'accompagnement + social_goal: Buts + social_result: Résultats + social_evaluation: Évaluations # specific to accompanying period accompanying_period: From 3be024bf6bb35c8d2ca26d6b2f4de8085b8537da Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Wed, 19 May 2021 15:26:06 +0200 Subject: [PATCH 060/174] Removing un-used code --- .../Form/SocialWork/EvaluationType.php | 18 +----------------- .../Form/SocialWork/GoalType.php | 2 -- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php index 41f44a8fd..b45cd327e 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php @@ -57,23 +57,7 @@ class EvaluationType extends AbstractType ->add('delay') ->add('notificationDelay'); - /* ]) - - ->add('parent', EntityType::class, [ - 'class' => SocialIssue::class, - 'required' => false, - 'choice_label' => function (SocialIssue $issue) { - return $this->translatableStringHelper->localize($issue->getTitle()); - } - ]) - - ->add('desactivationDate', DateType::class, array( - 'attr' => array('class' => 'datepicker'), - 'widget'=> 'single_text', - 'format' => 'dd-MM-yyyy', - 'required' => false, */ - // ]); -} + } /** * @param OptionsResolver $resolver diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php index 9cf9013dc..c86a7d6b9 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php @@ -56,8 +56,6 @@ class GoalType extends AbstractType 'label' => 'Nom' ]) - // ->add('socialActions') - ->add('socialActions', EntityType::class, [ 'class' => SocialAction::class, 'required' => false, From 9f3ceb94f08851470a29bb21c5437a7d69eb982a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 6 Aug 2021 15:53:50 +0200 Subject: [PATCH 061/174] adding options to custom button, and improve stepWithModal options --- .../Resources/public/vuejs/Address/App.vue | 17 ++++--- .../vuejs/Address/components/AddAddress.vue | 49 +++++++++++++------ .../translations/messages.fr.yml | 1 + 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index efe444075..a2eec127d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -4,11 +4,6 @@ class="alert alert-danger my-2"> {{ error }} - -
-      {{ addAddress.result.address_id }}
-   
- - {{ $t(getTextButton) }} + class="btn mt-4" :class="getClassButton" + type="button" name="button" :title="$t(getTextButton)"> + {{ $t(getTextButton) }} + + Date: Fri, 6 Aug 2021 16:25:04 +0200 Subject: [PATCH 062/174] when creating new address, start first with edit panel --- .../public/vuejs/Address/components/AddAddress.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue index b4fc037a1..f543bccc1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -203,7 +203,6 @@ export default { } return step2; }, - getTextTitle() { if (this.options.title) { return (this.context.edit) ? this.options.title.edit : this.options.title.create; @@ -242,7 +241,16 @@ export default { if (this.context.addressId) { this.getInitialAddress(this.context.addressId); } - this.flag.showPane = true; + // when create new address, start first with editPane + if ( this.context.edit === false + && this.flag.editPane === false + ) { + this.openEditPane(); + this.flag.editPane = true; + + } else { + this.flag.showPane = true; + } }, openEditPane() { From b62597426c3a2e0146cd1e58976d829f1e41b22d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 6 Aug 2021 16:30:48 +0200 Subject: [PATCH 063/174] classes for address-valid --- .../Resources/public/chill/scss/render_box.scss | 4 ++-- .../Resources/public/vuejs/Address/components/ShowAddress.vue | 4 ++-- .../ChillMainBundle/Resources/views/Entity/address.html.twig | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss index 68bbe2afc..cd57ba3cd 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss @@ -94,8 +94,8 @@ section.chill-entity { } span.address-valid { - &.address-since {} - &.address-until {} + &.date-since {} + &.date-until {} } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddress.vue index e19c4f333..07e4617d3 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddress.vue @@ -58,8 +58,8 @@ -
-

{{ $t('date') }}

+
+

{{ $t('date') }}

+ {{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }} {%- endif -%} {%- if options['with_valid_to'] == true -%} - + {{ 'Until %date%'|trans( { '%date%' : address.validTo|format_date('long') } ) }} {%- endif -%} From da09e10fb1c2b5e06e115324d4b7086d2ea29afb Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 6 Aug 2021 17:36:19 +0200 Subject: [PATCH 064/174] adding options in root component to see result or redirect (not working) --- .../Resources/public/vuejs/Address/App.vue | 28 +++++++++++++++---- .../vuejs/Address/components/AddAddress.vue | 7 +++-- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index a2eec127d..fa7bd5e95 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -1,9 +1,23 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js index 1622b4ff3..68c23966c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js @@ -65,8 +65,8 @@ const appMessages = { }, courselocation: { title: "Localisation du parcours", - add_temp_address: "Ajouter une adresse temporaire", - edit_temp_address: "Modifier l'adresse temporaire", + add_temporary_address: "Ajouter une adresse temporaire", + edit_temporary_address: "Modifier l'adresse temporaire", assign_course_address: "Désigner comme l'adresse du parcours", }, referrer: { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index e377b358a..b62967616 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -1,9 +1,9 @@ import 'es6-promise/auto'; import { createStore } from 'vuex'; -import { getAccompanyingCourse, +import { getAccompanyingCourse, patchAccompanyingCourse, confirmAccompanyingCourse, - postParticipation, + postParticipation, postRequestor, postResource, postSocialIssue } from '../api'; @@ -13,20 +13,21 @@ const id = window.accompanyingCourseId; let initPromise = getAccompanyingCourse(id) .then(accompanying_course => new Promise((resolve, reject) => { - + const store = createStore({ strict: debug, modules: { }, state: { accompanyingCourse: accompanying_course, + addressContext: {}, errorMsg: [] }, getters: { }, mutations: { catchError(state, error) { - state.errorMsg.push(error); + state.errorMsg.push(error); }, removeParticipation(state, participation) { //console.log('### mutation: remove participation', participation.id); @@ -77,7 +78,7 @@ let initPromise = getAccompanyingCourse(id) postFirstComment(state, comment) { //console.log('### mutation: postFirstComment', comment); state.accompanyingCourse.initialComment = comment; - }, + }, updateSocialIssues(state, value) { state.accompanyingCourse.socialIssues = value; }, @@ -92,6 +93,10 @@ let initPromise = getAccompanyingCourse(id) confirmAccompanyingCourse(state, response) { //console.log('### mutation: confirmAccompanyingCourse: response', response); state.accompanyingCourse.step = response.step; + }, + setAddressContext(state, context) { + //console.log('define location context'); + state.addressContext = context; } }, actions: { @@ -105,7 +110,7 @@ let initPromise = getAccompanyingCourse(id) .then(participation => new Promise((resolve, reject) => { commit('closeParticipation', { participation, payload }); resolve(); - })).catch((error) => { commit('catchError', error) }); + })).catch((error) => { commit('catchError', error) }); }, addParticipation({ commit }, payload) { //console.log('## action: fetch post participation (select item): payload', payload); @@ -113,7 +118,7 @@ let initPromise = getAccompanyingCourse(id) .then(participation => new Promise((resolve, reject) => { commit('addParticipation', participation); resolve(); - })).catch((error) => { commit('catchError', error) }); + })).catch((error) => { commit('catchError', error) }); }, removeRequestor({ commit, dispatch }) { //console.log('## action: fetch delete requestor'); @@ -122,7 +127,7 @@ let initPromise = getAccompanyingCourse(id) commit('removeRequestor'); dispatch('requestorIsAnonymous', false); resolve(); - })).catch((error) => { commit('catchError', error) }); + })).catch((error) => { commit('catchError', error) }); }, addRequestor({ commit }, payload) { //console.log('## action: fetch post requestor: payload', payload); @@ -130,7 +135,7 @@ let initPromise = getAccompanyingCourse(id) .then(requestor => new Promise((resolve, reject) => { commit('addRequestor', requestor); resolve(); - })).catch((error) => { commit('catchError', error) }); + })).catch((error) => { commit('catchError', error) }); }, requestorIsAnonymous({ commit }, payload) { //console.log('## action: fetch patch AccompanyingCourse: payload', payload); From c302452e01b20fd284b288350e07c5ee1261c617 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 12 Aug 2021 16:14:17 +0200 Subject: [PATCH 091/174] improve Address reusability: move i18n translations out of root component --- .../public/vuejs/Address/components/AddAddress.vue | 11 ++++++++--- .../Resources/public/vuejs/Address/index.js | 4 ---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue index 13d3cc150..c3921a609 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -15,7 +15,7 @@ @close="flag.showPane = false">
{{ 'Address'|trans }} {{ 'thirdparty.UpdatedAt.short'|trans }} + +
{{ tp.address|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }} + {% if tp.updatedAt != null %} + {{ tp.updatedAt|format_date('short') }} + {% else %} + {{ tp.createdAt|format_date('short') }} + {% endif %} +
    {% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig index ac78361c6..72e4c9ad4 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig @@ -10,22 +10,42 @@

    {{ 'Create third party'|trans }}

    {{ form_start(form) }} + + {% if thirdParty.isLeaf == true %} + {{ form_row(form.civility) }} + {% endif %} + {{ form_row(form.name) }} + + {% if thirdParty.isLeaf == false %} + {{ form_row(form.nameCompany) }} + {{ form_row(form.acronym) }} + {% endif %} + + {% if thirdParty.isLeaf == true %} + {{ form_row(form.profession) }} + {% endif %} + + {{ form_row(form.categories) }} {{ form_row(form.type) }} + {{ form_row(form.telephone) }} {{ form_row(form.email) }} {{ form_row(form.address) }} - {{ form_row(form.active) }} - {{ form_row(form.centers) }} {{ form_row(form.comment) }} + {{ form_row(form.centers) }} + {{ form_row(form.active) }} -
      +
      • {{ 'Back to the list'|trans }} +
      • +
      • +
      • {{ form_widget(form.submit, {'label': 'Create', 'attr': {'class': 'btn btn-new' }}) }} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig index 56a8276fa..d3edb5b96 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig @@ -20,24 +20,63 @@
        +
        {{ 'Name'|trans }}
        -
        {{ thirdParty.name }}
        +
        + {% if thirdParty.isLeaf == true %}{{ thirdParty.civility }}{% endif %} + {{ thirdParty.name }} +
        + + {% if thirdParty.isLeaf == false %} +
        {{ 'thirdparty.NameCompany'|trans }}
        +
        + {% if thirdParty.nameCompany == null %} + {{ 'No nameCompany given'|trans }} + {% else %} + {{ thirdParty.nameCompany }} + {% endif %} +
        + +
        {{ 'thirdparty.Acronym'|trans }}
        +
        + {% if thirdParty.acronym == null %} + {{ 'No acronym given'|trans }} + {% else %} + {{ thirdParty.acronym }} + {% endif %} +
        + {% endif %}
        {{ 'Type'|trans }}
        {% set types = [] %} {% for t in thirdParty.type %} {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %} {% endfor %} -
        {{ types|join(', ') }}
        - -
        {{ 'Centers'|trans }}
        -
        {{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}
        +
        + {{ types|join(', ') }} +
        {{ 'Phonenumber'|trans }}
        -
        {{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
        +
        + {% if thirdParty.telephone == null %} + {{ 'No phone given'|trans }} + {% else %} + + {{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }} + + {% endif %} +
        {{ 'email'|trans }}
        -
        {{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
        +
        + {% if thirdParty.email == null %} + {{ 'No email given'|trans }} + {% else %} + + {{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }} + + {% endif %} +
        {{ 'Address'|trans }}
        @@ -57,6 +96,9 @@ {% endif %}
        +
        {{ 'Centers'|trans }}
        +
        {{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}
        +
          diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index 2f9d9c48d..fe756cc51 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -15,24 +15,55 @@ +
          + {% if thirdParty.updatedAt != null %} + {{ 'thirdparty.UpdatedAt.short'|trans ~ thirdParty.updatedAt|format_date('short') }} + {% else %} + {{ 'thirdparty.CreatedAt.short'|trans ~ thirdParty.createdAt|format_date('short') }} + {% endif %} + {% if thirdParty.updatedBy != null %} + {{ 'thirdparty.UpdateBy.short'|trans ~ thirdParty.updatedBy.usernameCanonical }} + {% endif %} +
          {{ form_start(form) }} + + {% if thirdParty.isLeaf == true %} + {{ form_row(form.civility) }} + {% endif %} + {{ form_row(form.name) }} + + {% if thirdParty.isLeaf == false %} + {{ form_row(form.nameCompany) }} + {{ form_row(form.acronym) }} + {% endif %} + + {% if thirdParty.isLeaf == true %} + {{ form_row(form.profession) }} + {% endif %} + + {{ form_row(form.categories) }} {{ form_row(form.type) }} + {{ form_row(form.telephone) }} {{ form_row(form.email) }} {{ form_row(form.address) }} - {{ form_row(form.active) }} - {{ form_row(form.centers) }} {{ form_row(form.comment) }} + {{ form_row(form.centers) }} + {{ form_row(form.active) }}
          • {{ 'Back to the list'|trans }} +
          • +
          • + +
          • {{ form_widget(form.submit, {'label': 'Update', 'attr': {'class': 'btn btn-update' }}) }}
          • diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/form.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/form.yaml index 489a2bbb6..de62b197c 100644 --- a/src/Bundle/ChillThirdPartyBundle/config/services/form.yaml +++ b/src/Bundle/ChillThirdPartyBundle/config/services/form.yaml @@ -4,9 +4,10 @@ services: $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper' $tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface' $typesManager: '@Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeManager' + $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' tags: - { name: form.type } - + Chill\ThirdPartyBundle\Form\Type\PickThirdPartyType: arguments: $em: '@Doctrine\ORM\EntityManagerInterface' @@ -14,4 +15,4 @@ services: $translator: '@Symfony\Component\Translation\TranslatorInterface' $typesManager: '@Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeManager' tags: - - { name: form.type } \ No newline at end of file + - { name: form.type } diff --git a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml index 5b021e032..aab74f82f 100644 --- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml @@ -20,10 +20,15 @@ thirdparty.Children: Personnes de contact thirdparty.Parent: Tiers institutionnel thirdparty.Parents: Tiers institutionnels thirdparty.Civility: Civilité +thirdparty.choose civility: -- thirdparty.Profession: Qualité -thirdparty.CreatedAt: Date de création -thirdparty.UpdatedAt: Date de la dernière modification -thirdparty.UpdateBy: Utilisateur qui a effectué la dernière modification +thirdparty.choose profession: -- +thirdparty.CreatedAt.short: 'Créé le ' +thirdparty.UpdatedAt.short: 'Modifié le ' +thirdparty.UpdateBy.short: ' par ' +thirdparty.CreatedAt.long: Date de création +thirdparty.UpdatedAt.long: Date de la dernière modification +thirdparty.UpdateBy.long: Utilisateur qui a effectué la dernière modification New third party: Ajouter un nouveau tiers Show third party %name%: Tiers "%name%" @@ -32,6 +37,7 @@ Update third party %name%: Mettre à jour "%name%" List of third parties: Liste des tiers Third party updated: Le tiers a été mis à jour Third party created: Le tiers a été créé +thirdparty.Status: Statut Active, shown to users: Actif, visible pour les utilisateurs Active: Actif shown to users: visible pour les utilisateurs @@ -39,6 +45,10 @@ Inactive, not shown to users: Inactif, invisible pour les utilisateurs Inactive: Inactif not shown to users: invisible pour les utilisateurs +No nameCompany given: Aucune raison sociale renseignée +No acronym given: Aucun sigle renseigné +No phone given: Aucun téléphone renseigné +No email given: Aucune adresse courriel renseignée The party is visible in those centers: Le tiers est visible dans ces centres No third parties: Aucun tiers From a5595898835b1d23467c2afff2b38cb1eea02f04 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 22 Jul 2021 16:34:07 +0200 Subject: [PATCH 007/174] add isLeaf condition on ThirdParty form Type --- .../Form/ThirdPartyType.php | 96 +++++++++---------- .../Resources/views/ThirdParty/new.html.twig | 6 +- .../views/ThirdParty/update.html.twig | 6 +- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php index 3248e7ff0..9db5013c3 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php @@ -8,6 +8,7 @@ use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory; use Chill\ThirdPartyBundle\Entity\ThirdPartyCivility; use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -57,55 +58,16 @@ class ThirdPartyType extends AbstractType } $builder - ->add('civility', EntityType::class, [ - 'label' => 'thirdparty.Civility', - 'class' => ThirdPartyCivility::class, - 'choice_label' => function (ThirdPartyCivility $civility) { - return $this->translatableStringHelper->localize($civility->getName()); - }, - 'query_builder' => function(EntityRepository $er) { - return $er->createQueryBuilder('c') - ->where('c.active = true'); - }, - 'placeholder' => 'thirdparty.choose civility', - 'required' => true - ]) - ->add('name', TextType::class, [ 'required' => true ]) - - ->add('nameCompany', TextType::class, [ - 'label' => 'thirdparty.NameCompany', - 'required' => false - ]) - - ->add('profession', EntityType::class, [ - 'label' => 'thirdparty.Profession', - 'class' => ThirdPartyProfession::class, - 'choice_label' => function (ThirdPartyProfession $profession) { - return $this->translatableStringHelper->localize($profession->getName()); - }, - 'query_builder' => function (EntityRepository $er) { - return $er->createQueryBuilder('p') - ->where('p.active = true'); - }, - 'placeholder' => 'thirdparty.choose profession', - 'required' => false - ]) - - ->add('acronym', TextType::class, [ - 'label' => 'thirdparty.Acronym', - 'required' => false - ]) - ->add('categories', EntityType::class, [ 'label' => 'thirdparty.Categories', 'class' => ThirdPartyCategory::class, - 'choice_label' => function (ThirdPartyCategory $category) { + 'choice_label' => function (ThirdPartyCategory $category): string { return $this->translatableStringHelper->localize($category->getName()); }, - 'query_builder' => function (EntityRepository $er) { + 'query_builder' => function (EntityRepository $er): QueryBuilder { return $er->createQueryBuilder('c') ->where('c.active = true'); }, @@ -113,29 +75,24 @@ class ThirdPartyType extends AbstractType 'multiple' => true, 'attr' => ['class' => 'select2'] ]) - ->add('type', ChoiceType::class, [ 'choices' => $types, 'expanded' => true, 'multiple' => true, 'label' => 'thirdparty.Type' ]) - ->add('telephone', TextType::class, [ 'label' => 'Phonenumber', 'required' => false ]) - ->add('email', EmailType::class, [ 'required' => false ]) - ->add('address', AddressType::class, [ 'has_valid_from' => false, 'null_if_empty' => true, 'required' => false ]) - ->add('active', ChoiceType::class, [ 'label' => 'thirdparty.Status', 'choices' => [ @@ -145,11 +102,9 @@ class ThirdPartyType extends AbstractType 'expanded' => true, 'multiple' => false ]) - ->add('comment', ChillTextareaType::class, [ 'required' => false ]) - ->add('centers', EntityType::class, [ 'choices' => $this->getReachableCenters($options), 'class' => \Chill\MainBundle\Entity\Center::class, @@ -157,6 +112,51 @@ class ThirdPartyType extends AbstractType 'attr' => ['class' => 'select2'] ]) ; + + // Contact Person ThirdParty (child) + if ($options['data']->isLeaf()) { + $builder + ->add('civility', EntityType::class, [ + 'label' => 'thirdparty.Civility', + 'class' => ThirdPartyCivility::class, + 'choice_label' => function (ThirdPartyCivility $civility): string { + return $this->translatableStringHelper->localize($civility->getName()); + }, + 'query_builder' => function (EntityRepository $er): QueryBuilder { + return $er->createQueryBuilder('c') + ->where('c.active = true'); + }, + 'placeholder' => 'thirdparty.choose civility', + 'required' => true + ]) + ->add('profession', EntityType::class, [ + 'label' => 'thirdparty.Profession', + 'class' => ThirdPartyProfession::class, + 'choice_label' => function (ThirdPartyProfession $profession): string { + return $this->translatableStringHelper->localize($profession->getName()); + }, + 'query_builder' => function (EntityRepository $er): QueryBuilder { + return $er->createQueryBuilder('p') + ->where('p.active = true'); + }, + 'placeholder' => 'thirdparty.choose profession', + 'required' => false + ]) + ; + + // Institutional ThirdParty (parent) + } else { + $builder + ->add('nameCompany', TextType::class, [ + 'label' => 'thirdparty.NameCompany', + 'required' => false + ]) + ->add('acronym', TextType::class, [ + 'label' => 'thirdparty.Acronym', + 'required' => false + ]) + ; + } } /** diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig index 72e4c9ad4..1997466c2 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig @@ -11,18 +11,18 @@ {{ form_start(form) }} - {% if thirdParty.isLeaf == true %} + {% if form.civility is defined %} {{ form_row(form.civility) }} {% endif %} {{ form_row(form.name) }} - {% if thirdParty.isLeaf == false %} + {% if form.nameCompany is defined %} {{ form_row(form.nameCompany) }} {{ form_row(form.acronym) }} {% endif %} - {% if thirdParty.isLeaf == true %} + {% if form.profession is defined %} {{ form_row(form.profession) }} {% endif %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index fe756cc51..85c8dd41d 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -28,18 +28,18 @@ {{ form_start(form) }} - {% if thirdParty.isLeaf == true %} + {% if form.civility is defined %} {{ form_row(form.civility) }} {% endif %} {{ form_row(form.name) }} - {% if thirdParty.isLeaf == false %} + {% if form.nameCompany is defined %} {{ form_row(form.nameCompany) }} {{ form_row(form.acronym) }} {% endif %} - {% if thirdParty.isLeaf == true %} + {% if form.profession is defined %} {{ form_row(form.profession) }} {% endif %} From c37b98cecd2c1b869a17665be7bf3dab1160679d Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 29 Jun 2021 13:53:15 +0200 Subject: [PATCH 008/174] Add a bit more typing to help future development and customizations. --- .../Controller/AbstractCRUDController.php | 31 +++++++++---------- .../CRUD/Controller/ApiController.php | 3 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index a1d28483d..55f3bda24 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -10,6 +10,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\CRUD\Resolver\Resolver; +use Doctrine\ORM\QueryBuilder; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Translation\TranslatorInterface; @@ -69,7 +70,7 @@ class AbstractCRUDController extends AbstractController * @param Request $request * @return int */ - protected function countEntities(string $action, Request $request, $_format): int + protected function countEntities(string $action, Request $request, string $_format): int { return $this->buildQueryEntities($action, $request) ->select('COUNT(e)') @@ -89,23 +90,23 @@ class AbstractCRUDController extends AbstractController * It returns, by default, a query builder. * */ - protected function queryEntities(string $action, Request $request, string $_format, PaginatorInterface $paginator) + protected function queryEntities(string $action, Request $request, string $_format, PaginatorInterface $paginator): QueryBuilder { - $query = $this->buildQueryEntities($action, $request) + $queryBuilder = $this->buildQueryEntities($action, $request) ->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber()) ->setMaxResults($paginator->getItemsPerPage()); // allow to order queries and return the new query - return $this->orderQuery($action, $query, $request, $paginator, $_format); + return $this->orderQuery($action, $queryBuilder, $request, $paginator, $_format); } /** * Add ordering fields in the query build by self::queryEntities * */ - protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) + protected function orderQuery(string $action, QueryBuilder $queryBuilder, Request $request, PaginatorInterface $paginator, string $_format): QueryBuilder { - return $query; + return $queryBuilder; } /** @@ -117,12 +118,8 @@ class AbstractCRUDController extends AbstractController * can add some by using the method `customizeQuery`. * * The alias for the entity is "e". - * - * @param string $action - * @param Request $request - * @return QueryBuilder */ - protected function buildQueryEntities(string $action, Request $request) + protected function buildQueryEntities(string $action, Request $request): QueryBuilder { $qb = $this->getDoctrine()->getManager() ->createQueryBuilder() @@ -135,14 +132,14 @@ class AbstractCRUDController extends AbstractController return $qb; } - protected function customizeQuery(string $action, Request $request, $query): void {} + protected function customizeQuery(string $action, Request $request, QueryBuilder $queryBuilder): void {} /** * Get the result of the query */ - protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array { - return $query->getQuery()->getResult(); + return $queryBuilder->getQuery()->getResult(); } protected function onPreIndex(string $action, Request $request, string $_format): ?Response @@ -161,7 +158,7 @@ class AbstractCRUDController extends AbstractController /** * method used by indexAction */ - protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): ?Response { return null; } @@ -169,7 +166,7 @@ class AbstractCRUDController extends AbstractController /** * method used by indexAction */ - protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $entities): ?Response + protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, array $entities): ?Response { return null; } @@ -188,7 +185,7 @@ class AbstractCRUDController extends AbstractController /** * called on post fetch entity */ - protected function onPostFetchEntity(string $action, Request $request, $entity, $_format): ?Response + protected function onPostFetchEntity(string $action, Request $request, $entity, string $_format): ?Response { return null; } diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index cab0bcdcb..fd55df30b 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -305,7 +305,8 @@ class ApiController extends AbstractCRUDController if ($response instanceof Response) { return $response; } - + + // TODO: $entity is never set before if (!isset($entity)) { $entity = ''; } From c25c302466b3625674ae86edc84f7b6975febe11 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 29 Jun 2021 13:54:01 +0200 Subject: [PATCH 009/174] Sort entities recursively. --- .../Controller/SocialIssueApiController.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 40d7068ce..4b8d87180 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -4,6 +4,9 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Pagination\PaginatorInterface; +use Chill\PersonBundle\Entity\SocialWork\SocialIssue; +use Doctrine\ORM\QueryBuilder; +use Generator; use Symfony\Component\HttpFoundation\Request; class SocialIssueApiController extends ApiController @@ -18,4 +21,41 @@ class SocialIssueApiController extends ApiController ); $query->setParameter('now', new \DateTimeImmutable()); } + + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array + { + // Create a lazy generator to avoid performance issues. + $generator = $this->buildRecursively( + $queryBuilder->getQuery()->getResult(), + static fn (SocialIssue $socialIssue): iterable => $socialIssue->getChildren() + ); + + // Sadly, we must convert the generator into an array... + // so we lose all the performance gain we could have by using an iterator. + $results = []; + + // Reduce the generator into an array containing once each SocialIssue. + foreach ($generator as $socialIssue) { + // If the current item hasn't been seen yet, add it to the resultset. + $results += [$socialIssue->getId() => $socialIssue]; + } + + return $results; + } + + /** + * @param iterable $iterable + * @param callable(SocialIssue): iterable $childrenAccessor + * + * @return Generator + */ + private function buildRecursively(iterable $iterable, callable $childrenAccessor): Generator + { + foreach ($iterable as $item) + { + yield $item; + + yield from $this->buildRecursively($childrenAccessor($item), $childrenAccessor); + } + } } From 401659748c534d5329a38bb3c7081181c7b43a7c Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 29 Jun 2021 15:23:00 +0200 Subject: [PATCH 010/174] Default entities order: title ASC --- .../Controller/SocialIssueApiController.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 4b8d87180..62a708c45 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -5,9 +5,11 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; +use DateTimeImmutable; use Doctrine\ORM\QueryBuilder; use Generator; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class SocialIssueApiController extends ApiController { @@ -19,7 +21,7 @@ class SocialIssueApiController extends ApiController $query->expr()->isNull('e.desactivationDate') ) ); - $query->setParameter('now', new \DateTimeImmutable()); + $query->setParameter('now', new DateTimeImmutable()); } protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array @@ -43,6 +45,15 @@ class SocialIssueApiController extends ApiController return $results; } + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): ?Response + { + $queryBuilder + ->orderBy("GET_JSON_FIELD_BY_KEY(e.title, :locale)", 'ASC') + ->setParameter(':locale', $request->getLocale()); + + return null; + } + /** * @param iterable $iterable * @param callable(SocialIssue): iterable $childrenAccessor From d50d3e0e4b55a154a3c1fbcd96c93921f79d1669 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 08:33:11 +0200 Subject: [PATCH 011/174] Revert "Add a bit more typing to help future development and customizations." This reverts commit 32ce244de551c437d8eef08edeb1fd1906036827. --- .../Controller/AbstractCRUDController.php | 31 ++++++++++--------- .../CRUD/Controller/ApiController.php | 3 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index 55f3bda24..a1d28483d 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -10,7 +10,6 @@ use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\CRUD\Resolver\Resolver; -use Doctrine\ORM\QueryBuilder; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Translation\TranslatorInterface; @@ -70,7 +69,7 @@ class AbstractCRUDController extends AbstractController * @param Request $request * @return int */ - protected function countEntities(string $action, Request $request, string $_format): int + protected function countEntities(string $action, Request $request, $_format): int { return $this->buildQueryEntities($action, $request) ->select('COUNT(e)') @@ -90,23 +89,23 @@ class AbstractCRUDController extends AbstractController * It returns, by default, a query builder. * */ - protected function queryEntities(string $action, Request $request, string $_format, PaginatorInterface $paginator): QueryBuilder + protected function queryEntities(string $action, Request $request, string $_format, PaginatorInterface $paginator) { - $queryBuilder = $this->buildQueryEntities($action, $request) + $query = $this->buildQueryEntities($action, $request) ->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber()) ->setMaxResults($paginator->getItemsPerPage()); // allow to order queries and return the new query - return $this->orderQuery($action, $queryBuilder, $request, $paginator, $_format); + return $this->orderQuery($action, $query, $request, $paginator, $_format); } /** * Add ordering fields in the query build by self::queryEntities * */ - protected function orderQuery(string $action, QueryBuilder $queryBuilder, Request $request, PaginatorInterface $paginator, string $_format): QueryBuilder + protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) { - return $queryBuilder; + return $query; } /** @@ -118,8 +117,12 @@ class AbstractCRUDController extends AbstractController * can add some by using the method `customizeQuery`. * * The alias for the entity is "e". + * + * @param string $action + * @param Request $request + * @return QueryBuilder */ - protected function buildQueryEntities(string $action, Request $request): QueryBuilder + protected function buildQueryEntities(string $action, Request $request) { $qb = $this->getDoctrine()->getManager() ->createQueryBuilder() @@ -132,14 +135,14 @@ class AbstractCRUDController extends AbstractController return $qb; } - protected function customizeQuery(string $action, Request $request, QueryBuilder $queryBuilder): void {} + protected function customizeQuery(string $action, Request $request, $query): void {} /** * Get the result of the query */ - protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) { - return $queryBuilder->getQuery()->getResult(); + return $query->getQuery()->getResult(); } protected function onPreIndex(string $action, Request $request, string $_format): ?Response @@ -158,7 +161,7 @@ class AbstractCRUDController extends AbstractController /** * method used by indexAction */ - protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): ?Response + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response { return null; } @@ -166,7 +169,7 @@ class AbstractCRUDController extends AbstractController /** * method used by indexAction */ - protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, array $entities): ?Response + protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $entities): ?Response { return null; } @@ -185,7 +188,7 @@ class AbstractCRUDController extends AbstractController /** * called on post fetch entity */ - protected function onPostFetchEntity(string $action, Request $request, $entity, string $_format): ?Response + protected function onPostFetchEntity(string $action, Request $request, $entity, $_format): ?Response { return null; } diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index fd55df30b..cab0bcdcb 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -305,8 +305,7 @@ class ApiController extends AbstractCRUDController if ($response instanceof Response) { return $response; } - - // TODO: $entity is never set before + if (!isset($entity)) { $entity = ''; } From b41b1346e5152734709edcb320ff3a0ad2949516 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 08:37:49 +0200 Subject: [PATCH 012/174] Remove typing. Request from https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/99 --- .../Controller/SocialIssueApiController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 62a708c45..4437955ed 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -24,11 +24,11 @@ class SocialIssueApiController extends ApiController $query->setParameter('now', new DateTimeImmutable()); } - protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) { // Create a lazy generator to avoid performance issues. $generator = $this->buildRecursively( - $queryBuilder->getQuery()->getResult(), + $query->getQuery()->getResult(), static fn (SocialIssue $socialIssue): iterable => $socialIssue->getChildren() ); @@ -45,9 +45,9 @@ class SocialIssueApiController extends ApiController return $results; } - protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): ?Response + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response { - $queryBuilder + $query ->orderBy("GET_JSON_FIELD_BY_KEY(e.title, :locale)", 'ASC') ->setParameter(':locale', $request->getLocale()); From d208a79764280733e1f1a830b6ac09e61562ecd1 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 15:47:38 +0200 Subject: [PATCH 013/174] Add Doctrine extension. --- .../ChillMainExtension.php | 6 ++- .../Hydration/FlatHierarchyEntityHydrator.php | 48 +++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 6826f854c..1637ee098 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -32,9 +32,8 @@ use Chill\MainBundle\Doctrine\DQL\JsonAggregate; use Chill\MainBundle\Doctrine\DQL\JsonbExistsInArray; use Chill\MainBundle\Doctrine\DQL\Similarity; use Chill\MainBundle\Doctrine\DQL\OverlapsI; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; use Chill\MainBundle\Doctrine\DQL\Replace; +use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType; use Chill\MainBundle\Doctrine\Type\PointType; use Symfony\Component\HttpFoundation\Request; @@ -186,6 +185,9 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface, 'OVERLAPSI' => OverlapsI::class, ], ], + 'hydrators' => [ + 'chill_flat_hierarchy_list' => FlatHierarchyEntityHydrator::class, + ], ], ], ); diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php new file mode 100644 index 000000000..ed7588f94 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -0,0 +1,48 @@ +buildRecursively( + parent::hydrateAllData(), + static fn($value): iterable => $value->getChildren(), + ); + + $result = []; + + foreach ($generator as $entity) { + // We cannot expect anything from the object entity + // so, we cannot expect it to have a ::getId() method. + // So we use spl_object_hash() instead. + $result += [spl_object_hash($entity) => $entity]; + } + + return array_values($result); + } + + /** + * @param iterable $iterable + * @param callable(SocialIssue): iterable $childrenAccessor + * + * @return Generator + */ + private function buildRecursively(iterable $iterable, callable $childrenAccessor): Generator + { + foreach ($iterable as $item) + { + yield $item; + + yield from $this->buildRecursively($childrenAccessor($item), $childrenAccessor); + } + } +} From e1f8aa5a5ef3c6c75087f4e5589213598b5cddc2 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 15:49:23 +0200 Subject: [PATCH 014/174] Use custom Doctrine hydrator. --- .../Controller/SocialIssueApiController.php | 40 ++----------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 4437955ed..63deadd03 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -3,11 +3,9 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; +use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Pagination\PaginatorInterface; -use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use DateTimeImmutable; -use Doctrine\ORM\QueryBuilder; -use Generator; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -26,23 +24,9 @@ class SocialIssueApiController extends ApiController protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) { - // Create a lazy generator to avoid performance issues. - $generator = $this->buildRecursively( - $query->getQuery()->getResult(), - static fn (SocialIssue $socialIssue): iterable => $socialIssue->getChildren() - ); - - // Sadly, we must convert the generator into an array... - // so we lose all the performance gain we could have by using an iterator. - $results = []; - - // Reduce the generator into an array containing once each SocialIssue. - foreach ($generator as $socialIssue) { - // If the current item hasn't been seen yet, add it to the resultset. - $results += [$socialIssue->getId() => $socialIssue]; - } - - return $results; + // In order to work, this hydrator only works with + // entities having the field "children" set up. + return $query->getQuery()->getResult(FlatHierarchyEntityHydrator::LIST); } protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response @@ -53,20 +37,4 @@ class SocialIssueApiController extends ApiController return null; } - - /** - * @param iterable $iterable - * @param callable(SocialIssue): iterable $childrenAccessor - * - * @return Generator - */ - private function buildRecursively(iterable $iterable, callable $childrenAccessor): Generator - { - foreach ($iterable as $item) - { - yield $item; - - yield from $this->buildRecursively($childrenAccessor($item), $childrenAccessor); - } - } } From ef6c5870b55cc6025c7ba21651b8b1b5c360c664 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 22:44:43 +0200 Subject: [PATCH 015/174] Prevent multiples sub-queries. --- .../ORM/Hydration/FlatHierarchyEntityHydrator.php | 8 +++++++- .../Controller/SocialIssueApiController.php | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index ed7588f94..d28c7af09 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -15,7 +15,13 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator { $generator = $this->buildRecursively( parent::hydrateAllData(), - static fn($value): iterable => $value->getChildren(), + static function($value): iterable { + $children = $value->getChildren(); + + $children->setInitialized(true); + + return $children; + } ); $result = []; diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 63deadd03..c1d251efb 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -6,6 +6,7 @@ use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Pagination\PaginatorInterface; use DateTimeImmutable; +use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -26,7 +27,10 @@ class SocialIssueApiController extends ApiController { // In order to work, this hydrator only works with // entities having the field "children" set up. - return $query->getQuery()->getResult(FlatHierarchyEntityHydrator::LIST); + return $query + ->getQuery() + ->setHint(Query::HINT_INCLUDE_META_COLUMNS, true) + ->getResult(FlatHierarchyEntityHydrator::LIST); } protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response From b33cb4946c0641c28f0fc4e0a65bb0f3ae96789d Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 1 Jul 2021 09:12:39 +0200 Subject: [PATCH 016/174] Improve/optimize list generation. --- .../Hydration/FlatHierarchyEntityHydrator.php | 60 +++++++++---------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index d28c7af09..0bd9505a6 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -11,44 +11,38 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator { public const LIST = 'chill_flat_hierarchy_list'; - protected function hydrateAllData(): array + protected function hydrateAllData() { - $generator = $this->buildRecursively( - parent::hydrateAllData(), - static function($value): iterable { - $children = $value->getChildren(); - - $children->setInitialized(true); - - return $children; - } - ); - - $result = []; - - foreach ($generator as $entity) { - // We cannot expect anything from the object entity - // so, we cannot expect it to have a ::getId() method. - // So we use spl_object_hash() instead. - $result += [spl_object_hash($entity) => $entity]; - } - - return array_values($result); + return array_values(iterator_to_array($this->flatListGenerator($this->buildChildrenHashmap(parent::hydrateAllData())))); } - /** - * @param iterable $iterable - * @param callable(SocialIssue): iterable $childrenAccessor - * - * @return Generator - */ - private function buildRecursively(iterable $iterable, callable $childrenAccessor): Generator + private function flatListGenerator(array $hashMap, $parent = null): Generator { - foreach ($iterable as $item) - { - yield $item; + $parent = null === $parent ? + null : + spl_object_hash($parent); - yield from $this->buildRecursively($childrenAccessor($item), $childrenAccessor); + $hashMap += [$parent => []]; + + foreach ($hashMap[$parent] as $node) { + yield $node->getId() => $node; + yield from $this->flatListGenerator($hashMap, $node); } } + + private function buildChildrenHashmap(array $nodes): array + { + $r = []; + + foreach ($nodes as $node) { + $parentId = (null !== $parent = $node->getParent()) + ? spl_object_hash($parent) + : null; + + $r[$parentId][] = $node; + } + + return $r; + } + } From cc824faf544b04fa4a31c4410917e47b0677a186 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 10 Jul 2021 07:50:15 +0200 Subject: [PATCH 017/174] Improve performance. --- .../Hydration/FlatHierarchyEntityHydrator.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index 0bd9505a6..eaa7b6c72 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -16,33 +16,33 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator return array_values(iterator_to_array($this->flatListGenerator($this->buildChildrenHashmap(parent::hydrateAllData())))); } - private function flatListGenerator(array $hashMap, $parent = null): Generator + private function flatListGenerator(array $hashMap, ?int $parent = null): Generator { - $parent = null === $parent ? - null : - spl_object_hash($parent); + $parent ??= spl_object_id($parent); $hashMap += [$parent => []]; foreach ($hashMap[$parent] as $node) { - yield $node->getId() => $node; + yield spl_object_id($node) => $node; yield from $this->flatListGenerator($hashMap, $node); } } private function buildChildrenHashmap(array $nodes): array { - $r = []; + return array_reduce( + $nodes, + static function (array $collect, $node) { + $parentId = (null === $parent = $node->getParent()) ? + null : + spl_object_id($parent); - foreach ($nodes as $node) { - $parentId = (null !== $parent = $node->getParent()) - ? spl_object_hash($parent) - : null; + $collect[$parentId][] = $node; - $r[$parentId][] = $node; - } - - return $r; + return $collect; + }, + [] + ); } } From 53d3a0921ba12a0b0dcbc8d4629f737d84e1a111 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 10 Jul 2021 08:17:37 +0200 Subject: [PATCH 018/174] Fix minor bug. --- .../Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index eaa7b6c72..91013ddba 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -18,8 +18,7 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator private function flatListGenerator(array $hashMap, ?int $parent = null): Generator { - $parent ??= spl_object_id($parent); - + $parent = null === $parent ? null : spl_object_id($parent); $hashMap += [$parent => []]; foreach ($hashMap[$parent] as $node) { From d0b51f3573336fcad5490fe3e0fb3eae1ffd3add Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 10 Jul 2021 08:18:00 +0200 Subject: [PATCH 019/174] Add minor typing. --- .../Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index 91013ddba..48b6ff875 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -31,7 +31,7 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator { return array_reduce( $nodes, - static function (array $collect, $node) { + static function (array $collect, $node): array { $parentId = (null === $parent = $node->getParent()) ? null : spl_object_id($parent); From 34f22d237ed571f01cf18fbc1215a5ebd013a3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 27 Jul 2021 18:29:48 +0200 Subject: [PATCH 020/174] update schema to store location on accompanying period --- .../Entity/AccompanyingPeriod.php | 17 ++++++++ .../ChillPersonBundle/Entity/Person.php | 14 +++++++ .../migrations/Version20210727152826.php | 39 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20210727152826.php diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index b2de73651..41835e237 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -25,6 +25,7 @@ namespace Chill\PersonBundle\Entity; use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; use Chill\MainBundle\Entity\Scope; +use Chill\MainBundle\Entity\Address; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment; @@ -291,6 +292,22 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface */ private Collection $works; + /** + * @ORM\ManyToOne( + * targetEntity=Person::class, + * inversedBy="periodLocatedOn" + * ) + */ + private ?Person $personLocation = null; + + + /** + * @ORM\ManyToOne( + * targetEntity=Address::class + * ) + */ + private ?Address $addressLocation = null; + /** * AccompanyingPeriod constructor. * diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 695970bfa..cf00eb9f1 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -30,6 +30,7 @@ use Chill\MainBundle\Entity\Country; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\MaritalStatus; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\MainBundle\Entity\HasCenterInterface; use Chill\MainBundle\Entity\Address; @@ -379,6 +380,19 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI */ private Collection $householdAddresses; + /** + * @ORM\OneToMany( + * targetEntity=AccompanyingPeriod::class, + * mappedBy="personLocation" + * ) + */ + private Collection $periodLocatedOn; + + /** + * Person constructor. + * + * @param \DateTime|null $opening + */ public function __construct() { $this->accompanyingPeriodParticipations = new ArrayCollection(); diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20210727152826.php b/src/Bundle/ChillPersonBundle/migrations/Version20210727152826.php new file mode 100644 index 000000000..f49c819d7 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20210727152826.php @@ -0,0 +1,39 @@ +addSql('ALTER TABLE chill_person_accompanying_period ADD personLocation_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period ADD addressLocation_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A868D5213D34 FOREIGN KEY (personLocation_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A8689B07D6BF FOREIGN KEY (addressLocation_id) REFERENCES chill_main_address (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_E260A868D5213D34 ON chill_person_accompanying_period (personLocation_id)'); + $this->addSql('CREATE INDEX IDX_E260A8689B07D6BF ON chill_person_accompanying_period (addressLocation_id)'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A868D5213D34'); + $this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A8689B07D6BF'); + $this->addSql('DROP INDEX IDX_E260A868D5213D34'); + $this->addSql('DROP INDEX IDX_E260A8689B07D6BF'); + $this->addSql('ALTER TABLE chill_person_accompanying_period DROP personLocation_id'); + $this->addSql('ALTER TABLE chill_person_accompanying_period DROP addressLocation_id'); + } +} From 4cca148f69f6ca6b088d08faf6a1d6496f05ce13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 27 Jul 2021 21:25:38 +0200 Subject: [PATCH 021/174] [AccompanyingPeriod] add location to serialization --- .../Entity/AccompanyingPeriod.php | 63 +++++++++++++++++++ .../ChillPersonBundle/chill.api.specs.yaml | 20 ++++++ 2 files changed, 83 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 41835e237..dda129296 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -948,4 +948,67 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface return $this; } + + public function getAddressLocation(): ?Address + { + return $this->addressLocation; + } + + /** + * @Groups({"write"}) + */ + public function setAddressLocation(?Address $addressLocation = null): self + { + $this->addressLocation = $addressLocation; + + return $this; + } + + /** + * @Groups({"read"}) + */ + public function getPersonLocation(): ?Person + { + return $this->personLocation; + } + + /** + * @Groups({"write"}) + */ + public function setPersonLocation(?Person $person = null): self + { + $this->personLocation = $person; + + return $this; + } + + /** + * Get the location, taking precedence into account + * + * @Groups({"read"}) + */ + public function getLocation(\DateTimeImmutable $at = null): ?Address + { + if ($this->getPersonLocation() instanceof Person) { + return $this->getPersonLocation()->getCurrentHouseholdAddress($at); + } + + return $this->getAddressLocation(); + } + + /** + * Get where the location is + * + * @Groups({"read"}) + */ + public function getLocationStatus(): string + { + if ($this->getPersonLocation() instanceof Person) { + return 'person'; + } elseif ($this->getAddressLocation() instanceof Address) { + return 'address'; + } else { + return 'none'; + } + } } diff --git a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml index 9fba308c5..71d5c119e 100644 --- a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml @@ -416,6 +416,26 @@ paths: This is my an initial comment. Say hello to the new "parcours"! + Setting person with id 8405 as locator: + value: + type: accompanying_period + id: 0 + personLocation: + type: person + id: 8405 + Removing person location for both person and address: + value: + type: accompanying_period + id: 0 + personLocation: null + addressLocation: null + Adding address with id 7960 as temporarily address: + value: + type: accompanying_period + id: 0 + personLocation: null + addressLocation: + id: 7960 responses: 401: description: "Unauthorized" From 4e8dd3b18902f420dc7e15d8ee05adf439c5b821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 28 Jul 2021 13:27:05 +0200 Subject: [PATCH 022/174] [AccompanyingPeriod] add flashbag message when located temporarily --- .../views/AccompanyingCourse/index.html.twig | 13 +++++++++++++ .../ChillPersonBundle/translations/messages.fr.yml | 1 + 2 files changed, 14 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index c15869b1d..5bab87ceb 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -59,6 +59,19 @@ + {% endif %} + + {% if accompanyingCourse.step != 'DRAFT' and + (accompanyingCourse.locationStatus == 'address' or accompanyingCourse.locationStatus == 'none') + %} +
            +
            + {{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }} +
            +
            + + + {% endif %}

            {{ 'Associated peoples'|trans }}

            diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 32691bcb4..c081850db 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -339,6 +339,7 @@ Show Accompanying Course: Voir le parcours Edit Accompanying Course: Modifier le parcours Create Accompanying Course: Créer un nouveau parcours Drop Accompanying Course: Supprimer le parcours +This course is located at a temporarily address. You should locate this course to an user: Ce parcours est localisé à une adresse temporaire. Il devrait être localisé auprès d'un usager concerné. # Household Household: Ménage From 3c7b67604c8778d60bdcb26fd5120a59fe56ebd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 28 Jul 2021 14:46:03 +0200 Subject: [PATCH 023/174] [AccompanyingPeriod] create constraints for location --- .../AccompanyingPeriod/LocationValidity.php | 20 +++++++ .../LocationValidityValidator.php | 52 +++++++++++++++++++ .../ChillPersonBundle/config/services.yaml | 5 ++ .../ChillPersonBundle/config/validation.yaml | 1 + 4 files changed, 78 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php create mode 100644 src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php new file mode 100644 index 000000000..9a64b3cf6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php @@ -0,0 +1,20 @@ +render = $render; + } + + public function validate($period, Constraint $constraint) + { + if (!$constraint instanceof LocationValidity) { + throw new UnexpectedTypeException($constraint, LocationValidity::class); + } + + if (!$period instanceof AccompanyingPeriod) { + throw new UnexpectedValueException($value, AccompanyingPeriod::class); + } + + if ($period->getLocationStatus() === 'person') { + if (null === $period->getOpenParticipationContainsPerson( + $period->getPersonLocation())) { + $this->context->buildViolation($constraint->messagePersonLocatedMustBeAssociated) + ->setParameter('{{ person_name }}', $this->render->renderString( + $period->getPersonLocation(), [] + )) + ->addViolation() + ; + } + } + + if ($period->getStep() !== AccompanyingPeriod::STEP_DRAFT + && $period->getLocationStatus() === 'none') { + $this->context->buildViolation($constraint->messagePeriodMustRemainsLocated + ->addViolation() + ; + + } + + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services.yaml b/src/Bundle/ChillPersonBundle/config/services.yaml index a23ba39b3..c34f42ebb 100644 --- a/src/Bundle/ChillPersonBundle/config/services.yaml +++ b/src/Bundle/ChillPersonBundle/config/services.yaml @@ -85,3 +85,8 @@ services: resource: '../Templating/Entity' tags: - 'chill.render_entity' + + Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\: + autowire: true + autoconfigure: true + resource: '../Validator/Constraints/AccompanyingPeriod' diff --git a/src/Bundle/ChillPersonBundle/config/validation.yaml b/src/Bundle/ChillPersonBundle/config/validation.yaml index fb0dd7b50..23369a467 100644 --- a/src/Bundle/ChillPersonBundle/config/validation.yaml +++ b/src/Bundle/ChillPersonBundle/config/validation.yaml @@ -81,6 +81,7 @@ Chill\PersonBundle\Entity\AccompanyingPeriod: constraints: - Callback: callback: isDateConsistent + - 'Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\LocationValidity': ~ Chill\PersonBundle\Entity\PersonPhone: properties: From 3169da20ad3ebda91f7463c6c84023bdc9b71174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 28 Jul 2021 16:16:57 +0200 Subject: [PATCH 024/174] add test for accompanying period location validity --- .../LocationValidityValidatorTest.php | 122 ++++++++++++++++++ .../AccompanyingPeriod/LocationValidity.php | 2 +- .../LocationValidityValidator.php | 10 +- 3 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Validator/AccompanyingPeriod/LocationValidityValidatorTest.php diff --git a/src/Bundle/ChillPersonBundle/Tests/Validator/AccompanyingPeriod/LocationValidityValidatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Validator/AccompanyingPeriod/LocationValidityValidatorTest.php new file mode 100644 index 000000000..b70a8146b --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Validator/AccompanyingPeriod/LocationValidityValidatorTest.php @@ -0,0 +1,122 @@ +getConstraint(); + + $period = new AccompanyingPeriod(); + $person = new Person(); + $period->addPerson($person); + + $period->setPersonLocation($person); + + $this->validator->validate($period, $constraint); + + $this->assertNoViolation(); + } + + public function testPeriodDoesNotContainsPersonOnRemovedPerson() + { + $constraint = $this->getConstraint(); + + $period = new AccompanyingPeriod(); + $person1 = new Person(); + $period->addPerson($person1); + + $period->setPersonLocation($person1); + + $period->removePerson($person1); + + $this->validator->validate($period, $constraint); + + $this->buildViolation('messagePersonLocatedMustBeAssociated') + ->setParameters([ + '{{ person_name }}' => 'name' + ]) + ->assertRaised() + ; + } + + public function testPeriodDoesNotContainsPersonOnOtherPerson() + { + $constraint = $this->getConstraint(); + + $period = new AccompanyingPeriod(); + $person1 = new Person(); + $person2 = new Person(); + $period->addPerson($person1); + + $period->setPersonLocation($person2); + + $this->validator->validate($period, $constraint); + + $this->buildViolation('messagePersonLocatedMustBeAssociated') + ->setParameters([ + '{{ person_name }}' => 'name' + ]) + ->assertRaised() + ; + } + + public function testPeriodDoesNotContainsPersonOnAnyPerson() + { + $constraint = $this->getConstraint(); + + $period = new AccompanyingPeriod(); + $person1 = new Person(); + $period->setPersonLocation($person1); + + $this->validator->validate($period, $constraint); + + $this->buildViolation('messagePersonLocatedMustBeAssociated') + ->setParameters([ + '{{ person_name }}' => 'name' + ]) + ->assertRaised() + ; + } + + public function testRemoveLocationOnPeriodValidated() + { + $constraint = $this->getConstraint(); + + $period = new AccompanyingPeriod(); + $period->setStep('not draft'); + + $this->validator->validate($period, $constraint); + + $this->buildViolation('messagePeriodMustRemainsLocated') + ->assertRaised() + ; + } + + protected function getConstraint() + { + return new LocationValidity([ + 'messagePersonLocatedMustBeAssociated' => 'messagePersonLocatedMustBeAssociated', + 'messagePeriodMustRemainsLocated' => 'messagePeriodMustRemainsLocated' + ]); + } + + protected function createValidator() + { + $render= $this->createMock(PersonRender::class); + $render->method('renderString') + ->willReturn('name') + ; + + return new LocationValidityValidator($render); + } + +} diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php index 9a64b3cf6..75c10ca75 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php @@ -11,7 +11,7 @@ class LocationValidity extends Constraint { public $messagePersonLocatedMustBeAssociated = "The person where the course is located must be associated to the course. Change course's location before removing the person."; - public $messagPeriodMustRemainsLocated = "The period must remains located"; + public $messagePeriodMustRemainsLocated = "The period must remains located"; public function getTargets() { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php index 3a0b1a3b3..a92120f2d 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php @@ -42,10 +42,12 @@ class LocationValidityValidator extends ConstraintValidator if ($period->getStep() !== AccompanyingPeriod::STEP_DRAFT && $period->getLocationStatus() === 'none') { - $this->context->buildViolation($constraint->messagePeriodMustRemainsLocated - ->addViolation() - ; - + $this->context + ->buildViolation( + $constraint->messagePeriodMustRemainsLocated + ) + ->addViolation() + ; } } From 5ef5b65d90dc7d73c2b4a58d6a9986f6104cdfe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 29 Jul 2021 12:24:22 +0200 Subject: [PATCH 025/174] Add address suggestion for a person --- .../Controller/PersonApiController.php | 38 +++++++++++++++++++ .../Controller/PersonApiControllerTest.php | 27 +++++++++++++ .../ChillPersonBundle/chill.api.specs.yaml | 29 +++++++++++++- 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index 9db1854fc..62b61a942 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -18,12 +18,15 @@ namespace Chill\PersonBundle\Controller; use Chill\PersonBundle\Security\Authorization\PersonVoter; +use Chill\PersonBundle\Entity\Person; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Symfony\Component\Security\Core\Role\Role; use Chill\MainBundle\CRUD\Controller\ApiController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Chill\MainBundle\Entity\Address; +use Symfony\Component\Routing\Annotation\Route; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; class PersonApiController extends ApiController { @@ -54,4 +57,39 @@ class PersonApiController extends ApiController return $this->addRemoveSomething('address', $id, $request, $_format, 'address', Address::class, [ 'groups' => [ 'read' ] ]); } + /** + * @Route("/api/1.0/person/address/suggest/by-person/{person_id}.{_format}", + * name="chill_person_address_suggest_by_person", + * requirements={ + * "_format"="json" + * } + * ) + * @ParamConverter("person", options={"id" = "person_id"}) + */ + public function suggestAddress(Person $person, Request $request, string $_format): Response + { + $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); + + $addresses = []; + // collect addresses from location in courses + foreach ($person->getAccompanyingPeriodParticipations() as $participation) { + if (null !== $participation->getAccompanyingPeriod()->getAddressLocation()) { + $a = $participation->getAccompanyingPeriod()->getAddressLocation(); + $addresses[$a->getId()] = $a; + } + if (null !== $participation->getAccompanyingPeriod()->getPersonLocation()) { + $a = $participation->getAccompanyingPeriod()->getAddressLocation(); + $addresses[$a->getId()] = $a; + } + } + + \array_unique($addresses); + // remove the actual address + $actual = $person->getCurrentHouseholdAddress(); + if (null !== $actual) { + $addresses = \array_filter($addresses, fn($a) => $a !== $actual); + } + + return $this->json(\array_values($addresses), Response::HTTP_OK, [], [ 'groups' => [ 'read' ]]); + } } diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php index d261f4294..23890cdb9 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php @@ -45,6 +45,31 @@ class PersonApiControllerTest extends WebTestCase $this->assertEquals($personId, $data['id']); } + /** + * @dataProvider dataGetPersonFromCenterA + */ + public function testPersonAddressSuggestion($personId): void + { + $client = $this->getClientAuthenticated(); + + $client->request(Request::METHOD_GET, "/api/1.0/person/address/suggest/by-person/{$personId}.json"); + + $this->assertResponseIsSuccessful(); + } + + /** + * @dataProvider dataGetPersonFromCenterB + */ + public function testPersonAddressSuggestionUnauthorized($personId): void + { + $client = $this->getClientAuthenticated(); + + $client->request(Request::METHOD_GET, "/api/1.0/person/address/suggest/by-person/{$personId}.json"); + $response = $client->getResponse(); + + $this->assertEquals(403, $response->getStatusCode()); + } + public function dataGetPersonFromCenterA(): \Iterator { self::bootKernel(); @@ -61,6 +86,8 @@ class PersonApiControllerTest extends WebTestCase yield \array_pop($personIds); yield \array_pop($personIds); + yield \array_pop($personIds); + yield \array_pop($personIds); } public function dataGetPersonFromCenterB(): \Iterator diff --git a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml index 71d5c119e..e89088c86 100644 --- a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml @@ -354,10 +354,35 @@ paths: description: "OK" 422: description: "Unprocessable entity (validation errors)" - 400: - description: "transition cannot be applyed" + /1.0/person/address/suggest/by-person/{id}.json: + get: + tags: + - address + summary: get a list of suggested address for a person + description: > + The address are computed from various source. Currently: + + - the address of course to which the person is participating + + The current person's address is always ignored. + parameters: + - name: id + in: path + required: true + description: The person id + schema: + type: integer + format: integer + minimum: 1 + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" /1.0/person/accompanying-course/{id}.json: get: From 886924a7e5cb2f61b37114b88c89d97cda0f515a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 29 Jul 2021 16:01:17 +0200 Subject: [PATCH 026/174] add address suggestion by household --- .../Controller/HouseholdApiController.php | 43 +++++++++++++++++ .../Controller/PersonApiController.php | 10 ++-- .../Controller/HouseholdApiControllerTest.php | 46 ++++++++++++++++++- .../ChillPersonBundle/chill.api.specs.yaml | 28 +++++++++++ 4 files changed, 122 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php index 1e15490dc..0bb804689 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php @@ -6,10 +6,12 @@ use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Serializer\Model\Collection; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Repository\Household\HouseholdRepository; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; +use Symfony\Component\Routing\Annotation\Route; class HouseholdApiController extends ApiController { @@ -50,4 +52,45 @@ class HouseholdApiController extends ApiController return $this->json($collection, Response::HTTP_OK, [], [ "groups" => ["read"]]); } + + /** + * @Route("/api/1.0/person/address/suggest/by-household/{household_id}.{_format}", + * name="chill_person_address_suggest_by_household", + * requirements={ + * "_format"="json" + * } + * ) + * @ParamConverter("household", options={"id" = "household_id"}) + */ + public function suggestAddressByHousehold(Household $household, string $_format) + { + // TODO add acl + + $addresses = []; + // collect addresses from location in courses + foreach ($household->getCurrentPersons() as $person) { + foreach ($person->getAccompanyingPeriodParticipations() as $participation) { + if (null !== $participation->getAccompanyingPeriod()->getAddressLocation()) { + $a = $participation->getAccompanyingPeriod()->getAddressLocation(); + $addresses[$a->getId()] = $a; + } + if (null !== $personLocation = $participation + ->getAccompanyingPeriod()->getPersonLocation()) { + $a = $personLocation->getCurrentHouseholdAddress(); + if (null !== $a) { + $addresses[$a->getId()] = $a; + } + } + } + } + + // remove the actual address + $actual = $household->getCurrentAddress(); + if (null !== $actual) { + $addresses = \array_filter($addresses, fn($a) => $a !== $actual); + } + + return $this->json(\array_values($addresses), Response::HTTP_OK, [], + [ 'groups' => [ 'read' ] ]); + } } diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index 62b61a942..b3f4087eb 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -77,13 +77,15 @@ class PersonApiController extends ApiController $a = $participation->getAccompanyingPeriod()->getAddressLocation(); $addresses[$a->getId()] = $a; } - if (null !== $participation->getAccompanyingPeriod()->getPersonLocation()) { - $a = $participation->getAccompanyingPeriod()->getAddressLocation(); - $addresses[$a->getId()] = $a; + if (null !== $personLocation = $participation + ->getAccompanyingPeriod()->getPersonLocation()) { + $a = $personLocation->getCurrentHouseholdAddress(); + if (null !== $a) { + $addresses[$a->getId()] = $a; + } } } - \array_unique($addresses); // remove the actual address $actual = $person->getCurrentHouseholdAddress(); if (null !== $actual) { diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php index f6adc5d01..273824782 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php @@ -4,6 +4,7 @@ namespace Chill\PersonBundle\Tests\Controller; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\MainBundle\Test\PrepareClientTrait; +use Chill\PersonBundle\Entity\Household\Household; use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -29,6 +30,21 @@ class HouseholdApiControllerTest extends WebTestCase $this->assertResponseIsSuccessful(); } + /** + * @dataProvider generateHouseholdId + */ + public function testSuggestAddressByHousehold(int $householdId) + { + $client = $this->getClientAuthenticated(); + + $client->request( + Request::METHOD_GET, + "/api/1.0/person/address/suggest/by-household/{$householdId}.json" + ); + + $this->assertResponseIsSuccessful(); + } + public function generatePersonId() { self::bootKernel(); @@ -51,5 +67,33 @@ class HouseholdApiControllerTest extends WebTestCase ->first()->getPerson(); yield [ $person->getId() ]; - } + } + + public function generateHouseholdId() + { + self::bootKernel(); + + $qb = self::$container->get(EntityManagerInterface::class) + ->createQueryBuilder(); + + $householdIds = $qb + ->select('DISTINCT household.id') + ->from(Household::class, 'household') + ->join('household.members', 'members') + ->join('members.person', 'person') + ->join('person.center', 'center') + ->where($qb->expr()->eq('center.name', ':center_name')) + ->andWhere($qb->expr()->gt('SIZE(person.accompanyingPeriodParticipations)', 0)) + ->setParameter('center_name', 'Center A') + ->setMaxResults(100) + ->getQuery() + ->getResult() + ; + + \shuffle($householdIds); + + yield [ \array_pop($householdIds)['id'] ]; + yield [ \array_pop($householdIds)['id'] ]; + yield [ \array_pop($householdIds)['id'] ]; + } } diff --git a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml index e89088c86..0684a352c 100644 --- a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml @@ -384,6 +384,34 @@ paths: 200: description: "OK" + /1.0/person/address/suggest/by-household/{id}.json: + get: + tags: + - address + summary: get a list of suggested address for a household + description: > + The address are computed from various source. Currently: + + - the address of course to which the members is participating + + The current household address is always ignored. + parameters: + - name: id + in: path + required: true + description: The household id + schema: + type: integer + format: integer + minimum: 1 + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" + /1.0/person/accompanying-course/{id}.json: get: tags: From a48d7f5e9475ddbf065ae01ceb104b70c1a5aee7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 31 Jul 2021 10:34:20 +0200 Subject: [PATCH 027/174] move styles from bootstrap custom to chill entrypoint. split chillmain with imports sheets. clean styles --- .../Resources/public/chill/chillmain.scss | 305 +++++++++++++++++- .../Resources/public/chill/css/chillmain.css | 25 -- .../Resources/public/chill/index.js | 3 +- .../_buttons.scss => chill/scss/buttons.scss} | 0 .../Resources/public/chill/scss/forms.scss | 39 +++ .../Resources/public/chill/scss/mixins.scss | 14 + .../scss/record_actions.scss} | 51 +-- .../public/module/bootstrap/_custom.scss | 280 +--------------- .../bootstrap/{shared.scss => _shared.scss} | 0 .../views/SingleTask/_list.html.twig | 38 +-- .../public/chill/chillthirdparty.scss | 57 ---- 11 files changed, 395 insertions(+), 417 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/chill/css/chillmain.css rename src/Bundle/ChillMainBundle/Resources/public/{module/bootstrap/custom/_buttons.scss => chill/scss/buttons.scss} (100%) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss rename src/Bundle/ChillMainBundle/Resources/public/{module/bootstrap/custom/_record_actions.scss => chill/scss/record_actions.scss} (71%) rename src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/{shared.scss => _shared.scss} (100%) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss index 97c5e3cc9..c1aa19213 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss @@ -4,23 +4,153 @@ // Chill mixins @import './scss/mixins'; +// Chill buttons +@import './scss/buttons'; + +// Chill forms +@import './scss/forms'; + +// Chill record_actions +@import './scss/record_actions'; + // Chill entity render box system @import './scss/render_box'; // Chill flex responsive table/block presentation @import './scss/flex_table'; + /* - * Specific rules + * BASE LAYOUT POSITION */ -.custom_field_no_data, -.chill-no-data-statement { - font-style: italic; +body { + display: flex; + flex-direction: column; + min-height: 100vh; + footer { + margin-top: auto; + } +} + +header { + nav.navbar { + padding: 0; + a.navbar-brand img { + height: 50px; + margin: 8px 0; + } + div.navbar-collapse { + float: right; + } + ul.navbar-nav { + display: flex; + align-items: stretch; + li.nav-item { + display: flex; + &.btn { + padding-top: 0; + padding-bottom: 0; + } + & > a { + align-self: center; + } + form.form-inline { + align-self: center; + display: flex; + input.form-control { + align-self: center; + height: 32px; + } + } + } + } + div.dropdown-menu { + margin: 0; + padding: 0; + border-radius: 0; + a.dropdown-item { + width: 120%; + border: 0; + border-bottom: 1px solid $gray-200; + font-size: smaller; + i { + float: right; } + &:hover { + color: $gray-500 !important; } + } + } + + // fullwidth menu when navbar is collapsed + @media (max-width: 767px) { + & { + position: relative; + } + button.navbar-toggler { + float: right; + } + div.navbar-collapse { + float: none; + position: absolute; + top: 4em; + left: 0; + right: 0; + z-index: 2; + padding: 1em; + border-top: 1px solid shade-color($primary, 25%); + ul.navbar-nav { + display: grid; + grid-template-areas: + "sear sear sear" + "sect user lang"; + li.nav-item { + flex-direction: column; + border: 0; + a.nav-link {} + &.navigation-search { + grid-area: sear; + margin-bottom: 1em; + form { + width: 100%; + input.form-control {} + button.btn {} + } + } + &.nav-section { grid-area: sect; } + &.nav-user { grid-area: user; } + &.nav-language { grid-area: lang; } + } + li.dropdown { + &, & > * { + background-color: transparent !important; + } + a.dropdown-toggle {} + div.dropdown-menu { + display: block; + border: 0; + a.dropdown-item { + width: 100%; + border: 0; + border-top: 1px dotted $gray-200; + background-color: transparent !important; + } + } + } + } + } + } + + } } -// styles communs pour tous les bandeaux div.banner { + a { + text-decoration: none; + &.phone, + &.email { + color: white; + } + } .id-number { font-weight: lighter; font-size: 50%; @@ -28,17 +158,166 @@ div.banner { &:before { content: '(n°'; } &:after { content: ')'; } } - a.phone, - a.email { - color: white; - } - ul.list-content { - //margin: 0 auto; - } span.age { margin-left: 0.5em; &:before { content: '('; } &:after { content: ')'; } } - +} + +div.vertical-menu { + border-radius: 0; + margin-top: 0.5rem; + a.list-group-item { + background-color: $chill-yellow; + border: 0; + margin-bottom: 0.25rem; + &:hover { + background-color: tint-color($chill-yellow, 20%) + } + } +} + +footer.footer { + background: $dark; + padding-top: 10px; + padding-bottom: 10px; + width: 100%; + p { + font-family: Open Sans; + font-weight: 300; + clear: both; + color: $white; + font-size: 0.9em; + line-height: 1.5em; + margin: auto; + max-width: 35em; + text-align: center; + a, a:hover { + text-decoration: underline; + } + } +} + + +/* + * SPECIFIC RULES + */ + +/// titles +h1, h2, +.h1, .h2 { + font-weight: $headings-font-weight + 200; +} + +/// typography +.open_sansbold { + font-weight: bold; +} + +/// no borders on head table +table.table-bordered { + thead, thead * { + border: 0 !important; + text-align: center; + } +} + +/// chill elements of design +.chill-user-quote { + border-left: 10px solid $yellow; + margin: 1.5em 10px; + padding: 0.5em 15px; + quotes: "\201C" "\201D" "\2018" "\2019"; + background-color: $gray-200; + blockquote { + border-left: 0.4em solid $gray-400; + padding-left: 0.9em; + margin-left: 0.9em; + font-style: italic; + } +} + +.custom_field_no_data, +.chill-no-data-statement { + font-style: italic; +} + +//// still used ? +// move from chillmain.css, converted to sass + +div#usefulbar { + background-color: #fbba3a; + z-index: 1000; + padding-right: 15px; + + form { + margin: 0; + } + i.menu { + font-size: 2em; + } + ul { + display: flex; + justify-content: flex-end; + margin: 0; + padding-top: 5px; + padding-right: 10px; + } + li { + color: white; + margin-left: 10px; + a { + color: white; + text-shadow: 0px 0px 1px #555; + } + i.icon-user-add { + &:before { + vertical-align: -5px; + } + } + &#search_element { + text-align: right; + } + &#search_element div#search_form { + margin: 0; + padding: 0; + button { + color: white; + border: none; + bottom: -2px; + height: 35px; + } + } + &#search_element div#search_form { + div, .field { + margin: 0; + } + } + } +} + +div#flashMessages { + margin-top: 20px; + .flash-notice { + margin-top: 10px; + margin-bottom: 10px; + } +} + +.personName { + font-variant: small-caps; + text-transform: capitalize; +} + +input.belgian_national_number_inversed_date { + width: 7em; + margin-right: 1em; +} +input.belgian_national_number_daily_counter { + width: 4em; + margin-right: 1em; +} +input.belgian_national_number_control_digit { + width: 3em; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/css/chillmain.css b/src/Bundle/ChillMainBundle/Resources/public/chill/css/chillmain.css deleted file mode 100644 index 85c247173..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/css/chillmain.css +++ /dev/null @@ -1,25 +0,0 @@ -div#usefulbar { background-color: #fbba3a; z-index: 1000; padding-right: 15px; } -div#usefulbar form { margin: 0; } -div#usefulbar i.menu { font-size: 2em; } -div#usefulbar ul { display: flex; justify-content: flex-end; margin: 0; padding-top: 5px; padding-right: 10px; } -div#usefulbar li { color: white; margin-left: 10px; } -div#usefulbar li a { color: white; text-shadow: 0px 0px 1px #555; } -div#usefulbar li i.icon-user-add:before { vertical-align: -5px; } -div#usefulbar li#search_element { text-align: right; } -div#usefulbar li#search_element div#search_form { margin: 0; padding: 0; } -div#usefulbar li#search_element div#search_form div { margin: 0; } -div#usefulbar li#search_element div#search_form .field { margin: 0; } -div#usefulbar li#search_element div#search_form button { color: white; border: none; bottom: -2px; height: 35px; } - -div#flashMessages { margin-top: 20px; } -div#flashMessages .flash-notice { margin-top: 10px; margin-bottom: 10px; } - -.personName { font-variant: small-caps; text-transform: capitalize; } - -.personName { text-transform: capitalize; } - -input.belgian_national_number_inversed_date { width: 7em; margin-right: 1em; } - -input.belgian_national_number_daily_counter { width: 4em; margin-right: 1em; } - -input.belgian_national_number_control_digit { width: 3em; } \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js index cf7365631..84f11fa43 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js @@ -14,12 +14,12 @@ global.select2 = select2; require('select2/dist/css/select2.css'); require('select2-bootstrap-theme/dist/select2-bootstrap.css'); + /* * Load Chill themes assets */ require('./chillmain.scss'); -require('./css/chillmain.css'); import { chill } from './js/chill.js'; global.chill = chill; @@ -34,6 +34,7 @@ require('./img/favicon.ico'); require('./img/logo-chill-sans-slogan_white.png'); require('./img/logo-chill-outil-accompagnement_white.png'); + /* * Load local libs * Some libs are only used in a few pages, they are loaded on a case by case basis diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss similarity index 100% rename from src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_buttons.scss rename to src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss new file mode 100644 index 000000000..078e43787 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss @@ -0,0 +1,39 @@ +/// forms +form { + + /* avoid useless html in first level of the custom fields row loop in forms + * (better should to improve the loop) + */ + & > div.container-fluid { + & > div.row > .parent { + padding: 0; + & div.cf-fields span.cf-title { + margin: 1em -15px 0; + width: calc(100% + 30px); + @include title_in_form; + } + } + } + + fieldset { + margin-top: 1em; + & > legend { + @include title_in_form; + } + } + + label { + display: inline; + &.required:after { + content: " *"; + color: $red; + } + } +} + +.col-form-label { + padding-top: .5em; + padding-bottom: .5em; + font-weight: 700; + margin-bottom: .375em; +} diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss index 22e1d310e..ad7244af7 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss @@ -1,4 +1,18 @@ +// +// +// + +@mixin title_in_form { + font-size: 1.438em; + font-weight: 700; + width: 100%; + border-bottom: 3px solid $gray-200; + margin-bottom: 1em; + display: block; +} + + // We use box-shadow instead of border // to avoid to manage border double-width // Then we can simulate border-collapse: collapse (table) diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_record_actions.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss similarity index 71% rename from src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_record_actions.scss rename to src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss index 8ddc1b009..efedac51d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_record_actions.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss @@ -1,13 +1,22 @@ -ul.record_actions, -ul.record_actions_column { +ul.record_actions { display: flex; + flex-direction: row; + flex-wrap: wrap-reverse; justify-content: flex-end; + padding: 0.5em 0; - &.record_actions--left { + &.column { + flex-direction: column; + } + + &.left { justify-content: flex-start; } - padding: 0.5em 0; - flex-wrap: wrap-reverse; + + &.sticky-form-buttons { + padding-left: 1em; + padding-right: 1em; + } li { display: inline-block; @@ -18,37 +27,33 @@ ul.record_actions_column { &:last-child { margin-right: 0; } - } - li.cancel { - order: 1; - margin-right: auto; + &.cancel { + order: 1; + margin-right: auto; + } } } - -ul.record_actions { - flex-direction: row; -} - -ul.record_actions_column { - flex-direction: column; -} - -ul.record_actions.sticky-form-buttons { - padding-left: 1em; - padding-right: 1em; +.sticky-form-buttons { + margin-top: 4em; + background-color: $beige; + position: sticky; + bottom: 0.3em; + text-align: center; + display: flex; + padding: 0.8em 1.6em; + border-radius: 0; } +/// EXCEPTIONS // inside table exceptions table { - td ul.record_actions, ul.record_actions_small { li { margin-right: 0.2em; } } - ul.record_actions { margin: 0; padding: 0.5em; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss index 17ca68d49..9d632026f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss @@ -1,284 +1,6 @@ /* * These custom styles will override bootstrap enabled stylesheets + * in mod_bootstrap entrypoint */ -/// chill buttons -@import 'custom/_buttons'; -// chill record_actions -@import 'custom/_record_actions'; - -/// titles -h1, h2, .h1, .h2 { - font-weight: $headings-font-weight + 200; -} - -/// typography -.open_sansbold { - font-weight: bold; -} - -/// forms - -@mixin title_in_form { - font-size: 1.438em; - font-weight: 700; - width: 100%; - border-bottom: 3px solid $gray-200; - margin-bottom: 1em; - display: block; -} - -.col-form-label { - padding-top: .5em; - padding-bottom: .5em; - font-weight: 700; - margin-bottom: .375em; -} - -form { - /* avoid useless html in first level of the custom fields row loop in forms - * (better should to improve the loop) - */ - & > div.container-fluid { - & > div.row > .parent { - padding: 0; - & div.cf-fields span.cf-title { - margin: 1em -15px 0; - width: calc(100% + 30px); - @include title_in_form; - } - } - } - fieldset { - margin-top: 1em; - & > legend { - @include title_in_form; - } - } - label { - display: inline; - &.required:after { - content: " *"; - color: $red; - } - } -} - -/// table - -table.table-bordered { - thead, thead * { - border: 0 !important; - text-align: center; - } -} - -/// chill elements of design - -.sticky-form-buttons { - margin-top: 4em; - background-color: $beige; - position: sticky; - bottom: 0.3em; - text-align: center; - display: flex; - padding: 0.8em 1.6em; - border-radius: 0; -} - -.chill-user-quote { - border-left: 10px solid $yellow; - margin: 1.5em 10px; - padding: 0.5em 15px; - quotes: "\201C" "\201D" "\2018" "\2019"; - background-color: $gray-200; - blockquote { - border-left: 0.4em solid $gray-400; - padding-left: 0.9em; - margin-left: 0.9em; - font-style: italic; - } -} - -div.chill_address { - div.chill_address_address { - margin: 0.7em 0; - font-size: 98%; - font-variant: small-caps; - p { - display: inline-block; - margin: 0 0 0 1.5em; - text-indent: -1.5em; - } - } -} - -/// base layout positions - -body { - display: flex; - flex-direction: column; - min-height: 100vh; - footer { - margin-top: auto; - } -} - -header { - nav.navbar { - padding: 0; - a.navbar-brand img { - height: 50px; - margin: 8px 0; - } - div.navbar-collapse { - float: right; - } - ul.navbar-nav { - display: flex; - align-items: stretch; - li.nav-item { - display: flex; - &.btn { - padding-top: 0; - padding-bottom: 0; - } - & > a { - align-self: center; - } - form.form-inline { - align-self: center; - display: flex; - input.form-control { - align-self: center; - height: 32px; - } - } - } - } - div.dropdown-menu { - margin: 0; - padding: 0; - border-radius: 0; - a.dropdown-item { - width: 120%; - border: 0; - border-bottom: 1px solid $gray-200; - font-size: smaller; - i { - float: right; } - &:hover { - color: $gray-500 !important; } - } - } - - // fullwidth menu when navbar is collapsed - @media (max-width: 767px) { - & { - position: relative; - } - button.navbar-toggler { - float: right; - } - div.navbar-collapse { - float: none; - position: absolute; - top: 4em; - left: 0; - right: 0; - z-index: 2; - padding: 1em; - border-top: 1px solid shade-color($primary, 25%); - ul.navbar-nav { - display: grid; - grid-template-areas: - "sear sear sear" - "sect user lang"; - li.nav-item { - flex-direction: column; - border: 0; - a.nav-link {} - &.navigation-search { - grid-area: sear; - margin-bottom: 1em; - form { - width: 100%; - input.form-control {} - button.btn {} - } - } - &.nav-section { grid-area: sect; } - &.nav-user { grid-area: user; } - &.nav-language { grid-area: lang; } - } - li.dropdown { - &, & > * { - background-color: transparent !important; - } - a.dropdown-toggle {} - div.dropdown-menu { - display: block; - border: 0; - a.dropdown-item { - width: 100%; - border: 0; - border-top: 1px dotted $gray-200; - background-color: transparent !important; - } - } - } - } - } - } - - } -} - -div.banner { - div.header-name, - div.header-details { - div.row > div:first-child { - @media (min-width: 576px) { - //margin-left: 1.5em; - } - } - } - a { - text-decoration: none; - } -} - -div.vertical-menu { - border-radius: 0; - margin-top: 0.5rem; - a.list-group-item { - background-color: $chill-yellow; - border: 0; - margin-bottom: 0.25rem; - &:hover { - background-color: tint-color($chill-yellow, 20%) - } - } -} - -footer.footer { - background: $dark; - padding-top: 10px; - padding-bottom: 10px; - width: 100%; - p { - font-family: Open Sans; - font-weight: 300; - clear: both; - color: $white; - font-size: 0.9em; - line-height: 1.5em; - margin: auto; - max-width: 35em; - text-align: center; - a, a:hover { - text-decoration: underline; - } - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/shared.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_shared.scss similarity index 100% rename from src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/shared.scss rename to src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_shared.scss diff --git a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/_list.html.twig b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/_list.html.twig index 026e354c5..a5a867dcc 100644 --- a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/_list.html.twig +++ b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/_list.html.twig @@ -10,17 +10,17 @@
            {{ task.title }}
            - + {% if person is null %}
            {{ 'For person'|trans }} : {{ task.person}}
            {% endif %} - +
            {{ task_workflow_metadata(task, 'definition.name')|trans }}
            - +
            {% for place in workflow_marked_places(task) %} {{ place|trans }} @@ -29,10 +29,10 @@
            {{ 'By'|trans }} : {{ task.assignee.username }}
            {% endif %}
            - + {% if task.startDate is not null or task.warningDate is not null or task.endDate is not null %}
            -
              +
                {% if task.startDate is not null %}
              • {{ task.startDate|format_date('medium') }} @@ -51,14 +51,14 @@
            {% endif %} - +
    {% if workflow_transitions(task)|length > 0 %}
  • - @@ -75,17 +75,17 @@
  • {% endif %} - +
  • - + {% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
  • {% endif %} - + {% if is_granted('CHILL_TASK_TASK_DELETE', task) %}
  • @@ -152,29 +152,29 @@

    {{ 'Filter the tasks'|trans }}

    {{ form_start(form) }} {{ form_row(form.user_id) }} - + {% if form.status is defined %} {{ form_row(form.status) }} {% endif %} - + {% if form.types is defined %} {{ form_row(form.types) }} {% endif %} - + {% if form.person_id is defined %} {{ form_row(form.person_id) }} {% endif %} - + {% if form.center_id is defined %} {{ form_row(form.center_id) }} {% endif %} - +
    - + {{ form_end(form)}} {% endif %} @@ -192,11 +192,11 @@
{% endif %} {% else %} - + {% if false == app.request.query.boolean('hide_form', false) %}

{{ 'Tasks'|trans }}

{% endif %} - + {% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
  • @@ -208,7 +208,7 @@
{% endif %} - + {% if single_task_ended_tasks is defined %} {{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }} {% endif %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss index 4ce6956c3..7651cd382 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss @@ -1,4 +1,3 @@ - /// render_box section.chill-entity { .entity-thirdparty { @@ -6,59 +5,3 @@ section.chill-entity { } } -/* AVANT - border: 1px solid black; - background-color: rgba(255, 255, 255, 0.65); - padding: 1em; - margin: 1em 0; - max-width: 500px; - - div.name { - font-variant: small-caps; - } - - div.category { - margin: 0.5em 0; - font-size: 85%; - - span.category { - font-style: italic; - } - span::before { - margin-left: 0.5em; - margin-right: 0.5em; - font-family: 'ForkAwesome'; - content: '\f02e'; - font-style: normal; - } - } - - div.comment { - font-size: 85%; - font-style: italic; - } - - div.chill_address { - div.chill_address_address::before { - margin-left: 0.5em; - margin-right: 0.5em; - font-family: 'ForkAwesome'; - content: '\f015'; - } - } - - div.contact { - font-variant: small-caps; - span::before { - margin-left: 0.5em; - margin-right: 0.5em; - font-family: 'ForkAwesome'; - } - span.email::before { - content: '\f1fa'; - } - span.telephone::before { - content: '\f095'; - } - } - */ From 9764ee1794d4aa3633d4207937a06193dcdcf0e7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 31 Jul 2021 11:00:37 +0200 Subject: [PATCH 028/174] styles, replace colors by variables, minor changes with colors --- .../Resources/public/chill/chillmain.scss | 43 +++++++++++-------- .../public/chill/scss/flex_table.scss | 7 ++- .../module/bootstrap/custom/_variables.scss | 8 ++-- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss index c1aa19213..5f57dd1bc 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss @@ -148,7 +148,7 @@ div.banner { text-decoration: none; &.phone, &.email { - color: white; + color: $white; } } .id-number { @@ -247,7 +247,7 @@ table.table-bordered { // move from chillmain.css, converted to sass div#usefulbar { - background-color: #fbba3a; + background-color: $yellow; z-index: 1000; padding-right: 15px; @@ -265,11 +265,11 @@ div#usefulbar { padding-right: 10px; } li { - color: white; + color: $white; margin-left: 10px; a { - color: white; - text-shadow: 0px 0px 1px #555; + color: $white; + text-shadow: 0px 0px 1px $gray-600; } i.icon-user-add { &:before { @@ -278,20 +278,18 @@ div#usefulbar { } &#search_element { text-align: right; - } - &#search_element div#search_form { - margin: 0; - padding: 0; - button { - color: white; - border: none; - bottom: -2px; - height: 35px; - } - } - &#search_element div#search_form { - div, .field { + div#search_form { margin: 0; + padding: 0; + div, .field { + margin: 0; + } + button { + color: $white; + border: none; + bottom: -2px; + height: 35px; + } } } } @@ -310,6 +308,8 @@ div#flashMessages { text-transform: capitalize; } +// probably used in client chill. +// think to rename like above input.belgian_national_number_inversed_date { width: 7em; margin-right: 1em; @@ -321,3 +321,10 @@ input.belgian_national_number_daily_counter { input.belgian_national_number_control_digit { width: 3em; } + +// +input.belgian_national_number { + &.inversed_date {} + &.daily_counter {} + &.control_digit {} +} diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index c01ebc41d..2573e7387 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -41,7 +41,7 @@ div.flex-bloc { &:first-child { flex-grow: 0; flex-shrink: 0; flex-basis: auto; padding-bottom: 0.5em; - border-bottom: 1px dotted #0000004f; + border-bottom: 1px dotted $gray-900; margin-bottom: 0.5em; } &:last-child { @@ -79,6 +79,9 @@ div.flex-table { padding: 1em; &:nth-child(even) { background-color: $gray-200; + .chill-user-quote { + background-color: $gray-100; + } } div.item-row { @@ -86,7 +89,7 @@ div.flex-table { flex-direction: row; &:not(:first-child) { margin-top: 0.5em; - border-top: 1px dotted #0000004f; + border-top: 1px dotted $gray-900; padding-top: 0.5em; flex-direction: column; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss index dc2a722cf..04cf765e0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss @@ -14,7 +14,7 @@ $gray-400: #ced4da !default; $gray-500: #b2b2b2 !default; $gray-600: #6c757d !default; $gray-700: #495057 !default; -$gray-800: #333333 !default; +$gray-800: #2c2d2f !default; $gray-900: #212529 !default; $black: #111 !default; // scss-docs-end gray-color-variables @@ -160,7 +160,7 @@ $chill-pink: $pink; $chill-gray: $gray-600; $chill-dark-gray: $gray-800; $chill-light-gray: $gray-200; -$chill-llight-gray: $gray-100; +$chill-llight-gray: $gray-100; // scss-docs-end theme-color-variables // scss-docs-start theme-colors-map @@ -176,7 +176,7 @@ $theme-colors: ( ) !default; // scss-docs-end theme-colors-map -$chill-colors: ( +$chill-colors: ( "chill-blue": $chill-blue, "chill-green": $chill-green, "chill-green-dark": $chill-green-dark, @@ -382,7 +382,7 @@ $border-color: $gray-300 !default; // scss-docs-end border-variables // scss-docs-start border-radius-variables -$border-radius: .25rem !default; // <== +$border-radius: .25rem !default; // <== $border-radius-sm: .2rem !default; $border-radius-lg: .3rem !default; $border-radius-pill: 50rem !default; From 1325355ca778b57067a14c377955f1d6ed74bfd4 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 31 Jul 2021 13:14:31 +0200 Subject: [PATCH 029/174] revert flashbag wrapper class --- .../Resources/views/layout.html.twig | 37 +++++++++++-------- .../views/layoutWithVerticalMenu.html.twig | 37 +++++++++++-------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig index 140557d69..3b1fe5041 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig @@ -53,23 +53,30 @@ {% block sublayout_content %}
- {% for flashMessage in app.session.flashbag.get('success') %} -
- {{ flashMessage|raw }} -
- {% endfor %} + {# Flash messages ! #} + {% if app.session.flashbag.keys()|length > 0 %} +
- {% for flashMessage in app.session.flashbag.get('error') %} -
- {{ flashMessage|raw }} -
- {% endfor %} + {% for flashMessage in app.session.flashbag.get('success') %} +
+ {{ flashMessage|raw }} +
+ {% endfor %} - {% for flashMessage in app.session.flashbag.get('notice') %} -
- {{ flashMessage|raw }} -
- {% endfor %} + {% for flashMessage in app.session.flashbag.get('error') %} +
+ {{ flashMessage|raw }} +
+ {% endfor %} + + {% for flashMessage in app.session.flashbag.get('notice') %} +
+ {{ flashMessage|raw }} +
+ {% endfor %} + +
+ {% endif %} {% block content %} {% if cFGroup and (cFGroup.getActiveCustomFields|length > 0) %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 57b051d68..048d4a61a 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -23,7 +23,7 @@ nationality: nationalité 'Without nationality': 'Sans nationalité' Gender: Genre gender: genre -Gender comment: Remarque sur le genre +Gender comment: Remarques sur le genre 'Creation date': 'Date d''ouverture' 'Not given': 'Non renseigné' 'Place of birth': 'Lieu de naissance' @@ -34,7 +34,7 @@ countryOfBirth: 'Pays de naissance' 'Unknown country of birth': 'Pays inconnu' 'Marital status': 'État civil' Date of last marital status change: État civil depuis le -Comment on the marital status: Commentaires sur l'état civil +Comment on the marital status: Remarques sur l'état civil 'Number of children': 'Nombre d''enfants' '{0} No child|{1} One child | ]1,Inf] %nb% children': '{0} Aucun enfant|{1} Un enfant | ]1,Inf] %nb% enfants' 'National number': 'Numéro national' From 6dae4785e653fdb6d9ee7d699d7112e3d93ea036 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 12:08:04 +0200 Subject: [PATCH 033/174] missing comment fields on person details page --- .../Resources/views/Person/view.html.twig | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig index aeaaeac37..db81ec320 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig @@ -107,7 +107,7 @@ This view should receive those arguments:
- {% if person.genderComment is not empty %} + {% if person.genderComment.comment is not empty %}

{{ 'Gender comment'|trans }} :

@@ -162,14 +162,16 @@ This view should receive those arguments: {% endif %} - {% if person.maritalStatusComment is not empty %} -
{{ 'Comment on the marital status'|trans }} :
-
+
{{ 'Comment on the marital status'|trans }} :
+
+ {% if person.maritalStatusComment.comment is not empty %}
{{ person.maritalStatusComment.comment|chill_markdown_to_html }}
-
- {% endif %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + {%- endif -%}
From 1c404e5cb3b62c77f1ebac147613401df3ae5613 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 13:23:06 +0200 Subject: [PATCH 034/174] lib/entity/comment_embeddable styles have been moved --- src/Bundle/ChillMainBundle/Resources/public/chill/index.js | 1 - .../Resources/public/lib/entity/comment_embeddable.scss | 1 - src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js | 2 -- 3 files changed, 4 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/lib/entity/comment_embeddable.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js index 84f11fa43..2e13bcc06 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js @@ -46,7 +46,6 @@ require('../lib/breadcrumb/index.js'); require('../lib/download-report/index.js'); require('../lib/select_interactive_loading/index.js'); require('../lib/export-list/index.js'); -require('../lib/entity/index.js'); //require('../lib/show_hide/index.js'); //require('../lib/tabs/index.js'); diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/entity/comment_embeddable.scss b/src/Bundle/ChillMainBundle/Resources/public/lib/entity/comment_embeddable.scss deleted file mode 100644 index 8b1378917..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/entity/comment_embeddable.scss +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js deleted file mode 100644 index c739899a5..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// css classes to render entities -require('./comment_embeddable.scss'); From 4c47105de1b5a12e698f4dd9853d4d46ce216828 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 13:43:09 +0200 Subject: [PATCH 035/174] flex-table column width auto; overwrite for specific use --- .../Resources/public/chill/scss/flex_table.scss | 12 ++++-------- .../Resources/public/chill/chillperson.scss | 8 ++++++++ .../views/AccompanyingCourse/index.html.twig | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index 526ad2787..4a569084f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -3,11 +3,13 @@ */ div.flex-bloc, div.flex-table { + margin: 1.5em 0; + h2, h3, h4, dl, p { margin: 0; } h2, h3, h4 { - color: var(--bs-chill-blue); + color: $blue; } div.item-bloc { @include border-collapse; @@ -48,8 +50,6 @@ div.flex-bloc { flex-grow: 1; flex-shrink: 1; flex-basis: auto; display: flex; - .list-content { // ul, dl, or div - } ul.record_actions { margin: 0; align-self: flex-end; @@ -96,15 +96,13 @@ div.flex-table { div.item-col { &:first-child { - flex-grow: 0; flex-shrink: 0; flex-basis: 33%; + flex-grow: 0; flex-shrink: 0; flex-basis: auto; } &:last-child { flex-grow: 1; flex-shrink: 1; flex-basis: auto; display: flex; justify-content: flex-end; - .list-content { // ul, dl, or div - } ul.record_actions { margin: 0; align-self: flex-start; @@ -126,8 +124,6 @@ div.flex-table { } } - // neutralize - div.chill_address div.chill_address_address p { text-indent: 0; } } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index dace93340..5beb5249b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -106,6 +106,14 @@ div#header-accompanying_course-details { padding-bottom: 1em; } +// flex-table precision +div.accompanyingcourse-resume { + div.associated-persons { + .flex-table .item-row .item-col:first-child { flex-basis: 33%; } + } +} + + /* * HOUSEHOLD CONTEXT * Header custom for Household diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index bb42a390a..8082a6387 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -36,7 +36,7 @@ {% if participation.enddate is null %}
{{ participation.person|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addInfo': true, + 'render': 'bloc', 'addLink': false, 'addInfo': true, 'addAltNames': false, 'customButtons': { 'before': _self.button_person(participation.person) } }) }}
From c4a8b85be505203277e336032c258c9d2ab9de93 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 13:47:08 +0200 Subject: [PATCH 036/174] template accompanying period list: buttons, flex-table (wip) --- .../Resources/public/chill/scss/buttons.scss | 18 ++- .../views/AccompanyingPeriod/_list.html.twig | 153 +++++++++--------- .../views/AccompanyingPeriod/list.html.twig | 66 ++++---- 3 files changed, 124 insertions(+), 113 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss index 6264a3a95..c2995e57d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss @@ -62,10 +62,10 @@ $chill-theme-buttons: ( &.btn-view::before, &.btn-save::before, &.btn-duplicate::before, - &.btn-not-duplicate::before, - &.btn-submit::before, - &.btn-reset::before, - &.btn-action::before, + // &.btn-not-duplicate::before, + // &.btn-submit::before, + // &.btn-reset::before, + // &.btn-action::before, &.btn-delete::before, &.btn-remove::before, &.btn-cancel::before { @@ -101,3 +101,13 @@ $chill-theme-buttons: ( color: $light; } } + +/// allow to hide icon (herited from scratch) +.btn { + &.change-icon { + &::before { + content: ''; + margin-right: 0; + } + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig index 7b4ac4a61..af358c01e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig @@ -1,39 +1,28 @@ {% block content %} - +
{% for accompanying_period in accompanying_periods %} -
+
- {{'period'|trans}} #{{ accompanying_period.id }} + #{{ accompanying_period.id }} {% if accompanying_period.emergency %} -   - - {{- 'Emergency'|trans|upper -}} - + {{- 'Emergency'|trans|upper -}} {% endif %} {% if accompanying_period.confidential %} -   - - {{- 'Confidential'|trans|upper -}} - + {{- 'Confidential'|trans|upper -}} {% endif %} {% if accompanying_period.step == 'DRAFT' %} -   - - {{- 'Draft'|trans|upper -}} - + {{- 'Draft'|trans|upper -}} {% else %} - - {{- 'Confirmed'|trans|upper -}} - + {{- 'Confirmed'|trans|upper -}} {% endif %}
{% if chill_accompanying_periods.fields.user == 'visible' %} {% if accompanying_period.user %} - {{ accompanying_period.user.username }} + {{ accompanying_period.user.username }} {% else %} {{ 'No accompanying user'|trans }} {% endif %} @@ -42,6 +31,7 @@
+ {% if accompanying_period.closingDate == null %} {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} {% else %} @@ -49,92 +39,95 @@ '%opening_date%': accompanying_period.openingDate|format_date('long'), '%closing_date%': accompanying_period.closingDate|format_date('long')} ) }} - {% if accompanying_period.isOpen == false %}
{{ 'Closing motive'|trans }} :
{{ accompanying_period.closingMotive|chill_entity_render_box }}
{% endif %} - {% endif %} +
- -
-

{{ 'Participants'|trans }}

- {% if accompanying_period.participations.count > 0 %} - {% for p in accompanying_period.participations %} -

- - {{ p.person.firstname ~ ' ' ~ p.person.lastname }} - -

- {% endfor %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -
-
-

{{ 'Requestor'|trans }}

- {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %} - {% if accompanying_period.requestorPerson is not null %} -

{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}

- {% endif %} - {% if accompanying_period.requestorThirdParty is not null %} -

{{ accompanying_period.requestorThirdParty.name }}

- {% endif %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -
- -
-

{{ 'Social issues'|trans }}

- {% if accompanying_period.socialIssues.count > 0 %} - {% for si in accompanying_period.socialIssues %} -

{{ si.title|localize_translatable_string }}

- {% endfor %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -
-
+ +

{{ 'Participants'|trans }}

+ {% if accompanying_period.participations.count > 0 %} + {% for p in accompanying_period.participations %} +

+ + {{ p.person.firstname ~ ' ' ~ p.person.lastname }} + +

+ {% endfor %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + +
+
+ +

{{ 'Requestor'|trans }}

+ {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %} + {% if accompanying_period.requestorPerson is not null %} +

{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}

+ {% endif %} + {% if accompanying_period.requestorThirdParty is not null %} +

{{ accompanying_period.requestorThirdParty.name }}

+ {% endif %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + +
+
+ +

{{ 'Social issues'|trans }}

+ {% if accompanying_period.socialIssues.count > 0 %} + {% for si in accompanying_period.socialIssues %} +

{{ si.title|localize_translatable_string }}

+ {% endfor %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + +
+
+ +
-
-
-

{% endfor %} - - +
{% endblock content %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig index 8ca4dd26e..4dc7a90aa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig @@ -5,36 +5,44 @@ {% block title %}{{ 'Person accompanying period - %name%'|trans({ '%name%' : person.__toString}) }}{% endblock title %} {% block personcontent %} -

{{ 'Accompanying period list'|trans }}

+
-{% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %} +

{{ 'Accompanying period list'|trans }}

- + {% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %} + + +
{% endblock %} From 4be4cd72795207f0cf5a92136681c7c224afefd8 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 13:50:59 +0200 Subject: [PATCH 037/174] remove Altnames in accompanyingCourse resume --- .../Resources/views/AccompanyingCourse/index.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 8082a6387..3294ba57c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -63,7 +63,7 @@
{{ requestor|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': info + 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': info, 'addAltNames': false }) }}
@@ -80,7 +80,7 @@
{% if r.person %} {{ r.person|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': true + 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': true, 'addAltNames': false }) }} {% endif %} {% if r.thirdParty %} From 48873d15c9d1c401f45027864b370a05ba3d4b64 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 15:21:03 +0200 Subject: [PATCH 038/174] ajust list_with_period search with person render_box (and add new options to it) --- .../public/chill/scss/flex_table.scss | 7 +- .../public/chill/scss/person_with_period.scss | 12 +- .../components/Concerned.vue | 6 +- .../components/MemberDetails.vue | 6 +- .../views/AccompanyingPeriod/_list.html.twig | 52 +-- .../Resources/views/Entity/person.html.twig | 11 +- .../views/Household/summary.html.twig | 12 +- .../Resources/views/Person/list.html.twig | 190 +++++------ .../Person/list_by_phonenumber.html.twig | 170 +++++----- .../views/Person/list_with_period.html.twig | 298 ++++++++---------- .../Templating/Entity/PersonRender.php | 2 + 11 files changed, 378 insertions(+), 388 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index 4a569084f..ec2bfae95 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -87,6 +87,7 @@ div.flex-table { div.item-row { display: flex; flex-direction: row; + &:not(:first-child) { margin-top: 0.5em; border-top: 1px dotted $gray-900; @@ -100,13 +101,13 @@ div.flex-table { } &:last-child { flex-grow: 1; flex-shrink: 1; flex-basis: auto; + display: flex; justify-content: flex-end; - ul.record_actions { - margin: 0; - align-self: flex-start; flex-grow: 1; flex-shrink: 0; flex-basis: auto; + align-self: flex-start; + margin: 0; li { margin-right: 5px; } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss index 6be613ea3..ada9bce9d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss @@ -1,10 +1,12 @@ -/// complete and overwrite flex-table in chillmain.scss +/// overwrite flex-table +div.list-with-period { + div.flex-table div.item-row div.item-col:first-child { flex-basis: 33%; } +} + +/// div.list-with-period, div.list-household-members { - div.comment { - // for the comment for household-members - } div.periods { div.header, div.list-content { @@ -13,7 +15,7 @@ div.list-household-members { } div.header { position: relative; - a.sc-button { + a.btn { position: absolute; width: 30px; height: 30px; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue index eb611c9c1..9399f9245 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue @@ -22,8 +22,8 @@ class="item-bloc" v-bind:key="conc.person.id" > -
-
+
+
@@ -33,7 +33,7 @@
-
+
  • diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue index b55b6247c..e153373a1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue @@ -1,7 +1,7 @@ @@ -36,7 +37,7 @@ {{ $t('action.edit')}} @@ -51,8 +52,9 @@ v-bind:default="this.default" v-bind:entity="this.entity" v-bind:flag="this.flag" + ref="showAddress" v-bind:insideModal="false" @openEditPane="openEditPane" - @submitAddress="$emit('submitAddress', { getSubmited , flag })"> + @submitAddress="submitAddress">
@@ -122,8 +124,7 @@ import { export default { name: "AddAddress", - props: ['context', 'options'], - emits: ['submitAddress'], + props: ['context', 'options', 'result'], components: { Modal, ShowAddress, @@ -173,6 +174,10 @@ export default { zoom: 12 }, }, + valid: { + from: null, + to: null + }, errorMsg: [] } }, @@ -197,11 +202,8 @@ export default { return (this.context.edit) ? this.options.title.edit : this.options.title.create; } return (this.context.edit) ? this.default.title.edit : this.default.title.create; - }, - - getSubmited() { - return this.entity.address; } + }, mounted() { if (!this.step1WithModal) { @@ -221,11 +223,13 @@ export default { } this.flag.showPane = true; }, + openEditPane() { console.log('open the Edit panel'); this.initForm(); this.getCountries(); }, + closeEditPane() { console.log('close the Edit Panel (with validation)'); this.applyChanges(); @@ -373,7 +377,6 @@ export default { * then update existing address with backend datas when promise is resolved */ updateAddress(payload) { - console.log('updateAddress payload', payload); // TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode this.flag.loading = true; @@ -387,7 +390,6 @@ export default { body.postcode = {'id': postalCode.id }, patchAddress(payload.addressId, body) .then(address => new Promise((resolve, reject) => { - console.log('update address'); this.entity.address = address; this.flag.loading = false; resolve(); @@ -401,7 +403,6 @@ export default { } else { patchAddress(payload.addressId, payload.newAddress) .then(address => new Promise((resolve, reject) => { - console.log('update address'); this.entity.address = address; this.flag.loading = false; resolve(); @@ -418,7 +419,6 @@ export default { * creating new address, and receive backend datas when promise is resolved */ addAddress(payload) { - console.log('addAddress payload', payload); this.flag.loading = true; if('newPostcode' in payload){ @@ -431,7 +431,6 @@ export default { body.postcode = {'id': postalCode.id}, postAddress(body) .then(address => new Promise((resolve, reject) => { - console.log('add address'); this.entity.address = address; resolve(); this.flag.loading = false; @@ -445,7 +444,6 @@ export default { } else { postAddress(payload) .then(address => new Promise((resolve, reject) => { - console.log('add address'); this.entity.address = address; resolve(); this.flag.loading = false; @@ -455,9 +453,52 @@ export default { this.flag.loading = false; }); } + }, + + /* + * When submited + */ + submitAddress() { + console.log('@@@ CLICK button submitAddress'); + this.addDateToAddressAndAddressToPerson({ + personId: this.context.personId, + addressId: this.entity.address.address_id, + body: { validFrom: { datetime: `${this.$refs.showAddress.validFrom}T00:00:00+0100`}}, + backUrl: this.context.backUrl + }); + this.initForm(); + this.flag.showPane = false; + }, + + addDateToAddressAndAddressToPerson(payload) { + console.log('addDateToAddressAndAddressToPerson payload', payload); + this.flag.loading = true; + patchAddress(payload.addressId, payload.body) + .then(address => new Promise((resolve, reject) => { + this.valid.from = address.validFrom; + resolve(); + }).then( + postAddressToPerson(payload.personId, payload.addressId) + .then(person => new Promise((resolve, reject) => { + + console.log('commit addAddressToPerson !!!', person); + this.result = person; + + this.flag.loading = false; + this.flag.success = true; + window.location.assign(payload.backUrl); + resolve(); + })) + .catch((error) => { + this.errorMsg.push(error); + this.flag.loading = false; + }) + )) + .catch((error) => { + this.errorMsg.push(error); + this.flag.loading = false; + }); } - - } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddress.vue index c59104aca..e19c4f333 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddress.vue @@ -20,41 +20,63 @@ {{ address.country.name.fr }}

+
+
+ + {{ $t('floor') }}: {{ address.floor }} + +
+
+ + {{ $t('corridor') }}: {{ address.corridor }} + +
+
+ + {{ $t('steps') }}: {{ address.steps }} + +
+
+ + {{ $t('flat') }}: {{ address.flat }} + +
+
+ + {{ $t('buildingName') }}: {{ address.buildingName }} + +
+
+ + {{ $t('extra') }}: {{ address.extra }} + +
+
+ + {{ $t('distribution') }}: {{ address.distribution }} + +
+
-
- - {{ $t('floor') }}: {{ address.floor }} - -
-
- - {{ $t('corridor') }}: {{ address.corridor }} - -
-
- - {{ $t('steps') }}: {{ address.steps }} - -
-
- - {{ $t('flat') }}: {{ address.flat }} - -
-
- - {{ $t('buildingName') }}: {{ address.buildingName }} - -
-
- - {{ $t('extra') }}: {{ address.extra }} - -
-
- - {{ $t('distribution') }}: {{ address.distribution }} - +
+

{{ $t('date') }}

+
+ + +
+ +
+ {{ $t('loading') }} +
+
+ {{ $t('person_address_creation_success') }} +
@@ -93,7 +115,7 @@ export default { 'errorMsg', 'insideModal' ], - emits: ['openEditPane', 'submitAddress'], + emits: ['openEditPane', 'submitAddress', 'validFrom'], computed: { address() { return this.entity.address; @@ -109,6 +131,9 @@ export default { }, getSubmited() { return this.entity.address; + }, + validFrom() { + return new Date().toISOString().split('T')[0]; } } }; From 94b0432bb91f1e61f7dd69d44be191fef883ef36 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Wed, 12 May 2021 15:54:05 +0200 Subject: [PATCH 055/174] Removing spaces at the end of line --- .../DependencyInjection/ChillPersonExtension.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index c9ad36319..3745c6849 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -355,6 +355,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'actions' => [ '_entity' => [ 'roles' => [ +<<<<<<< HEAD Request::METHOD_GET => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, Request::METHOD_PATCH => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, Request::METHOD_PUT => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, @@ -363,6 +364,9 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_GET => true, Request::METHOD_PUT => true, Request::METHOD_PATCH => true, +======= + Request::METHOD_GET => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE +>>>>>>> Removing spaces at the end of line ] ], 'participation' => [ @@ -376,6 +380,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, Request::METHOD_DELETE=> \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE ] +<<<<<<< HEAD ], 'resource' => [ 'methods' => [ @@ -462,6 +467,10 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, ] ], +======= + ] + +>>>>>>> Removing spaces at the end of line ] ], [ From c32ca59c76b6372e2bee7c62e523dd53c06af83f Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Wed, 12 May 2021 15:57:19 +0200 Subject: [PATCH 056/174] Removing spaces at the end of line --- src/Bundle/ChillPersonBundle/config/services.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/config/services.yaml b/src/Bundle/ChillPersonBundle/config/services.yaml index aedea4396..922081d05 100644 --- a/src/Bundle/ChillPersonBundle/config/services.yaml +++ b/src/Bundle/ChillPersonBundle/config/services.yaml @@ -2,9 +2,12 @@ parameters: # cl_chill_person.example.class: Chill\PersonBundle\Example services: +<<<<<<< HEAD _defaults: autowire: true autoconfigure: true +======= +>>>>>>> Removing spaces at the end of line Chill\PersonBundle\Service\: resource: '../Service/' From 25eee8869320f0dd8c93fb543cd55ea23c0cd2c2 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Tue, 18 May 2021 10:56:36 +0200 Subject: [PATCH 057/174] Add license text --- .../SocialWork/SocialIssueRepository.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php index b0324ba33..51ced6976 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php @@ -1,6 +1,25 @@ , + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ namespace Chill\PersonBundle\Repository\SocialWork; From ad5eed4c2654f48993c101f37b7e39145f041e12 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Tue, 18 May 2021 16:24:27 +0200 Subject: [PATCH 058/174] SocialIssues became editable via admin --- .../SocialWork/AdminSocialIssueController.php | 33 ++++++++ .../ChillPersonExtension.php | 30 +++++-- .../Form/SocialWork/SocialIssueType.php | 83 +++++++++++++++++++ .../Repository/PersonRepository.php | 11 +++ .../SocialWork/SocialIssue/edit.html.twig | 12 +++ .../SocialWork/SocialIssue/index.html.twig | 27 ++++++ .../SocialWork/SocialIssue/new.html.twig | 11 +++ .../ChillPersonBundle/config/routes.yaml | 10 +++ .../ChillPersonBundle/config/services.yaml | 3 - .../config/services/form.yaml | 8 +- .../translations/messages.fr.yml | 7 ++ 11 files changed, 222 insertions(+), 13 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialIssueController.php create mode 100644 src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/edit.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/index.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/new.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialIssueController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialIssueController.php new file mode 100644 index 000000000..35b0df4a2 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialIssueController.php @@ -0,0 +1,33 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\PersonBundle\Controller\SocialWork; + +use Chill\MainBundle\CRUD\Controller\CRUDController; + +/** + * Class AdminSocialIssueController + * Controller for social issues + * + * @package Chill\PersonBundle\Controller + */ +class AdminSocialIssueController extends CRUDController +{ +} diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 3745c6849..ecc390f59 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -345,6 +345,27 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ] ] ], + [ + 'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class, + 'name' => 'social_issue', + 'base_path' => '/admin/social-issue', + 'form_class' => \Chill\PersonBundle\Form\SocialWork\SocialIssueType::class, + 'controller' => \Chill\PersonBundle\Controller\SocialWork\AdminSocialIssueController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/SocialIssue/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/SocialIssue/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/SocialWork/SocialIssue/edit.html.twig', + ] + ] + ] ], 'apis' => [ [ @@ -355,7 +376,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'actions' => [ '_entity' => [ 'roles' => [ -<<<<<<< HEAD Request::METHOD_GET => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, Request::METHOD_PATCH => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, Request::METHOD_PUT => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, @@ -364,9 +384,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_GET => true, Request::METHOD_PUT => true, Request::METHOD_PATCH => true, -======= - Request::METHOD_GET => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE ->>>>>>> Removing spaces at the end of line ] ], 'participation' => [ @@ -380,7 +397,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, Request::METHOD_DELETE=> \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE ] -<<<<<<< HEAD ], 'resource' => [ 'methods' => [ @@ -467,10 +483,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, ] ], -======= - ] - ->>>>>>> Removing spaces at the end of line ] ], [ diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php new file mode 100644 index 000000000..482ff60f3 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php @@ -0,0 +1,83 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +namespace Chill\PersonBundle\Form\SocialWork; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Chill\MainBundle\Form\Type\TranslatableStringFormType; +use Symfony\Component\Form\Extension\Core\Type\DateType; +use Chill\MainBundle\Templating\TranslatableStringHelper; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Chill\PersonBundle\Entity\SocialWork\SocialIssue; + +/** + * Class SocialIssueType + * + * @package Chill\PersonBundle\Form + */ +class SocialIssueType extends AbstractType +{ + /** + * + * @var TranslatableStringHelper + */ + protected $translatableStringHelper; + + public function __construct(TranslatableStringHelper $translatableStringHelper) { + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('title', TranslatableStringFormType::class, [ + 'label' => 'Nom' + ]) + + ->add('parent', EntityType::class, [ + 'class' => SocialIssue::class, + 'required' => false, + 'choice_label' => function (SocialIssue $issue) { + return $this->translatableStringHelper->localize($issue->getTitle()); + } + ]) + + ->add('desactivationDate', DateType::class, array( + 'attr' => array('class' => 'datepicker'), + 'widget'=> 'single_text', + 'format' => 'dd-MM-yyyy', + 'required' => false, + )); +} + + /** + * @param OptionsResolver $resolver + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', SocialIssue::class) + ; + } +} diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index d99ab590e..6686b55b7 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -18,11 +18,13 @@ namespace Chill\PersonBundle\Repository; + use Chill\PersonBundle\Entity\Person; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; + final class PersonRepository { private EntityRepository $repository; @@ -113,11 +115,20 @@ final class PersonRepository $qb->setParameter('phonenumber', '%'.$phonenumber.'%'); } + + /** + * @param $phonenumber + * @return string + */ protected function parsePhoneNumber(string $phonenumber): string { return \str_replace(' ', '', $phonenumber); } + /** + * @param QueryBuilder $qb + * @param array $centers + */ protected function addByCenters(QueryBuilder $qb, array $centers): void { if (count($centers) > 0) { diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/edit.html.twig new file mode 100644 index 000000000..0ae8754fe --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/edit.html.twig @@ -0,0 +1,12 @@ +{% extends '@ChillPerson/Admin/layout.html.twig' %} + +{% block title %} +{% 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 %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/index.html.twig new file mode 100644 index 000000000..44627852e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialIssue/index.html.twig @@ -0,0 +1,27 @@ +{% extends '@ChillPerson/Admin/layout.html.twig' %} + +{% block layout_wvm_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} +
{{ 'Id'|trans }}{{ 'Title'|trans }} 
{{ entity.id }}{{ entity.title|localize_translatable_string }} +
    +
  • + +
  • +
+
{{ 'Id'|trans }}{{ 'Title'|trans }} 
{{ entity.id }}{{ entity.title|localize_translatable_string }} +
    +
  • + +
  • +
+
{{ 'Id'|trans }}{{ 'Title'|trans }} 
{{ entity.id }}{{ entity.title|localize_translatable_string }} +
    +
  • + +
  • +
+
{{ 'Id'|trans }}{{ 'Title'|trans }} 
{{ entity.id }}{{ entity.title|localize_translatable_string }} +
    +
  • + +
  • +
+
{{ 'Id'|trans }}{{ 'Title'|trans }} 
{{ entity.id }}{{ entity.title|localize_translatable_string }} +
    +
  • + +
  • +
+