Merge branch 'master' into 'issue411_openingDate_parcours'

# Conflicts:
#   CHANGELOG.md
This commit is contained in:
LenaertsJ 2022-01-31 10:19:54 +00:00
commit 76a7b019eb
12 changed files with 191 additions and 43 deletions

View File

@ -12,6 +12,9 @@ and this project adheres to
<!-- write down unreleased development here --> <!-- write down unreleased development here -->
* [parcours]: component added to change the opening date of a parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/411) * [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)
## Test releases ## Test releases
@ -24,6 +27,7 @@ and this project adheres to
* [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377) * [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377)
* [person] Add residential address entity, form and list for each person * [person] Add residential address entity, form and list for each person
* [aside_activity]: dynamicUserPickerType used (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/399) * [aside_activity]: dynamicUserPickerType used (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/399)
* dispatching list
### test release 2021-01-26 ### test release 2021-01-26
@ -32,7 +36,6 @@ and this project adheres to
* [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382) * [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
* [parcours] bugfix if deathdate is not defined (eg. for a thirdparty) parcours is still displayed. Gave error before. * [parcours] bugfix if deathdate is not defined (eg. for a thirdparty) parcours is still displayed. Gave error before.
* dispatching list
### test release 2022-01-24 ### test release 2022-01-24

View File

@ -19,6 +19,12 @@ function loadDynamicPicker(element) {
input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'), input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'),
picked = (isMultiple) ? (JSON.parse(input.value)) : ((input.value === '[]') ? (null) : ([JSON.parse(input.value)])); picked = (isMultiple) ? (JSON.parse(input.value)) : ((input.value === '[]') ? (null) : ([JSON.parse(input.value)]));
if (!isMultiple) {
if (input.value === '[]'){
input.value = null;
}
}
const app = createApp({ const app = createApp({
template: '<pick-entity ' + template: '<pick-entity ' +
':multiple="multiple" ' + ':multiple="multiple" ' +

View File

@ -45,13 +45,15 @@ class SearchUserApiProvider implements SearchApiInterface
$query $query
->setSelectKey('user') ->setSelectKey('user')
->setSelectJsonbMetadata("jsonb_build_object('id', u.id)") ->setSelectJsonbMetadata("jsonb_build_object('id', u.id)")
->setSelectPertinence('GREATEST(SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical), ->setSelectPertinence('GREATEST(SIMILARITY(LOWER(UNACCENT(?)), u.label),
SIMILARITY(LOWER(UNACCENT(?)), u.emailcanonical))', [$pattern, $pattern]) SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical))', [$pattern, $pattern])
->setFromClause('users AS u') ->setFromClause('users AS u')
->setWhereClauses('SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical) > 0.15 ->setWhereClauses('
OR SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical) > 0.15
SIMILARITY(LOWER(UNACCENT(?)), u.emailcanonical) > 0.15 OR u.usernamecanonical LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\'
', [$pattern, $pattern]); OR SIMILARITY(LOWER(UNACCENT(?)), LOWER(UNACCENT(u.label))) > 0.15
OR u.label LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\'
', [$pattern, $pattern, $pattern, $pattern]);
return $query; return $query;
} }

View File

@ -55,7 +55,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
$user = $this->userRepository->find($object->getUserId()); $user = $this->userRepository->find($object->getUserId());
return [ return [
'comment' => (string) $object->getComment(), 'comment' => $object->getComment(),
'isNull' => false, 'isNull' => false,
'date' => $this->normalizer->normalize($object->getDate(), $format, array_merge($context, [ 'date' => $this->normalizer->normalize($object->getDate(), $format, array_merge($context, [
'docgen:expects' => DateTime::class, 'docgen:expects' => DateTime::class,

View File

@ -148,8 +148,6 @@ final class PersonResourceController extends AbstractController
$comment = $form['comment']->getData(); $comment = $form['comment']->getData();
$kind = $form['kind']->getData(); $kind = $form['kind']->getData();
dump($person);
$personResource->setKind($kind); $personResource->setKind($kind);
$personResource->setPerson($person); $personResource->setPerson($person);
$personResource->setThirdParty($thirdparty); $personResource->setThirdParty($thirdparty);

View File

@ -0,0 +1,50 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
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;
use Symfony\Component\Routing\Annotation\Route;
class UserAccompanyingPeriodController extends AbstractController
{
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
private PaginatorFactory $paginatorFactory;
public function __construct(AccompanyingPeriodRepository $accompanyingPeriodRepository, PaginatorFactory $paginatorFactory)
{
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
$this->paginatorFactory = $paginatorFactory;
}
/**
* @Route("/{_locale}/accompanying-periods", name="chill_person_accompanying_period_user")
*/
public function listAction(Request $request)
{
$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,
'pagination' => $pagination,
]);
}
}

View File

@ -0,0 +1,57 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
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;
class UserMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
public $authorizationChecker;
/**
* @var TranslatorInterface
*/
public $translator;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker
) {
$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'];
}
}

View File

@ -49,6 +49,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository
return $this->repository->findBy($criteria, $orderBy, $limit, $offset); 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 public function findOneBy(array $criteria): ?AccompanyingPeriod
{ {
return $this->findOneBy($criteria); return $this->findOneBy($criteria);

View File

@ -0,0 +1,30 @@
{% extends "@ChillMain/layout.html.twig" %}
{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %}
{% block title %}{{ 'My accompanying periods'|trans }}{% endblock title %}
{% macro recordAction(period) %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
</li>
{% endmacro %}
{% block content %}
<div class="col-md-10">
<h1>{{ 'My accompanying periods'|trans }}</h1>
<div class="flex-table accompanyingcourse-list">
{% for period in accompanyingPeriods %}
{% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
{% endfor %}
</div>
{{ chill_pagination(pagination) }}
</div>
{% endblock %}

View File

@ -78,16 +78,11 @@
{% set app = person.findParticipationForPeriod(acp) %} {% set app = person.findParticipationForPeriod(acp) %}
<div class="item-row separator"> <div class="item-row separator">
<div class="wrap-list periods-list"> <div class="wrap-list periods-list">
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">
<h3 class="courseid mb-2"> <h3 class="courseid mb-2">
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
title="{{ 'See accompanying period'|trans }}" class="btn btn-outline-primary">
<i class="fa fa-random fa-fw"></i> <i class="fa fa-random fa-fw"></i>
{{ 'File number'|trans }} {{ acp.id }} {{ 'File number'|trans }} {{ acp.id }}
</a>
</h3> </h3>
</div> </div>
<div class="wl-col list"> <div class="wl-col list">
@ -97,28 +92,37 @@
{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }} {{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
</div> </div>
{% endif %} {% endif %}
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) %} {% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) %}
{% if notif_counter.total > 0 %} {% if notif_counter.total > 0 %}
{{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) }} {{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) }}
{% endif %} {% endif %}
</div> </div>
<div class="ms-auto"> <div class="ms-auto">
{% if acp.requestorPerson == person %}
<span class="as-requestor badge bg-info" title="{{ 'Requestor'|trans|e('html_attr') }}">
{{ 'Requestor'|trans({'gender': person.gender}) }}
</span>
{% endif %}
{% if acp.emergency %} {% if acp.emergency %}
<span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span> <span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span>
{% endif %} {% endif %}
{% if acp.confidential %} {% if acp.confidential %}
<span class="badge rounded-pill bg-confidential">{{- 'Confidential'|trans|upper -}}</span> <span class="badge rounded-pill bg-confidential">{{- 'Confidential'|trans|upper -}}</span>
{% endif %} {% endif %}
{% if acp.step == 'DRAFT' %} {% if acp.step == 'DRAFT' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.draft'|trans }}">{{ 'course.draft'|trans }}</span> <span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.draft'|trans }}">{{ 'course.draft'|trans }}</span>
{% endif %} {% endif %}
{% if acp.step == 'CLOSED' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.closed'|trans }}">{{ 'course.closed'|trans }}</span>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
{% if acp.user is not null %} {% if acp.user is not null %}
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">
@ -131,7 +135,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if acp.socialIssues|length > 0 %} {% if acp.socialIssues|length > 0 %}
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">
@ -144,24 +148,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{# ????
{% if acp.requestorPerson == person %}
<div class="wl-row">
<div class="wl-col title">
<h3>
</h3>
</div>
<div class="wl-col list">
<span class="as-requestor badge bg-info" title="{{ 'Requestor'|trans|e('html_attr') }}">
{{ 'Requestor'|trans({'gender': person.gender}) }}
</span>
</div>
</div>
{% endif %}
#}
{% if acp.currentParticipations|length > 1 %} {% if acp.currentParticipations|length > 1 %}
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">
@ -190,7 +177,16 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
<ul class="record_actions record_actions_column">
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-random fa-fw"></i>
</a>
</li>
</ul>
{% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %}
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">
@ -222,7 +218,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endfor %} {% endfor %}

View File

@ -52,9 +52,7 @@
{% if resource.comment.comment is not empty %} {% if resource.comment.comment is not empty %}
<div class="item-row separator"> <div class="item-row separator">
<section class="chill-entity entity-comment-embeddable"> <section class="chill-entity entity-comment-embeddable">
<blockquote class="chill-user-quote"> <div>{{ resource.comment|chill_entity_render_box }}<div>
<div>{{ resource.comment.comment }}<div>
</blockquote>
</section> </section>
</div> </div>
{% endif %} {% endif %}

View File

@ -558,3 +558,6 @@ household_composition:
# docgen # docgen
Linked evaluations: Évaluations associées Linked evaluations: Évaluations associées
# Accompanying period per user
My accompanying periods: Mes parcours