From 4fa1bb4341b6570f87bb7126cf1fb9915174cf88 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 12:45:02 +0100 Subject: [PATCH 01/32] demandeur not displayed in search list if anonymous --- .../views/Person/list_with_period.html.twig | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 6f107a593..708766dc2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -99,11 +99,12 @@ {% endif %}
- {% if acp.requestorPerson == person %} + {% if acp.requestoranonymous == false and acp.requestorPerson == person %} {{ 'Requestor'|trans({'gender': person.gender}) }} {% endif %} + {% if acp.emergency %} {{- 'Emergency'|trans|upper -}} {% endif %} @@ -186,39 +187,39 @@ - - {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} -
-
-

- {% if acp.requestorPerson is not null %} - {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} + {% if acp.requestoranonymous == false %} + {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} +
+
+

+ {% if acp.requestorPerson is not null %} + {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} + {% else %} + {{ 'Requestor'|trans({'gender': 'other'})}} + {% endif %} +

+
+
+ {% if acp.requestorThirdParty is not null %} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, + action: 'show', + displayBadge: true, + buttonText: acp.requestorThirdParty|chill_entity_render_string + } %} {% else %} - {{ 'Requestor'|trans({'gender': 'other'})}} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'person', id: acp.requestorPerson.id }, + action: 'show', + displayBadge: true, + buttonText: acp.requestorPerson|chill_entity_render_string, + isDead: acp.requestorPerson.deathdate is not null + } %} {% endif %} -

+
-
- {% if acp.requestorThirdParty is not null %} - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, - action: 'show', - displayBadge: true, - buttonText: acp.requestorThirdParty|chill_entity_render_string - } %} - {% else %} - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - targetEntity: { name: 'person', id: acp.requestorPerson.id }, - action: 'show', - displayBadge: true, - buttonText: acp.requestorPerson|chill_entity_render_string, - isDead: acp.requestorPerson.deathdate is not null - } %} - {% endif %} -
-
+ {% endif %} {% endif %} - {% endfor %} From 68d99050bc7554702dc594929429257e03797746 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:06:59 +0100 Subject: [PATCH 02/32] commentfield for marital status is always visible --- .../ChillPersonBundle/Resources/views/Person/edit.html.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index d394a75a8..dc71d9981 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -85,9 +85,11 @@
{{ form_row(form.maritalStatusDate, { 'label' : 'Date of last marital status change'} ) }} - {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }}
{%- endif -%} +
+ {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }} +
{%- endif -%} From faebb0fe30a7597d03dbc0a82d18436a83a9f3a7 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:08:55 +0100 Subject: [PATCH 03/32] changelog updated --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcd149841..92e3085e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ and this project adheres to * [parcours]: component added to change the opening date of a parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/411) * [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410) * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) - +* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) +* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) ## Test releases From bc1a63354cfd497fa6cab56142b7e675c279ec7d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:11:25 +0100 Subject: [PATCH 04/32] php csfixes --- .../Controller/UserAccompanyingPeriodController.php | 11 ++++++----- .../ChillPersonBundle/Entity/AccompanyingPeriod.php | 2 +- src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php | 3 --- .../Repository/AccompanyingPeriodRepository.php | 10 +++++----- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index ddaf1b856..aa849ac2b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -9,7 +9,6 @@ declare(strict_types=1); - namespace Chill\PersonBundle\Controller; use Chill\MainBundle\Pagination\PaginatorFactory; @@ -20,7 +19,6 @@ use Symfony\Component\Routing\Annotation\Route; class UserAccompanyingPeriodController extends AbstractController { - private AccompanyingPeriodRepository $accompanyingPeriodRepository; private PaginatorFactory $paginatorFactory; @@ -38,13 +36,16 @@ class UserAccompanyingPeriodController extends AbstractController { $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser()]); $pagination = $this->paginatorFactory->create($total); - $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $this->getUser()], - ['openingDate' => 'DESC'], $pagination->getItemsPerPage(), $pagination->getCurrentPageFirstItemNumber()); + $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy( + ['user' => $this->getUser()], + ['openingDate' => 'DESC'], + $pagination->getItemsPerPage(), + $pagination->getCurrentPageFirstItemNumber() + ); return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [ 'accompanyingPeriods' => $accompanyingPeriods, 'pagination' => $pagination, ]); - } } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index c457d2863..e7a1c514b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -212,7 +212,7 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) - * @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED}) * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index 3e56b423c..0a9d2a31c 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -12,9 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; -use Chill\TaskBundle\Templating\UI\CountNotificationTask; use Knp\Menu\MenuItem; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -25,7 +23,6 @@ class UserMenuBuilder implements LocalMenuBuilderInterface */ public $authorizationChecker; - /** * @var TranslatorInterface */ diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index 9554f2a3b..edb4b4f3d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -26,6 +26,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository $this->repository = $entityManager->getRepository(AccompanyingPeriod::class); } + public function countBy(array $criteria): int + { + return $this->repository->count($criteria); + } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); @@ -49,11 +54,6 @@ final class AccompanyingPeriodRepository implements ObjectRepository return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function countBy(array $criteria): int - { - return $this->repository->count($criteria); - } - public function findOneBy(array $criteria): ?AccompanyingPeriod { return $this->findOneBy($criteria); From 695d22adbad74e7af87f148207a02542a729343c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:39:52 +0100 Subject: [PATCH 05/32] bugfix creation of person or thirdparty through onTheFly --- .../Resources/public/vuejs/_components/AddPersons.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 59647e160..c880ad2fd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -299,6 +299,7 @@ export default { } }) } + this.canCloseOnTheFlyModal = false; } }, } From 15393d9da903188a32beb08e084ab609e55882d1 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:45:41 +0100 Subject: [PATCH 06/32] changelog updated with bugfix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92e3085e8..fe26e1978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) * [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) * [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) +* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429) ## Test releases From f358e78734c5195d8dc8877b25f8b33f7037c558 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 14:39:40 +0100 Subject: [PATCH 07/32] onthefly button added to view person or thirdparty + badge changed if thirdparty is a contact --- .../views/PersonResource/list.html.twig | 31 ++++++++++++++++--- .../translations/messages.fr.yml | 1 + 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig index 820da9179..bb8a88606 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig @@ -32,10 +32,14 @@ {% elseif resource.thirdparty is not null %}
{{ resource.thirdparty }} - + + {% if resource.thirdparty.parent is not null %} + {{ 'Contact person'|trans|capitalize }} + {% else %} {{ 'thirdparty'|trans|capitalize }} - - + {% endif %} + +
{% else %}
@@ -56,7 +60,7 @@
{% endif %} - {% if is_granted('CHILL_PERSON_UPDATE', resource.person) %} + {% if is_granted('CHILL_PERSON_UPDATE', resource.personOwner) %}
    @@ -72,6 +76,25 @@ class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}"> +
  • + {% if resource.person is not null %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: false, + targetEntity: { name: 'person', id: resource.person.id }, + } %} + + {% endif %} + {% if resource.thirdparty is not null %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: false, + targetEntity: { name: 'thirdparty', id: resource.thirdparty.id }, + parent: resource.thirdparty.parent + } %} + + {% endif %} +
diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index a2a5121a6..510dc1a64 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -237,6 +237,7 @@ no comment found: "Aucun commentaire" Select a type: "Choisissez un type" Select a person: "Choisissez un usager" Select a thirdparty: "Choisissez un tiers" +Contact person: "Personne de contact" # pickAPersonType From 0383571a9e1712627b921952e25fef4b04114a77 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 14:42:17 +0100 Subject: [PATCH 08/32] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fcc5cd90..8a5bdafb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) * [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) * [household member editor] allow to push to existing household +* [person_resource]: Onthefly button added to view person/thirdparty and badge differentiation for a contact-thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/428) ## Test releases From e21ff588aee817cdbe5183c4ba4d0ab323fe478b Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 14:42:54 +0100 Subject: [PATCH 09/32] csfixes --- src/Bundle/ChillActivityBundle/Entity/ActivityType.php | 2 +- src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 94f732a89..bdf75ed05 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -271,7 +271,7 @@ class ActivityType public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { - if (!($this->socialIssuesVisible === 2 && $this->socialActionsVisible === 1)) { + if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { $context ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') ->atPath('socialActionsVisible') diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index c457d2863..e7a1c514b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -212,7 +212,7 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) - * @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED}) * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; From 1162c436c14a577b9e80196a8162361774b0a909 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 12:45:02 +0100 Subject: [PATCH 10/32] demandeur not displayed in search list if anonymous --- .../views/Person/list_with_period.html.twig | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 109e2024a..86459337d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -99,11 +99,12 @@ {% endif %}
- {% if acp.requestorPerson == person %} + {% if acp.requestoranonymous == false and acp.requestorPerson == person %} {{ 'Requestor'|trans({'gender': person.gender}) }} {% endif %} + {% if acp.emergency %} {{- 'Emergency'|trans|upper -}} {% endif %} @@ -186,39 +187,39 @@ - - {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} -
-
-

- {% if acp.requestorPerson is not null %} - {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} + {% if acp.requestoranonymous == false %} + {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} +
+
+

+ {% if acp.requestorPerson is not null %} + {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} + {% else %} + {{ 'Requestor'|trans({'gender': 'other'})}} + {% endif %} +

+
+
+ {% if acp.requestorThirdParty is not null %} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, + action: 'show', + displayBadge: true, + buttonText: acp.requestorThirdParty|chill_entity_render_string + } %} {% else %} - {{ 'Requestor'|trans({'gender': 'other'})}} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'person', id: acp.requestorPerson.id }, + action: 'show', + displayBadge: true, + buttonText: acp.requestorPerson|chill_entity_render_string, + isDead: acp.requestorPerson.deathdate is not null + } %} {% endif %} -

