From b9c2d63a53653ac8731ef67fb9b4a3992b6bbc92 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 11:42:14 +0100 Subject: [PATCH 01/10] mes parcours page created --- .../UserAccompanyingPeriodController.php | 41 +++++++++++ .../Menu/UserMenuBuilder.php | 72 +++++++++++++++++++ .../user_periods_list.html.twig | 25 +++++++ .../ChillPersonBundle/config/routes.yaml | 4 ++ .../translations/messages.fr.yml | 3 + 5 files changed, 145 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php create mode 100644 src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php new file mode 100644 index 000000000..956849efc --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -0,0 +1,41 @@ +accompanyingPeriodRepository = $accompanyingPeriodRepository; + } + + public function listAction(Request $request) + { + $userId = $this->getUser()->getId(); + + $accompanyingPeriods = []; + $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $userId]); + + return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [ + 'accompanyingPeriods' => $accompanyingPeriods + ]); + + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php new file mode 100644 index 000000000..9030b9264 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -0,0 +1,72 @@ +counter = $counter; + $this->tokenStorage = $tokenStorage; + $this->translator = $translator; + $this->authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + if ($this->authorizationChecker->isGranted('ROLE_USER')) { + $menu->addChild('My accompanying periods', [ + 'route' => 'chill_person_accompanying_period_user', + ]) + ->setExtras([ + 'order' => 20, + 'icon' => 'tasks', + ]); + } + } + + public static function getMenuIds(): array + { + return ['user']; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig new file mode 100644 index 000000000..12faf739a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig @@ -0,0 +1,25 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %} + +{% block title %}{{ 'Accompanying period list'|trans }}{% endblock title %} + +{% macro recordAction(period) %} +
  • + +
  • +{% endmacro %} + + +{% block content %} + +

    {{ 'Accompanying period list'|trans }}

    + +
    + {% for period in accompanyingPeriods %} + {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %} + {% endfor %} +
    + +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/routes.yaml b/src/Bundle/ChillPersonBundle/config/routes.yaml index 13d1c1227..13539f6c2 100644 --- a/src/Bundle/ChillPersonBundle/config/routes.yaml +++ b/src/Bundle/ChillPersonBundle/config/routes.yaml @@ -55,6 +55,10 @@ chill_person_accompanying_period_re_open: path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::reOpenAction +chill_person_accompanying_period_user: + path: /{_locale}/accompanying-periods + controller: Chill\PersonBundle\Controller\UserAccompanyingPeriodController::listAction + chill_person_resource_list: path: /{_locale}/person/{person_id}/resources/list controller: Chill\PersonBundle\Controller\PersonResourceController::listAction diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 90d8da5cf..fe904cec4 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -533,3 +533,6 @@ household_composition: # docgen Linked evaluations: Évaluations associées + +# Accompanying period per user +My accompanying periods: Mes parcours From 14463dcd38afb4d7a29d62cc19e71eaa5075243f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 11:45:03 +0100 Subject: [PATCH 02/10] changelog updated --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1e466b6..d59109a0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ and this project adheres to * [parcours] comments truncated if too long + link added (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/406) * [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382) -* [person ressources]: module added +* [person ressources]: module added (same as above?) +* [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) ## Test releases From d70f8aa712cedf577b67f19687aae7bab8ac1179 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 11:50:26 +0100 Subject: [PATCH 03/10] phpstan fixes --- .../Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php | 2 +- src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php index e5a37c430..bd812e036 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php @@ -55,7 +55,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa $user = $this->userRepository->find($object->getUserId()); return [ - 'comment' => (string) $object->getComment(), + 'comment' => $object->getComment(), 'isNull' => false, 'date' => $this->normalizer->normalize($object->getDate(), $format, array_merge($context, [ 'docgen:expects' => DateTime::class, diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index 9030b9264..e7dd210df 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -16,7 +16,7 @@ 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\Component\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { From 5bfdee0c286d8bd32f37a1cdab3b97ab55f710ff Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 11:09:14 +0100 Subject: [PATCH 04/10] corrections review --- .../Controller/PersonResourceController.php | 2 -- .../Controller/UserAccompanyingPeriodController.php | 8 +++++--- src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php | 6 ------ .../Resources/views/PersonResource/list.html.twig | 4 +--- src/Bundle/ChillPersonBundle/config/routes.yaml | 4 ---- 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index 577a271e8..210b507e5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -148,8 +148,6 @@ final class PersonResourceController extends AbstractController $comment = $form['comment']->getData(); $kind = $form['kind']->getData(); - dump($person); - $personResource->setKind($kind); $personResource->setPerson($person); $personResource->setThirdParty($thirdparty); diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 956849efc..9c24e127f 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -15,6 +15,7 @@ namespace Chill\PersonBundle\Controller; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; class UserAccompanyingPeriodController extends AbstractController { @@ -26,12 +27,13 @@ class UserAccompanyingPeriodController extends AbstractController $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; } + /** + * @Route("/{_locale}/accompanying-periods", name="chill_person_accompanying_period_user") + */ public function listAction(Request $request) { - $userId = $this->getUser()->getId(); - $accompanyingPeriods = []; - $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $userId]); + $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $this->getUser()]); return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [ 'accompanyingPeriods' => $accompanyingPeriods diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index e7dd210df..1b86135b8 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -41,14 +41,8 @@ class UserMenuBuilder implements LocalMenuBuilderInterface public $translator; public function __construct( - CountNotificationTask $counter, - TokenStorageInterface $tokenStorage, - TranslatorInterface $translator, AuthorizationCheckerInterface $authorizationChecker ) { - $this->counter = $counter; - $this->tokenStorage = $tokenStorage; - $this->translator = $translator; $this->authorizationChecker = $authorizationChecker; } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig index 5964cef54..820da9179 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig @@ -52,9 +52,7 @@ {% if resource.comment.comment is not empty %}
    -
    -
    {{ resource.comment.comment }}
    -
    +
    {{ resource.comment|chill_entity_render_box }}
    {% endif %} diff --git a/src/Bundle/ChillPersonBundle/config/routes.yaml b/src/Bundle/ChillPersonBundle/config/routes.yaml index 13539f6c2..13d1c1227 100644 --- a/src/Bundle/ChillPersonBundle/config/routes.yaml +++ b/src/Bundle/ChillPersonBundle/config/routes.yaml @@ -55,10 +55,6 @@ chill_person_accompanying_period_re_open: path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::reOpenAction -chill_person_accompanying_period_user: - path: /{_locale}/accompanying-periods - controller: Chill\PersonBundle\Controller\UserAccompanyingPeriodController::listAction - chill_person_resource_list: path: /{_locale}/person/{person_id}/resources/list controller: Chill\PersonBundle\Controller\PersonResourceController::listAction From 0cda5d637d5917b7c4c0f897731854cccbcd0910 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 12:16:32 +0100 Subject: [PATCH 05/10] styling of parcours list in person search changed --- .../views/Person/list_with_period.html.twig | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 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 cc83dc6ed..5dc1793de 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 @@ -78,16 +78,25 @@ {% set app = person.findParticipationForPeriod(acp) %}
    - - + {% if acp.requestorPerson == person %} +
    +
    +

    + + {{ 'Requestor'|trans({'gender': person.gender}) }} + +

    +
    +
    + +
    +
    + {% endif %}
    @@ -97,7 +106,7 @@ {{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
    {% endif %} - + {% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) %} {% if notif_counter.total > 0 %} {{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) }} @@ -107,18 +116,22 @@ {% if acp.emergency %} {{- 'Emergency'|trans|upper -}} {% endif %} - + {% if acp.confidential %} {{- 'Confidential'|trans|upper -}} {% endif %} - + {% if acp.step == 'DRAFT' %} {{ 'course.draft'|trans }} {% endif %} + + {% if acp.step == 'CLOSED' %} + {{ 'course.closed'|trans }} + {% endif %}
    - + {% if acp.user is not null %}
    @@ -131,7 +144,7 @@
    {% endif %} - + {% if acp.socialIssues|length > 0 %}
    @@ -144,24 +157,7 @@
    {% endif %} - - {# ???? - {% if acp.requestorPerson == person %} -
    -
    -

    - -

    -
    -
    - - {{ 'Requestor'|trans({'gender': person.gender}) }} - -
    -
    - {% endif %} - #} - + {% if acp.currentParticipations|length > 1 %}
    @@ -190,7 +186,16 @@
    {% endif %} - + + + {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %}
    From 4620e32b82753d5c03f0f7afc8f7a7fd489ddf1c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 12:20:29 +0100 Subject: [PATCH 06/10] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1e466b6..4d228aa42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to * [parcours] comments truncated if too long + link added (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/406) * [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382) * [person ressources]: module added +* [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410) ## Test releases From efff496f7a32627dba406aa24ad1feb470c2febc Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 28 Jan 2022 18:01:29 +0100 Subject: [PATCH 07/10] hot fix: pick-entity: set input.value to null if multiple=false --- .../Resources/public/module/pick-entity/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js index 1fd6b34f7..4cc917502 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js @@ -19,6 +19,12 @@ function loadDynamicPicker(element) { input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'), picked = (isMultiple) ? (JSON.parse(input.value)) : ((input.value === '[]') ? (null) : ([JSON.parse(input.value)])); + if (!isMultiple) { + if (input.value === '[]'){ + input.value = null; + } + } + const app = createApp({ template: ' Date: Sat, 29 Jan 2022 02:56:06 +0100 Subject: [PATCH 08/10] button requestor on the right --- .../views/Person/list_with_period.html.twig | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 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 5dc1793de..6f107a593 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 @@ -78,20 +78,6 @@ {% set app = person.findParticipationForPeriod(acp) %}
    - {% if acp.requestorPerson == person %} -
    -
    -

    - - {{ 'Requestor'|trans({'gender': person.gender}) }} - -

    -
    -
    - -
    -
    - {% endif %}

    @@ -113,6 +99,11 @@ {% endif %}

    + {% if acp.requestorPerson == person %} + + {{ 'Requestor'|trans({'gender': person.gender}) }} + + {% endif %} {% if acp.emergency %} {{- 'Emergency'|trans|upper -}} {% endif %} @@ -227,7 +218,7 @@
    {% endif %} - +
    {% endfor %} From 1a04d903fc295302f0df5e5688b8cf6c2e510aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sat, 29 Jan 2022 03:08:34 +0100 Subject: [PATCH 09/10] fixes for page 'mes parcours' --- .../UserAccompanyingPeriodController.php | 17 ++++++++++++----- .../Menu/UserMenuBuilder.php | 11 +---------- .../AccompanyingPeriodRepository.php | 5 +++++ .../user_periods_list.html.twig | 19 ++++++++++++------- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 9c24e127f..ddaf1b856 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Controller; +use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -22,9 +23,12 @@ class UserAccompanyingPeriodController extends AbstractController private AccompanyingPeriodRepository $accompanyingPeriodRepository; - public function __construct(AccompanyingPeriodRepository $accompanyingPeriodRepository) + private PaginatorFactory $paginatorFactory; + + public function __construct(AccompanyingPeriodRepository $accompanyingPeriodRepository, PaginatorFactory $paginatorFactory) { $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; + $this->paginatorFactory = $paginatorFactory; } /** @@ -32,12 +36,15 @@ class UserAccompanyingPeriodController extends AbstractController */ public function listAction(Request $request) { - $accompanyingPeriods = []; - $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $this->getUser()]); + $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()); return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [ - 'accompanyingPeriods' => $accompanyingPeriods + 'accompanyingPeriods' => $accompanyingPeriods, + 'pagination' => $pagination, ]); } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index 1b86135b8..3e56b423c 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -25,15 +25,6 @@ class UserMenuBuilder implements LocalMenuBuilderInterface */ public $authorizationChecker; - /** - * @var CountNotificationTask - */ - public $counter; - - /** - * @var TokenStorageInterface - */ - public $tokenStorage; /** * @var TranslatorInterface @@ -63,4 +54,4 @@ class UserMenuBuilder implements LocalMenuBuilderInterface { return ['user']; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index b21431554..9554f2a3b 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -49,6 +49,11 @@ 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); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig index 12faf739a..d30997bac 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig @@ -2,7 +2,7 @@ {% set activeRouteKey = 'chill_person_accompanying_period_user_list' %} -{% block title %}{{ 'Accompanying period list'|trans }}{% endblock title %} +{% block title %}{{ 'My accompanying periods'|trans }}{% endblock title %} {% macro recordAction(period) %}
  • @@ -14,12 +14,17 @@ {% block content %} -

    {{ 'Accompanying period list'|trans }}

    +
    +

    {{ 'My accompanying periods'|trans }}

    + +
    + {% for period in accompanyingPeriods %} + {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %} + {% endfor %} +
    + + {{ chill_pagination(pagination) }} -
    - {% for period in accompanyingPeriods %} - {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %} - {% endfor %}
    -{% endblock %} \ No newline at end of file +{% endblock %} From 1c02eb23fdc7136616d0dc950be8dd12fff41626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 31 Jan 2022 10:41:08 +0100 Subject: [PATCH 10/10] fix user search --- .../Search/Entity/SearchUserApiProvider.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php index 5c3c6b057..32c0a3b43 100644 --- a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php +++ b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php @@ -45,13 +45,15 @@ class SearchUserApiProvider implements SearchApiInterface $query ->setSelectKey('user') ->setSelectJsonbMetadata("jsonb_build_object('id', u.id)") - ->setSelectPertinence('GREATEST(SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical), - SIMILARITY(LOWER(UNACCENT(?)), u.emailcanonical))', [$pattern, $pattern]) + ->setSelectPertinence('GREATEST(SIMILARITY(LOWER(UNACCENT(?)), u.label), + SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical))', [$pattern, $pattern]) ->setFromClause('users AS u') - ->setWhereClauses('SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical) > 0.15 - OR - SIMILARITY(LOWER(UNACCENT(?)), u.emailcanonical) > 0.15 - ', [$pattern, $pattern]); + ->setWhereClauses(' + SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical) > 0.15 + OR u.usernamecanonical LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\' + OR SIMILARITY(LOWER(UNACCENT(?)), LOWER(UNACCENT(u.label))) > 0.15 + OR u.label LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\' + ', [$pattern, $pattern, $pattern, $pattern]); return $query; }