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 -->
* [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
@ -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] 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)
* dispatching list
### 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 ressources]: module added
* [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

View File

@ -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: '<pick-entity ' +
':multiple="multiple" ' +

View File

@ -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;
}

View File

@ -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,

View File

@ -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);

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);
}
public function countBy(array $criteria): int
{
return $this->repository->count($criteria);
}
public function findOneBy(array $criteria): ?AccompanyingPeriod
{
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) %}
<div class="item-row separator">
<div class="wrap-list periods-list">
<div class="wl-row">
<div class="wl-col title">
<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>
{{ 'File number'|trans }} {{ acp.id }}
</a>
</h3>
</div>
<div class="wl-col list">
@ -104,6 +99,11 @@
{% endif %}
</div>
<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 %}
<span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span>
{% endif %}
@ -115,6 +115,10 @@
{% if acp.step == 'DRAFT' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.draft'|trans }}">{{ 'course.draft'|trans }}</span>
{% 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>
@ -145,23 +149,6 @@
</div>
{% 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 %}
<div class="wl-row">
<div class="wl-col title">
@ -191,6 +178,15 @@
</div>
{% 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 %}
<div class="wl-row">
<div class="wl-col title">

View File

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

View File

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