From a2a0f6af445b2e265d6db57a0d8a27296504eb44 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 9 Feb 2022 15:58:54 +0100 Subject: [PATCH 1/8] mes parcours brouillon added to usermenu --- .../UserAccompanyingPeriodController.php | 20 +++++++++++++ .../Menu/UserMenuBuilder.php | 7 +++++ .../user_draft_periods_list.html.twig | 30 +++++++++++++++++++ .../translations/messages.fr.yml | 1 + 4 files changed, 58 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index aa849ac2b..52d87635e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -48,4 +48,24 @@ class UserAccompanyingPeriodController extends AbstractController 'pagination' => $pagination, ]); } + + /** + * @Route("/{_locale}/accompanying-periods/drafts", name="chill_person_accompanying_period_draft_user") + */ + public function listDraftsAction(Request $request) + { + $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']); + $pagination = $this->paginatorFactory->create($total); + $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy( + ['user' => $this->getUser(), 'step' => 'DRAFT'], + ['id' => 'DESC'], + $pagination->getItemsPerPage(), + $pagination->getCurrentPageFirstItemNumber() + ); + + return $this->render('@ChillPerson/AccompanyingPeriod/user_draft_periods_list.html.twig', [ + 'accompanyingPeriods' => $accompanyingPeriods, + 'pagination' => $pagination, + ]); + } } diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index 0a9d2a31c..857838780 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -44,6 +44,13 @@ class UserMenuBuilder implements LocalMenuBuilderInterface 'order' => 20, 'icon' => 'tasks', ]); + $menu->addChild('My accompanying periods in draft', [ + 'route' => 'chill_person_accompanying_period_draft_user', + ]) + ->setExtras([ + 'order' => 30, + 'icon' => 'tasks' + ]); } } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig new file mode 100644 index 000000000..5faaf378f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig @@ -0,0 +1,30 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %} + +{% block title %}{{ 'My accompanying periods in draft'|trans }}{% endblock title %} + +{% macro recordAction(period) %} +
  • + +
  • +{% endmacro %} + + +{% block content %} + +
    +

    {{ 'My accompanying periods in draft'|trans }}

    + +
    + {% for period in accompanyingPeriods %} + {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %} + {% endfor %} +
    + + {{ chill_pagination(pagination) }} + +
    + +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 91aed0304..99b2c2558 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -566,3 +566,4 @@ Linked evaluations: Évaluations associées # Accompanying period per user My accompanying periods: Mes parcours +My accompanying periods in draft: Mes parcours brouillon \ No newline at end of file From b4f9be0d92fd3752daaa83f6df772ef08581f47a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 9 Feb 2022 15:59:10 +0100 Subject: [PATCH 2/8] openingDate only displayed on parcours that are not in draft state --- .../Resources/views/AccompanyingPeriod/_list_item.html.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig index 5f12f60f1..85fef33b0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig @@ -27,7 +27,9 @@
    {% if period.closingDate == null %} - {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }} + {% if period.step != 'DRAFT' %} + {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }} + {% endif %} {% else %} {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({ '%opening_date%': period.openingDate|format_date('long'), From d60095987c363ae2978a2131ffc34e9c34609197 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 9 Feb 2022 15:59:19 +0100 Subject: [PATCH 3/8] Changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 142d1f0be..222f1dffd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to * change order for accompanying course work list +* [parcours]: Mes parcours brouillon added to user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/440) ## Test releases From dee6ed6707b51ecaa4fa2814b8e253e4de20de52 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 9 Feb 2022 16:02:21 +0100 Subject: [PATCH 4/8] Listing of mes parcours changed to only display confirmed or closed draft parcours are displayed in mes parcours brouillon --- .../Controller/UserAccompanyingPeriodController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 52d87635e..e326b86d6 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -34,10 +34,10 @@ class UserAccompanyingPeriodController extends AbstractController */ public function listAction(Request $request) { - $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser()]); + $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => ['CONFIRMED', 'CLOSED']]); $pagination = $this->paginatorFactory->create($total); $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy( - ['user' => $this->getUser()], + ['user' => $this->getUser(), 'step' => ['CONFIRMED', 'CLOSED']], ['openingDate' => 'DESC'], $pagination->getItemsPerPage(), $pagination->getCurrentPageFirstItemNumber() From 513207e510f3e015c5243cb132f7779638c3a4bf Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 9 Feb 2022 16:08:27 +0100 Subject: [PATCH 5/8] PHP csfixes --- src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index 857838780..d390c9993 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -49,7 +49,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface ]) ->setExtras([ 'order' => 30, - 'icon' => 'tasks' + 'icon' => 'tasks', ]); } } From d5160ead4c66b5107716fa36dff2ee33b4f67089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 11 Feb 2022 13:18:51 +0000 Subject: [PATCH 6/8] Apply 1 suggestion(s) to 1 file(s) --- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 99b2c2558..09c70c232 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -566,4 +566,4 @@ Linked evaluations: Évaluations associées # Accompanying period per user My accompanying periods: Mes parcours -My accompanying periods in draft: Mes parcours brouillon \ No newline at end of file +My accompanying periods in draft: Mes parcours brouillons \ No newline at end of file From 93128cb61b2e6a80d5773a11c808ada93e7ccad4 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 11 Feb 2022 14:28:42 +0100 Subject: [PATCH 7/8] if conditions joined --- .../views/AccompanyingPeriod/_list_item.html.twig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig index 85fef33b0..371423749 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig @@ -26,11 +26,9 @@
    - {% if period.closingDate == null %} - {% if period.step != 'DRAFT' %} - {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }} - {% endif %} - {% else %} + {% if period.closingDate == null and period.step != 'DRAFT' %} + {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }} + {% elseif period.closingDate != null %} {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({ '%opening_date%': period.openingDate|format_date('long'), '%closing_date%': period.closingDate|format_date('long')} From 3a2370d536aae146d83bd1d6c826b56054b9569e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 11 Feb 2022 15:26:17 +0100 Subject: [PATCH 8/8] fix missing cases for accompanying period draft list fix when: * if there isn't any information into course => better render box * if there isn't any course into list => display warning --- .../UserAccompanyingPeriodController.php | 2 +- .../AccompanyingPeriod/_list_item.html.twig | 112 +++++++++--------- .../user_draft_periods_list.html.twig | 4 +- .../translations/messages.fr.yml | 3 +- 4 files changed, 63 insertions(+), 58 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index e326b86d6..4bbf72b7d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -57,7 +57,7 @@ class UserAccompanyingPeriodController extends AbstractController $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']); $pagination = $this->paginatorFactory->create($total); $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy( - ['user' => $this->getUser(), 'step' => 'DRAFT'], + ['createdBy' => $this->getUser(), 'step' => 'DRAFT'], ['id' => 'DESC'], $pagination->getItemsPerPage(), $pagination->getCurrentPageFirstItemNumber() diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig index c2f7f26a6..11517def2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig @@ -55,65 +55,67 @@
    -
    -
    - {% if period.requestorPerson is not null or period.requestorThirdParty is not null %} -
    -

    {{ 'Requestor'|trans({'gender': null }) }}

    -
    - {% if period.requestorPerson is not null %} - - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - action: 'show', displayBadge: true, - targetEntity: { name: 'person', id: period.requestorPerson.id }, - buttonText: period.requestorPerson|chill_entity_render_string, - isDead: period.requestorPerson.deathdate is not null - } %} - - {% endif %} - {% if period.requestorThirdParty is not null %} - - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - action: 'show', displayBadge: true, - targetEntity: { name: 'thirdparty', id: period.requestorThirdParty.id }, - buttonText: period.requestorThirdParty|chill_entity_render_string - } %} - - {% endif %} + {% if period.requestor is not null or period.participations.count > 0 or period.socialIssues.count > 0%} +
    +
    + {% if period.requestorPerson is not null or period.requestorThirdParty is not null %} +
    +

    {{ 'Requestor'|trans({'gender': null }) }}

    +
    + {% if period.requestorPerson is not null %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'person', id: period.requestorPerson.id }, + buttonText: period.requestorPerson|chill_entity_render_string, + isDead: period.requestorPerson.deathdate is not null + } %} + + {% endif %} + {% if period.requestorThirdParty is not null %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'thirdparty', id: period.requestorThirdParty.id }, + buttonText: period.requestorThirdParty|chill_entity_render_string + } %} + + {% endif %} +
    -
    - {% endif %} - {% if period.participations.count > 0 %} -
    -

    {{ 'Participants'|trans }}

    -
    - {% for p in period.getCurrentParticipations %} - - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - action: 'show', displayBadge: true, - targetEntity: { name: 'person', id: p.person.id }, - buttonText: p.person|chill_entity_render_string, - isDead: p.person.deathdate is not null - } %} - - {% endfor %} + {% endif %} + {% if period.participations.count > 0 %} +
    +

    {{ 'Participants'|trans }}

    +
    + {% for p in period.getCurrentParticipations %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'person', id: p.person.id }, + buttonText: p.person|chill_entity_render_string, + isDead: p.person.deathdate is not null + } %} + + {% endfor %} +
    -
    - {% endif %} - {% if period.socialIssues.count > 0 %} -
    -

    {{ 'Social issues'|trans }}

    -
    - {% for si in period.socialIssues %} -

    - {{ si|chill_entity_render_box }} -

    - {% endfor %} + {% endif %} + {% if period.socialIssues.count > 0 %} +
    +

    {{ 'Social issues'|trans }}

    +
    + {% for si in period.socialIssues %} +

    + {{ si|chill_entity_render_box }} +

    + {% endfor %} +
    -
    - {% endif %} + {% endif %} +
    -
    + {% endif %}
    {% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig index 5faaf378f..33317d51d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig @@ -20,6 +20,8 @@
    {% for period in accompanyingPeriods %} {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %} + {% else %} +

    {{ 'Any accompanying period'|trans }}

    {% endfor %}
    @@ -27,4 +29,4 @@
    -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 3dfb4ec46..2c796c163 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -179,6 +179,7 @@ An accompanying period is open: Une période d'accompagnement est ouverte Accompanying period list: Périodes d'accompagnement Accompanying period list for person: Périodes d'accompagnement de la personne Accompanying period: Parcours d'accompagnement +Any accompanying period: Aucun parcours d'accompagnement period: Parcours New accompanying course: Nouveau parcours d'accompagnement Choose a motive: Motif de fermeture @@ -566,4 +567,4 @@ Linked evaluations: Évaluations associées # Accompanying period per user My accompanying periods: Mes parcours -My accompanying periods in draft: Mes parcours brouillons \ No newline at end of file +My accompanying periods in draft: Mes parcours brouillons