+
-
- {% if acp.requestorThirdParty is not null %} - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, - action: 'show', - displayBadge: true, - buttonText: acp.requestorThirdParty|chill_entity_render_string - } %} - {% else %} - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - targetEntity: { name: 'person', id: acp.requestorPerson.id }, - action: 'show', - displayBadge: true, - buttonText: acp.requestorPerson|chill_entity_render_string, - isDead: acp.requestorPerson.deathdate is not null - } %} - {% endif %} -
-
+ {% endif %} {% endif %} - {% endfor %} From af1c2687841c462ec988090da28d0e8e34092a4a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:06:59 +0100 Subject: [PATCH 11/32] commentfield for marital status is always visible --- .../ChillPersonBundle/Resources/views/Person/edit.html.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index d394a75a8..dc71d9981 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -85,9 +85,11 @@
{{ form_row(form.maritalStatusDate, { 'label' : 'Date of last marital status change'} ) }} - {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }}
{%- endif -%} +
+ {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }} +
{%- endif -%} From 0689ca366d198391f4b8edce26023fd21f704b90 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:08:55 +0100 Subject: [PATCH 12/32] changelog updated --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a198c0929..78637ad4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,10 +29,14 @@ and this project adheres to * [parcours]: component added to change the opening date of a parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/411) * [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410) * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) +* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) +* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) * [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) * [household member editor] allow to push to existing household * [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal +## Test releases + ### test release 2021-01-28 From 69dd920fd6468893e2f11a8b752bdbc89989ab45 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:11:25 +0100 Subject: [PATCH 13/32] php csfixes --- src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index d71ac2b9f..07fb859b7 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -213,7 +213,7 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) - * @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED}) * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; From b79885cd215165040c919e94693c0fe56a9d44d5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:39:52 +0100 Subject: [PATCH 14/32] bugfix creation of person or thirdparty through onTheFly --- .../Resources/public/vuejs/_components/AddPersons.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 3ef7b4037..f9b32f091 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -299,6 +299,7 @@ export default { } }) } + this.canCloseOnTheFlyModal = false; } }, } From 2eb1ebd2639870fdb1a4b5ffc094fa8a714d3729 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:45:41 +0100 Subject: [PATCH 15/32] changelog updated with bugfix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78637ad4b..aa0d8c08b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) * [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) * [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) +* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429) * [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) * [household member editor] allow to push to existing household * [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal From a4457664d45d215fed71142ea90fed1f1a70bfd9 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 18:33:29 +0100 Subject: [PATCH 16/32] bugfix addPersons --- .../public/vuejs/_components/AddPersons.vue | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index f9b32f091..3958e39ef 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -195,18 +195,18 @@ export default { setTimeout(function() { if (query === "") { - this.loadSuggestions([]); - return; + this.loadSuggestions([]); + return; } if (query === this.search.query) { - if (this.currentSearchQueryController !== undefined) { - this.currentSearchQueryController.abort() - } - this.currentSearchQueryController = new AbortController(); - searchEntities({ query, options: this.options }, this.currentSearchQueryController) + if (this.currentSearchQueryController !== undefined) { + this.currentSearchQueryController.abort() + } + this.currentSearchQueryController = new AbortController(); + searchEntities({ query, options: this.options }, this.currentSearchQueryController) .then(suggested => new Promise((resolve, reject) => { - this.loadSuggestions(suggested.results); - resolve(); + this.loadSuggestions(suggested.results); + resolve(); })); } }.bind(this), query.length > 3 ? 300 : 700); @@ -241,13 +241,14 @@ export default { return item.result.type + item.result.id; }, addPriorSuggestion() { - //console.log('addPriorSuggestion', this.hasPriorSuggestion); + // console.log('prior suggestion', this.priorSuggestion); if (this.hasPriorSuggestion) { - console.log('addPriorSuggestion',); + // console.log('addPriorSuggestion',); this.suggested.unshift(this.priorSuggestion); this.selected.unshift(this.priorSuggestion); - console.log('reset priorSuggestion'); + // console.log('selected', this.selected); + // console.log('suggested', this.suggested); this.newPriorSuggestion(null); } }, @@ -260,13 +261,14 @@ export default { result: entity } this.search.priorSuggestion = suggestion; - console.log('search priorSuggestion', this.search.priorSuggestion); + // console.log('search priorSuggestion', this.search.priorSuggestion); + this.addPriorSuggestion(suggestion) } else { this.search.priorSuggestion = {}; } }, saveFormOnTheFly({ type, data }) { - console.log('saveFormOnTheFly from addPersons, type', type, ', data', data); + // console.log('saveFormOnTheFly from addPersons, type', type, ', data', data); if (type === 'person') { makeFetch('POST', '/api/1.0/person/person.json', data) .then(response => { @@ -276,10 +278,10 @@ export default { .catch((error) => { if (error.name === 'ValidationException') { for (let v of error.violations) { - this.$toast.open({message: v }); + this.$toast.open({message: v }); } } else { - this.$toast.open({message: 'An error occurred'}); + this.$toast.open({message: 'An error occurred'}); } }) } @@ -292,10 +294,10 @@ export default { .catch((error) => { if (error.name === 'ValidationException') { for (let v of error.violations) { - this.$toast.open({message: v }); + this.$toast.open({message: v }); } } else { - this.$toast.open({message: 'An error occurred'}); + this.$toast.open({message: 'An error occurred'}); } }) } From a0bc6c76047a278f9d8157058f081194053e3c14 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 18:47:06 +0100 Subject: [PATCH 17/32] csfixes --- .../Entity/ActivityType.php | 2 +- .../ChillMainBundle/Form/WorkflowStepType.php | 34 +++++++++---------- .../AccompanyingPeriodRepository.php | 10 +++--- .../public/vuejs/_components/AddPersons.vue | 4 +-- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 94f732a89..bdf75ed05 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -271,7 +271,7 @@ class ActivityType public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { - if (!($this->socialIssuesVisible === 2 && $this->socialActionsVisible === 1)) { + if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { $context ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') ->atPath('socialActionsVisible') diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 18ac10c47..b843890c2 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -76,32 +76,32 @@ class WorkflowStepType extends AbstractType 'expanded' => true, 'choices' => $choices, 'choice_label' => function (Transition $transition) use ($workflow) { - $meta = $workflow->getMetadataStore()->getTransitionMetadata($transition); + $meta = $workflow->getMetadataStore()->getTransitionMetadata($transition); - if (array_key_exists('label', $meta)) { - return $this->translatableStringHelper->localize($meta['label']); - } + if (array_key_exists('label', $meta)) { + return $this->translatableStringHelper->localize($meta['label']); + } - return $transition->getName(); - }, + return $transition->getName(); + }, 'choice_attr' => static function (Transition $transition) use ($workflow) { - $toFinal = true; + $toFinal = true; - foreach ($transition->getTos() as $to) { - $meta = $workflow->getMetadataStore()->getPlaceMetadata($to); + foreach ($transition->getTos() as $to) { + $meta = $workflow->getMetadataStore()->getPlaceMetadata($to); - if ( + if ( !array_key_exists('isFinal', $meta) || false === $meta['isFinal'] ) { - $toFinal = false; - } + $toFinal = false; } + } - return [ - 'data-is-transition' => 'data-is-transition', - 'data-to-final' => $toFinal ? '1' : '0', - ]; - }, + return [ + 'data-is-transition' => 'data-is-transition', + 'data-to-final' => $toFinal ? '1' : '0', + ]; + }, ]) ->add('future_dest_users', PickUserDynamicType::class, [ 'label' => 'workflow.dest for next steps', diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index 3f0c30e47..10b424cef 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -28,6 +28,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository $this->repository = $entityManager->getRepository(AccompanyingPeriod::class); } + public function countBy(array $criteria): int + { + return $this->repository->count($criteria); + } + public function countByRecentUserHistory(User $user, DateTimeImmutable $since): int { $qb = $this->buildQueryByRecentUserHistory($user, $since); @@ -35,11 +40,6 @@ final class AccompanyingPeriodRepository implements ObjectRepository return $qb->select('count(a)')->getQuery()->getSingleScalarResult(); } - public function countBy(array $criteria): int - { - return $this->repository->count($criteria); - } - public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 3958e39ef..9e318ff96 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -247,8 +247,6 @@ export default { this.suggested.unshift(this.priorSuggestion); this.selected.unshift(this.priorSuggestion); - // console.log('selected', this.selected); - // console.log('suggested', this.suggested); this.newPriorSuggestion(null); } }, @@ -262,7 +260,7 @@ export default { } this.search.priorSuggestion = suggestion; // console.log('search priorSuggestion', this.search.priorSuggestion); - this.addPriorSuggestion(suggestion) + this.addPriorSuggestion(suggestion); } else { this.search.priorSuggestion = {}; } From 7d8bd089a21b8a47c29bc593d02c601436679634 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 10:09:48 +0100 Subject: [PATCH 18/32] double edit button removed --- .../Resources/views/HouseholdComposition/index.html.twig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig index 594863a64..ccd0ba1a9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig @@ -22,7 +22,7 @@

{{ c.householdCompositionType.label|localize_translatable_string }}

{{ 'household_composition.numberOfChildren'|trans }}: {{ c.numberOfChildren }}

-
{{ 'household_composition.Since'|trans({'startDate': c.startDate}) }}
+
{{ 'household_composition.Since'|trans({'startDate': c.startDate}) }}
@@ -45,7 +45,7 @@
  • - +
  • @@ -57,8 +57,8 @@ {{ form_widget(form) }}
      -
    • - {{ 'Cancel'|trans }} +
    • + {{ 'Cancel'|trans }}
    • From 930b6ff77e82a0876e3fbadfdae365e8fae273f8 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 10:17:08 +0100 Subject: [PATCH 19/32] minor style changes --- .../Resources/views/PersonResource/list.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig index bb8a88606..922c369e7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig @@ -23,7 +23,7 @@ {% for resource in personResources %}
      -
      +
      {% if resource.person is not null %}
      {{ resource.person }} @@ -47,7 +47,7 @@
      {% endif %}
      -
      +
      {% if resource.kind %} {{ resource.kind.title.fr|capitalize }} {% endif %} From 0854b7fc6a89ebc3b8505f733cdd165d86167694 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 12:32:34 +0100 Subject: [PATCH 20/32] delete action created in controller and template --- .../HouseholdCompositionController.php | 58 ++++++++++++++++++- .../HouseholdComposition/delete.html.twig | 38 ++++++++++++ .../HouseholdComposition/index.html.twig | 5 +- .../translations/messages.fr.yml | 4 ++ 4 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/delete.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index c74113a05..4b78c8738 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -16,9 +16,12 @@ use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Household\HouseholdComposition; use Chill\PersonBundle\Form\HouseholdCompositionType; use Chill\PersonBundle\Repository\Household\HouseholdCompositionRepository; +use Chill\PersonBundle\Repository\Household\HouseholdRepository; use Chill\PersonBundle\Security\Authorization\HouseholdVoter; use DateTimeImmutable; use Doctrine\ORM\EntityManagerInterface; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -31,7 +34,7 @@ use Symfony\Component\Security\Core\Security; use Symfony\Component\Templating\EngineInterface; use Symfony\Contracts\Translation\TranslatorInterface; -class HouseholdCompositionController +class HouseholdCompositionController extends AbstractController { private EngineInterface $engine; @@ -49,9 +52,12 @@ class HouseholdCompositionController private UrlGeneratorInterface $urlGenerator; + private HouseholdRepository $householdRepository; + public function __construct( Security $security, HouseholdCompositionRepository $householdCompositionRepository, + HouseholdRepository $householdRepository, PaginatorFactory $paginatorFactory, FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, @@ -67,6 +73,7 @@ class HouseholdCompositionController $this->translator = $translator; $this->engine = $engine; $this->urlGenerator = $urlGenerator; + $this->householdRepository = $householdRepository; } /** @@ -146,4 +153,53 @@ class HouseholdCompositionController ] )); } + + /** + * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete") + */ + public function deleteAction(Request $request, $household_id, $composition_id): Response + { + $composition = $this->householdCompositionRepository->find($composition_id); + $household = $this->householdRepository->find($household_id); + + $this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household); + + if (null === $composition) { + throw $this->createNotFoundException('Unable to find composition entity.'); + } + + $form = $this->createFormBuilder() + ->setAction($this->generateUrl('chill_person_household_composition_delete', [ + 'composition_id' => $composition_id, + 'household_id' => $household_id, + ])) + ->setMethod('DELETE') + ->add('submit', SubmitType::class, ['label' => 'Delete']) + ->getForm(); + + if ($request->getMethod() === Request::METHOD_DELETE) { + $form->handleRequest($request); + + if ($form->isValid()) { + $this->entityManager->remove($composition); + $this->entityManager->flush(); + + $this->addFlash('success', $this->translator + ->trans('The composition has been successfully removed.')); + + return $this->redirectToRoute('chill_person_household_composition_index', [ + 'id' => $household_id, + ]); + } + } + + return $this->render( + 'ChillPersonBundle:HouseholdComposition:delete.html.twig', + [ + 'household' => $household, + 'composition' => $composition, + 'form' => $form->createView(), + ] + ); + } } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/delete.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/delete.html.twig new file mode 100644 index 000000000..7f4aeba0c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/delete.html.twig @@ -0,0 +1,38 @@ +{% extends '@ChillPerson/Household/layout.html.twig' %} + +{% set activeRouteKey = 'chill_person_household_composition_index' %} + +{% block title 'Remove household composition'|trans %} + +{% block display_content %} +

      {{ 'Concerns household n°%id%'|trans({ '%id%' : household.id } ) }}

      +
      +
      +

      {{ 'Composition'|trans }}:

      +
      +
      + {% for m in household.members %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'person', id: m.person.id }, + buttonText: m.person|chill_entity_render_string, + isDead: m.person.deathdate is not null + } %} + + {% endfor %} +
      +
      +{% endblock %} + +{% block content %} +{{ include('@ChillMain/Util/confirmation_template.html.twig', + { + 'title' : 'Remove household composition'|trans, + 'confirm_question' : 'Are you sure you want to remove this composition?'|trans, + 'display_content' : block('display_content'), + 'cancel_route' : 'chill_person_household_composition_index', + 'cancel_parameters' : { 'composition_id' : composition.id, 'id' : household.id }, + 'form' : form + } ) }} +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig index ccd0ba1a9..7ff72b2cd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdComposition/index.html.twig @@ -45,7 +45,10 @@
    • - +
    diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index f1cb52913..bcfa243a8 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -486,6 +486,10 @@ Household summary: Résumé du ménage Edit household address: Modifier l'adresse du ménage Show household: Voir le ménage Back to household: Revenir au ménage +Remove household composition: Supprimer composition familiale +Are you sure you want to remove this composition?: Etes-vous sûr de vouloir supprimer cette composition familiale ? +Concerns household n°%id%: Concerne le ménage n°%id% +Composition: Composition # accompanying course work Accompanying Course Actions: Actions d'accompagnements From a986b4ae983e24b572d001d531ef739adaf7fa40 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 12:33:09 +0100 Subject: [PATCH 21/32] csfixes --- .../Entity/ActivityType.php | 2 +- .../ChillMainBundle/Form/WorkflowStepType.php | 34 +++--- .../HouseholdCompositionController.php | 105 +++++++++--------- .../Entity/AccompanyingPeriod.php | 2 +- .../AccompanyingPeriodRepository.php | 10 +- 5 files changed, 78 insertions(+), 75 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 94f732a89..bdf75ed05 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -271,7 +271,7 @@ class ActivityType public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { - if (!($this->socialIssuesVisible === 2 && $this->socialActionsVisible === 1)) { + if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { $context ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') ->atPath('socialActionsVisible') diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 18ac10c47..b843890c2 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -76,32 +76,32 @@ class WorkflowStepType extends AbstractType 'expanded' => true, 'choices' => $choices, 'choice_label' => function (Transition $transition) use ($workflow) { - $meta = $workflow->getMetadataStore()->getTransitionMetadata($transition); + $meta = $workflow->getMetadataStore()->getTransitionMetadata($transition); - if (array_key_exists('label', $meta)) { - return $this->translatableStringHelper->localize($meta['label']); - } + if (array_key_exists('label', $meta)) { + return $this->translatableStringHelper->localize($meta['label']); + } - return $transition->getName(); - }, + return $transition->getName(); + }, 'choice_attr' => static function (Transition $transition) use ($workflow) { - $toFinal = true; + $toFinal = true; - foreach ($transition->getTos() as $to) { - $meta = $workflow->getMetadataStore()->getPlaceMetadata($to); + foreach ($transition->getTos() as $to) { + $meta = $workflow->getMetadataStore()->getPlaceMetadata($to); - if ( + if ( !array_key_exists('isFinal', $meta) || false === $meta['isFinal'] ) { - $toFinal = false; - } + $toFinal = false; } + } - return [ - 'data-is-transition' => 'data-is-transition', - 'data-to-final' => $toFinal ? '1' : '0', - ]; - }, + return [ + 'data-is-transition' => 'data-is-transition', + 'data-to-final' => $toFinal ? '1' : '0', + ]; + }, ]) ->add('future_dest_users', PickUserDynamicType::class, [ 'label' => 'workflow.dest for next steps', diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 4b78c8738..22e92eb02 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -44,6 +44,8 @@ class HouseholdCompositionController extends AbstractController private HouseholdCompositionRepository $householdCompositionRepository; + private HouseholdRepository $householdRepository; + private PaginatorFactory $paginatorFactory; private Security $security; @@ -52,8 +54,6 @@ class HouseholdCompositionController extends AbstractController private UrlGeneratorInterface $urlGenerator; - private HouseholdRepository $householdRepository; - public function __construct( Security $security, HouseholdCompositionRepository $householdCompositionRepository, @@ -76,6 +76,58 @@ class HouseholdCompositionController extends AbstractController $this->householdRepository = $householdRepository; } + /** + * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete") + * + * @param mixed $household_id + * @param mixed $composition_id + */ + public function deleteAction(Request $request, $household_id, $composition_id): Response + { + $composition = $this->householdCompositionRepository->find($composition_id); + $household = $this->householdRepository->find($household_id); + + $this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household); + + if (null === $composition) { + throw $this->createNotFoundException('Unable to find composition entity.'); + } + + $form = $this->createFormBuilder() + ->setAction($this->generateUrl('chill_person_household_composition_delete', [ + 'composition_id' => $composition_id, + 'household_id' => $household_id, + ])) + ->setMethod('DELETE') + ->add('submit', SubmitType::class, ['label' => 'Delete']) + ->getForm(); + + if ($request->getMethod() === Request::METHOD_DELETE) { + $form->handleRequest($request); + + if ($form->isValid()) { + $this->entityManager->remove($composition); + $this->entityManager->flush(); + + $this->addFlash('success', $this->translator + ->trans('The composition has been successfully removed.')); + + return $this->redirectToRoute('chill_person_household_composition_index', [ + 'id' => $household_id, + ]); + } + } + + return $this->render( + 'ChillPersonBundle:HouseholdComposition:delete.html.twig', + [ + 'household' => $household, + 'composition' => $composition, + 'form' => $form->createView(), + ] + ); + } + /** * @Route("/{_locale}/person/household/{id}/composition/index", name="chill_person_household_composition_index") */ @@ -153,53 +205,4 @@ class HouseholdCompositionController extends AbstractController ] )); } - - /** - * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete") - */ - public function deleteAction(Request $request, $household_id, $composition_id): Response - { - $composition = $this->householdCompositionRepository->find($composition_id); - $household = $this->householdRepository->find($household_id); - - $this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household); - - if (null === $composition) { - throw $this->createNotFoundException('Unable to find composition entity.'); - } - - $form = $this->createFormBuilder() - ->setAction($this->generateUrl('chill_person_household_composition_delete', [ - 'composition_id' => $composition_id, - 'household_id' => $household_id, - ])) - ->setMethod('DELETE') - ->add('submit', SubmitType::class, ['label' => 'Delete']) - ->getForm(); - - if ($request->getMethod() === Request::METHOD_DELETE) { - $form->handleRequest($request); - - if ($form->isValid()) { - $this->entityManager->remove($composition); - $this->entityManager->flush(); - - $this->addFlash('success', $this->translator - ->trans('The composition has been successfully removed.')); - - return $this->redirectToRoute('chill_person_household_composition_index', [ - 'id' => $household_id, - ]); - } - } - - return $this->render( - 'ChillPersonBundle:HouseholdComposition:delete.html.twig', - [ - 'household' => $household, - 'composition' => $composition, - 'form' => $form->createView(), - ] - ); - } } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index d71ac2b9f..07fb859b7 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -213,7 +213,7 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) - * @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED}) * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index 3f0c30e47..10b424cef 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -28,6 +28,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository $this->repository = $entityManager->getRepository(AccompanyingPeriod::class); } + public function countBy(array $criteria): int + { + return $this->repository->count($criteria); + } + public function countByRecentUserHistory(User $user, DateTimeImmutable $since): int { $qb = $this->buildQueryByRecentUserHistory($user, $since); @@ -35,11 +40,6 @@ final class AccompanyingPeriodRepository implements ObjectRepository return $qb->select('count(a)')->getQuery()->getSingleScalarResult(); } - public function countBy(array $criteria): int - { - return $this->repository->count($criteria); - } - public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); From 1530e9d13adbe4205690db61bb2ff78d374fb195 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 12:37:09 +0100 Subject: [PATCH 22/32] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a198c0929..fb0d742f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to * renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche * renomme date de début en date d'ouverture dans le formulaire parcours +* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426) ## Test releases From c3de3c6c39e1a50941d1ea1c9e24201140bcbabf Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 13:51:21 +0100 Subject: [PATCH 23/32] validation adjusted to greaterThanOrEqual and different message passed --- src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 6 +++++- src/Bundle/ChillPersonBundle/translations/validators.fr.yml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 07fb859b7..7c8694192 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -133,7 +133,11 @@ class AccompanyingPeriod implements * @ORM\Column(type="date", nullable=true) * @Groups({"read", "write", "docgen:read"}) * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED}) - * @Assert\GreaterThan(propertyPath="openingDate", groups={AccompanyingPeriod::STEP_CLOSED}) + * @Assert\GreaterThanOrEqual( + * propertyPath="openingDate", + * groups={AccompanyingPeriod::STEP_CLOSED}, + * message="The closing date must be later than the date of creation" + * ) */ private ?DateTime $closingDate = null; diff --git a/src/Bundle/ChillPersonBundle/translations/validators.fr.yml b/src/Bundle/ChillPersonBundle/translations/validators.fr.yml index a73880195..c47aee1c5 100644 --- a/src/Bundle/ChillPersonBundle/translations/validators.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/validators.fr.yml @@ -11,6 +11,7 @@ 'Closing date is not valid': 'La date de fermeture n''est pas valide' 'Closing date can not be null': 'La date de fermeture ne peut être nulle' The date of closing is before the date of opening: La période de fermeture est avant la période d'ouverture +The closing date must be later than the date of creation: La date de clôture doit être postérieure à la date de création du parcours The birthdate must be before %date%: La date de naissance doit être avant le %date% 'Invalid phone number: it should begin with the international prefix starting with "+", hold only digits and be smaller than 20 characters. Ex: +33123456789': 'Numéro de téléphone invalide: il doit commencer par le préfixe international précédé de "+", ne comporter que des chiffres et faire moins de 20 caractères. Ex: +31623456789' 'Invalid phone number: it should begin with the international prefix starting with "+", hold only digits and be smaller than 20 characters. Ex: +33623456789': 'Numéro de téléphone invalide: il doit commencer par le préfixe international précédé de "+", ne comporter que des chiffres et faire moins de 20 caractères. Ex: +33623456789' From 05fc5a182967b4a36edaef7f5da8ff3b6d0a1a1f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 13:52:13 +0100 Subject: [PATCH 24/32] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a198c0929..d6a823640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to * renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche * renomme date de début en date d'ouverture dans le formulaire parcours +* [parcours]: validation + message for closing parcours adjusted. ## Test releases From c5cbdd97ffb85a19cf0bdc7047f836f7c4fb43ca Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 13:52:42 +0100 Subject: [PATCH 25/32] csfixes --- src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 7c8694192..dbc3ba182 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -134,9 +134,9 @@ class AccompanyingPeriod implements * @Groups({"read", "write", "docgen:read"}) * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED}) * @Assert\GreaterThanOrEqual( - * propertyPath="openingDate", - * groups={AccompanyingPeriod::STEP_CLOSED}, - * message="The closing date must be later than the date of creation" + * propertyPath="openingDate", + * groups={AccompanyingPeriod::STEP_CLOSED}, + * message="The closing date must be later than the date of creation" * ) */ private ?DateTime $closingDate = null; From c6373a075d327985170f76550568b33384b463cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 15:49:23 +0100 Subject: [PATCH 26/32] refactor pickTemplate and adapt existing usage --- .../Controller/ActivityController.php | 19 ++++- .../Resources/public/vuejs/Activity/index.js | 58 +++++++++++++++ .../Resources/views/Activity/edit.html.twig | 2 +- .../Resources/views/Activity/new.html.twig | 1 + .../Activity/newAccompanyingCourse.html.twig | 6 +- .../views/Activity/newPerson.html.twig | 2 + .../public/lib/document-generator.js | 13 ++++ .../public/vuejs/_components/PickTemplate.vue | 74 ++++++------------- .../components/FormEvaluation.vue | 11 ++- 9 files changed, 126 insertions(+), 60 deletions(-) create mode 100644 src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 3e32edfce..d8f69035d 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -34,6 +34,7 @@ use Psr\Log\LoggerInterface; use RuntimeException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; @@ -393,9 +394,25 @@ final class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_CREATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, - ])->handleRequest($request); + ]); + + if ($form->has('documents')) { + $form->add('gendocTemplateId', HiddenType::class, [ + 'mapped' => false, + 'data' => null, + 'attr' => [ + // required for js + 'data-template-id' => 'data-template-id', + ], + ]); + } + + $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + if ($form->has('gendocTemplateId')) { + dd($form->get('gendocTemplateId')->getData()); + } $this->entityManager->persist($entity); $this->entityManager->flush(); diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js index b7a5c791b..7bd6ae03d 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js @@ -2,11 +2,15 @@ import { createApp } from 'vue'; import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' import { activityMessages } from './i18n' import store from './store' +import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue'; +import {fetchTemplates} from 'ChillDocGeneratorAssets/api/pickTemplate.js'; import App from './App.vue'; const i18n = _createI18n(activityMessages); +// app for activity + const hasSocialIssues = document.querySelector('#social-issues-acc') !== null; const hasLocation = document.querySelector('#location') !== null; const hasPerson = document.querySelector('#add-persons') !== null; @@ -29,3 +33,57 @@ const app = createApp({ .use(i18n) .component('app', App) .mount('#activity'); + + +// app for picking template + +const i18nGendoc = _createI18n({}); + +document.querySelectorAll('div[data-docgen-template-picker]').forEach(el => { + fetchTemplates(el.dataset.entityClass).then(templates => { + let + picker = { + template: '', + components: { + PickTemplate, + }, + data() { + return { + templates: templates, + entityId: el.dataset.entityId, + } + }, + methods: { + generateDoc({event, link, template}) { + console.log('generateDoc'); + console.log('link', link); + console.log('template', template); + + event.preventDefault(); + let hiddenInput = document.querySelector("input[data-template-id]"); + + if (hiddenInput === null) { + console.error('hidden input not found'); + return; + } + + hiddenInput.value = template; + + let form = document.querySelect('form[name="chill_activitybundle_activity"'); + + if (form === null) { + console.error('form not found'); + return; + } + + console.log('subbmitting formt'); + + form.submit(); + } + } + } + ; + createApp(picker).use(i18nGendoc).mount(el); + }) + +}); diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig index a59c596c3..3da97efd6 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig @@ -89,9 +89,9 @@ {%- if edit_form.documents is defined -%} {{ form_row(edit_form.documents) }} +
    {% endif %} -
    {% set person_id = null %} {% if entity.person %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig index a0668119c..755e2e151 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig @@ -87,6 +87,7 @@ {%- if form.documents is defined -%} {{ form_row(form.documents) }} +
    {% endif %} {%- if form.attendee is defined -%} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig index 505d8c6cb..e491a34d5 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig @@ -17,18 +17,16 @@ {{ parent() }} {{ encore_entry_script_tags('mod_async_upload') }} {{ encore_entry_script_tags('vue_activity') }} + {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} + {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig index 962aee806..712b996bd 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig @@ -23,9 +23,11 @@ window.activity = {{ activity_json|json_encode|raw }}; {{ encore_entry_script_tags('vue_activity') }} + {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} + {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js b/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js new file mode 100644 index 000000000..beea190a3 --- /dev/null +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js @@ -0,0 +1,13 @@ + +const buildLink = function(templateId, entityId, entityClass) { + const + entityIdEncoded = encodeURI(entityId), + returnPath = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash), + entityClassEncoded = encodeURI(entityClass), + url = `/fr/doc/gen/generate/from/${templateId}/for/${entityClassEncoded}/${entityIdEncoded}?returnPath=${returnPath}` + ; + console.log('computed Url'); + return url; +}; + +export {buildLink}; diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue index 04d563782..cd5121fc9 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue @@ -20,8 +20,8 @@ - - + + @@ -39,24 +39,27 @@ {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig index 72c74c68e..82c7403c6 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig @@ -39,11 +39,9 @@ window.activity = {{ activity_json|json_encode|raw }}; {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig index e491a34d5..47a61bd86 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig @@ -21,12 +21,10 @@ {% if default_location is not null %}window.default_location_id = {{ default_location.id }}{% endif %}; {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig index 712b996bd..962aee806 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig @@ -23,11 +23,9 @@ window.activity = {{ activity_json|json_encode|raw }}; {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 9a8e6b3b8..5c4f7f501 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -210,11 +210,8 @@ class ActivityContext implements */ public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void { - $doc = new StoredObject(); - // TODO push document to remote + $entity->addDocument($storedObject); - $this->em->persist($doc); - - $entity->addDocument($doc); + $this->em->persist($storedObject); } } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 9a80fde3d..6cf029ed1 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -45,6 +45,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) * @Serializer\Groups({"read","read:accompanyingPeriodWork:light"}) + * @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ private ?AccompanyingPeriod $accompanyingPeriod = null; From fcff4bf863d2c6e872d5ed4bcccc19d35373c6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 18:01:34 +0100 Subject: [PATCH 28/32] fix phpcs --- .../Service/DocGenerator/ActivityContext.php | 1 - .../Entity/AccompanyingPeriod/AccompanyingPeriodWork.php | 6 +++--- .../AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 5c4f7f501..7ee09690a 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -17,7 +17,6 @@ use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface; use Chill\DocGeneratorBundle\Context\Exception\UnexpectedTypeException; use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; use Chill\DocGeneratorBundle\Service\Context\BaseContextData; -use Chill\DocStoreBundle\Entity\Document; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Repository\DocumentCategoryRepository; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 6cf029ed1..b7e8d1c5d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -44,8 +44,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues { /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) - * @Serializer\Groups({"read","read:accompanyingPeriodWork:light"}) - * @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"}) + * @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"}) + * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ private ?AccompanyingPeriod $accompanyingPeriod = null; @@ -154,7 +154,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\ManyToOne(targetEntity=SocialAction::class) * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) * @Serializer\Groups({"accompanying_period_work:create"}) - * @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"}) + * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ private ?SocialAction $socialAction = null; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index 483495ebd..68f508b95 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -40,7 +40,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * inversedBy="accompanyingPeriodWorkEvaluations" * ) * @Serializer\Groups({"read:evaluation:include-work"}) - * @Serializer\Context(normalizationContext={"groups"={"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) + * @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) */ private ?AccompanyingPeriodWork $accompanyingPeriodWork = null; From 1a0674a20b7beea7f9df4cffb934b23b9dfc93e1 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 1 Feb 2022 18:40:57 +0100 Subject: [PATCH 29/32] using badges instead of eye for person resource list --- .../views/PersonResource/list.html.twig | 46 +++++++------------ 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig index 922c369e7..62b9701ec 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig @@ -26,20 +26,25 @@
    {% if resource.person is not null %}
    - {{ resource.person }} - {{ 'person'|trans|capitalize }} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'person', id: resource.person.id }, + buttonText: resource.person|chill_entity_render_string, + isDead: resource.person.deathdate is not null + } %} +
    {% elseif resource.thirdparty is not null %}
    - {{ resource.thirdparty }} - - {% if resource.thirdparty.parent is not null %} - {{ 'Contact person'|trans|capitalize }} - {% else %} - {{ 'thirdparty'|trans|capitalize }} - {% endif %} - - + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'thirdparty', id: resource.thirdparty.id }, + buttonText: resource.thirdParty|chill_entity_render_string, + parent: resource.thirdparty.parent + } %} +
    {% else %}
    @@ -76,25 +81,6 @@ class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}"> -
  • - {% if resource.person is not null %} - - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - action: 'show', displayBadge: false, - targetEntity: { name: 'person', id: resource.person.id }, - } %} - - {% endif %} - {% if resource.thirdparty is not null %} - - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - action: 'show', displayBadge: false, - targetEntity: { name: 'thirdparty', id: resource.thirdparty.id }, - parent: resource.thirdparty.parent - } %} - - {% endif %} -
  • From 0ac9f2df8c4c0020f93be1c0e783785ebb2a05a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 21:20:11 +0100 Subject: [PATCH 30/32] fix loading of file template --- .../Resources/public/vuejs/Activity/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js index 0c209e69a..c812a27a4 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js @@ -2,7 +2,7 @@ import { createApp } from 'vue'; import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' import { activityMessages } from './i18n' import store from './store' -import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplatePreventMoving.vue'; +import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue'; import {fetchTemplates} from 'ChillDocGeneratorAssets/api/pickTemplate.js'; import App from './App.vue'; From 3f2454cead5e45f9252243090bdf8a781ac13cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 21:23:15 +0100 Subject: [PATCH 31/32] disable multiselect search in City and Street search --- CHANGELOG.md | 1 + .../vuejs/Address/components/AddAddress/AddressSelection.vue | 1 + .../public/vuejs/Address/components/AddAddress/CitySelection.vue | 1 + 3 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e81e2200..0bc848953 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to * [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429) * [person_resource]: Onthefly button added to view person/thirdparty and badge differentiation for a contact-thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/428) * [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal +* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend ## Test releases diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue index 12e45d0b7..ae134c88e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue @@ -10,6 +10,7 @@ :deselect-label="$t('create_address')" :selected-label="$t('multiselect.selected_label')" @search-change="listenInputSearch" + :internal-search="false" ref="addressSelector" @select="selectAddress" @remove="remove" diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue index 4883957bb..d0ff5c086 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue @@ -18,6 +18,7 @@ :selected-label="$t('multiselect.selected_label')" :taggable="true" :multiple="false" + :internal-search="false" @tag="addPostcode" :tagPlaceholder="$t('create_postal_code')" :loading="isLoading" From 33af7f36a021ca0552b1018c9254e02b073b1924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 21:23:50 +0100 Subject: [PATCH 32/32] remove dump --- .../src/Entity/AsideActivityCategory.php | 1 - src/Bundle/ChillCalendarBundle/Form/CalendarType.php | 1 - .../Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php | 1 - 3 files changed, 3 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index 6418a7990..73ab536d6 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -167,7 +167,6 @@ class AsideActivityCategory } $this->parent = $parent; - dump($this); return $this; } diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index acaeccf34..8966ecca8 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -97,7 +97,6 @@ class CalendarType extends AbstractType return $res; }, static function (?string $dateAsString): DateTimeImmutable { - dump($dateAsString); return new DateTimeImmutable($dateAsString); } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php index a5156a78a..1e4649dd7 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php @@ -44,7 +44,6 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz */ public function normalize($object, ?string $format = null, array $context = []): array { - dump($context); $initial = $this->normalizer->normalize($object, $format, array_merge( $context, [self::IGNORE_EVALUATION => spl_object_hash($object)]