Merge branch 'issue440_mesparcours_brouillon' into 'master'

Mes parcours brouillon

See merge request Chill-Projet/chill-bundles!330
This commit is contained in:
Julien Fastré 2022-02-11 16:23:05 +00:00
commit 1072f539dc
6 changed files with 123 additions and 59 deletions

View File

@ -17,6 +17,7 @@ and this project adheres to
* [on-the-fly] close modal only after validation * [on-the-fly] close modal only after validation
* [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433) * [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433)
* change order for accompanying course work list * 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)
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414) * [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
* [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432) * [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432)
* [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415) * [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415)

View File

@ -34,10 +34,10 @@ class UserAccompanyingPeriodController extends AbstractController
*/ */
public function listAction(Request $request) 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); $pagination = $this->paginatorFactory->create($total);
$accompanyingPeriods = $this->accompanyingPeriodRepository->findBy( $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(
['user' => $this->getUser()], ['user' => $this->getUser(), 'step' => ['CONFIRMED', 'CLOSED']],
['openingDate' => 'DESC'], ['openingDate' => 'DESC'],
$pagination->getItemsPerPage(), $pagination->getItemsPerPage(),
$pagination->getCurrentPageFirstItemNumber() $pagination->getCurrentPageFirstItemNumber()
@ -48,4 +48,24 @@ class UserAccompanyingPeriodController extends AbstractController
'pagination' => $pagination, '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(
['createdBy' => $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,
]);
}
} }

View File

@ -44,6 +44,13 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
'order' => 20, 'order' => 20,
'icon' => 'tasks', 'icon' => 'tasks',
]); ]);
$menu->addChild('My accompanying periods in draft', [
'route' => 'chill_person_accompanying_period_draft_user',
])
->setExtras([
'order' => 30,
'icon' => 'tasks',
]);
} }
} }

View File

@ -26,9 +26,9 @@
</div> </div>
<div class="wh-row"> <div class="wh-row">
<div class="wh-col"> <div class="wh-col">
{% if period.closingDate == null %} {% if period.closingDate == null and period.step != 'DRAFT' %}
{{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }} {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }}
{% else %} {% elseif period.closingDate != null %}
{{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({ {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({
'%opening_date%': period.openingDate|format_date('long'), '%opening_date%': period.openingDate|format_date('long'),
'%closing_date%': period.closingDate|format_date('long')} '%closing_date%': period.closingDate|format_date('long')}
@ -55,65 +55,67 @@
</div> </div>
</div> </div>
</div> </div>
<div class="item-row separator"> {% if period.requestor is not null or period.participations.count > 0 or period.socialIssues.count > 0%}
<div class="wrap-list"> <div class="item-row separator">
{% if period.requestorPerson is not null or period.requestorThirdParty is not null %} <div class="wrap-list">
<div class="wl-row"> {% if period.requestorPerson is not null or period.requestorThirdParty is not null %}
<div class="wl-col title"><h3>{{ 'Requestor'|trans({'gender': null }) }}</h3></div> <div class="wl-row">
<div class="wl-col list"> <div class="wl-col title"><h3>{{ 'Requestor'|trans({'gender': null }) }}</h3></div>
{% if period.requestorPerson is not null %} <div class="wl-col list">
<span class="wl-item"> {% if period.requestorPerson is not null %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { <span class="wl-item">
action: 'show', displayBadge: true, {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'person', id: period.requestorPerson.id }, action: 'show', displayBadge: true,
buttonText: period.requestorPerson|chill_entity_render_string, targetEntity: { name: 'person', id: period.requestorPerson.id },
isDead: period.requestorPerson.deathdate is not null buttonText: period.requestorPerson|chill_entity_render_string,
} %} isDead: period.requestorPerson.deathdate is not null
</span> } %}
{% endif %} </span>
{% if period.requestorThirdParty is not null %} {% endif %}
<span class="wl-item"> {% if period.requestorThirdParty is not null %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { <span class="wl-item">
action: 'show', displayBadge: true, {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'thirdparty', id: period.requestorThirdParty.id }, action: 'show', displayBadge: true,
buttonText: period.requestorThirdParty|chill_entity_render_string targetEntity: { name: 'thirdparty', id: period.requestorThirdParty.id },
} %} buttonText: period.requestorThirdParty|chill_entity_render_string
</span> } %}
{% endif %} </span>
{% endif %}
</div>
</div> </div>
</div> {% endif %}
{% endif %} {% if period.participations.count > 0 %}
{% if period.participations.count > 0 %} <div class="wl-row">
<div class="wl-row"> <div class="wl-col title"><h3>{{ 'Participants'|trans }}</h3></div>
<div class="wl-col title"><h3>{{ 'Participants'|trans }}</h3></div> <div class="wl-col list">
<div class="wl-col list"> {% for p in period.getCurrentParticipations %}
{% for p in period.getCurrentParticipations %} <span class="wl-item">
<span class="wl-item"> {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { action: 'show', displayBadge: true,
action: 'show', displayBadge: true, targetEntity: { name: 'person', id: p.person.id },
targetEntity: { name: 'person', id: p.person.id }, buttonText: p.person|chill_entity_render_string,
buttonText: p.person|chill_entity_render_string, isDead: p.person.deathdate is not null
isDead: p.person.deathdate is not null } %}
} %} </span>
</span> {% endfor %}
{% endfor %} </div>
</div> </div>
</div> {% endif %}
{% endif %} {% if period.socialIssues.count > 0 %}
{% if period.socialIssues.count > 0 %} <div class="wl-row">
<div class="wl-row"> <div class="wl-col title"><h3>{{ 'Social issues'|trans }}</h3></div>
<div class="wl-col title"><h3>{{ 'Social issues'|trans }}</h3></div> <div class="wl-col list">
<div class="wl-col list"> {% for si in period.socialIssues %}
{% for si in period.socialIssues %} <p class="wl-item">
<p class="wl-item"> {{ si|chill_entity_render_box }}
{{ si|chill_entity_render_box }} </p>
</p> {% endfor %}
{% endfor %} </div>
</div> </div>
</div> {% endif %}
{% endif %} </div>
</div> </div>
</div> {% endif %}
<div class="item-row separator"> <div class="item-row separator">
<div class="item-col item-meta"> <div class="item-col item-meta">
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) %} {% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) %}

View File

@ -0,0 +1,32 @@
{% 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) %}
<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 in draft'|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)} %}
{% else %}
<p class="chill-no-data-statement">{{ 'Any accompanying period'|trans }}</p>
{% endfor %}
</div>
{{ chill_pagination(pagination) }}
</div>
{% endblock %}

View File

@ -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: Périodes d'accompagnement
Accompanying period list for person: Périodes d'accompagnement de la personne Accompanying period list for person: Périodes d'accompagnement de la personne
Accompanying period: Parcours d'accompagnement Accompanying period: Parcours d'accompagnement
Any accompanying period: Aucun parcours d'accompagnement
period: Parcours period: Parcours
New accompanying course: Nouveau parcours d'accompagnement New accompanying course: Nouveau parcours d'accompagnement
Choose a motive: Motif de fermeture Choose a motive: Motif de fermeture
@ -566,3 +567,4 @@ Linked evaluations: Évaluations associées
# Accompanying period per user # Accompanying period per user
My accompanying periods: Mes parcours My accompanying periods: Mes parcours
My accompanying periods in draft: Mes parcours brouillons