[closing motive] add an hierarchy + admin section for closing motives

This commit is contained in:
2020-03-12 12:19:15 +01:00
parent ceb3b5e955
commit e59f58f461
26 changed files with 712 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive:
table: chill_person_closingmotive
type: entity
repositoryClass: Chill\PersonBundle\Repository\ClosingMotiveRepository
id:
id:
type: integer
@@ -11,3 +12,15 @@ Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive:
type: json_array
active:
type: boolean
ordering:
type: float
options:
default: 0.0
oneToMany:
children:
targetEntity: Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive
mappedBy: parent
manyToOne:
parent:
targetEntity: Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive
inversedBy: children

View File

@@ -83,4 +83,8 @@ chill_person_timeline:
menus:
person:
order: 60
label: Timeline
label: Timeline
chill_person_admin:
path: "/{_locale}/admin/person"
defaults: { _controller: ChillPersonBundle:Admin:index }

View File

@@ -15,3 +15,5 @@ services:
Chill\PersonBundle\Controller\AccompanyingPeriodController:
arguments:
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
Chill\PersonBundle\Controller\AdminController: ~

View File

@@ -22,9 +22,12 @@ services:
deprecated: true
chill.person.accompanying_period_closing_motive:
class: Chill\PersonBundle\Form\Type\ClosingMotiveType
class: Chill\PersonBundle\Form\Type\ClosingMotivePickerType
arguments:
- "@chill.main.helper.translatable_string"
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
$chillEntityRenderExtension: '@Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension'
$closingMotiveRepository: '@Chill\PersonBundle\Repository\ClosingMotiveRepository'
tags:
- { name: form.type, alias: closing_motive }

View File

@@ -5,6 +5,12 @@ services:
tags:
- { name: 'chill.menu_builder' }
Chill\PersonBundle\Menu\AdminMenuBuilder:
arguments:
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
tags:
- { name: 'chill.menu_builder' }
Chill\PersonBundle\Menu\PersonMenuBuilder:
arguments:
$showAccompanyingPeriod: '%chill_person.accompanying_period%'

View File

@@ -11,3 +11,11 @@ services:
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\PersonBundle\Entity\Person'
Chill\PersonBundle\Repository\ClosingMotiveRepository:
class: Chill\PersonBundle\Repository\ClosingMotiveRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive'
tag:
- { name: doctrine.repository_service }

View File

@@ -4,3 +4,9 @@ services:
$configAltNamesHelper: '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
tags:
- 'chill.render_entity'
Chill\PersonBundle\Templating\Entity\ClosingMotiveRender:
arguments:
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
tags:
- 'chill.render_entity'

View File

@@ -125,8 +125,8 @@ Any accompanying periods are open: Aucune période d'accompagnement ouverte
An accompanying period is open: Une période d'accompagnement est ouverte
Accompanying period list: Périodes d'accompagnement
Choose a motive: Motif de fermeture
Re-open accompanying period: Ré-ouvrir la période d'accompagnement
Re-Open a period: Ré-ouvrir une période d'accompagnement
Re-open accompanying period: Ré-ouvrir
Re-Open a period: Ré-ouvrir
Are you sure you want to re-open this period ?: Êtes-vous sûr de vouloir ré-ouvrir cette période d'accompagnement ?
'The period has been re-opened': La période d'accompagnement a été ré-ouverte.
Pediod closing form is not valid: Le formulaire n'est pas valide
@@ -221,3 +221,31 @@ Calculate age in relation to this date: Calculer l'âge par rapport à cette dat
Group people by country of birth: Aggréger les personnes par pays de naissance
Similar persons: Personnes similaires
crud:
closing_motive:
index:
title: Liste des motifs de clotûre
add_new: Ajouter un nouveau
title_new: Nouveau motif de clotûre
title_edit: Modifier le motif de clotûre
# specific to closing motive
closing_motive:
any parent: Aucun parent
new child: Nouvel enfant
Configuration of person bundle: Configuration du module "Personnes"
person_admin:
What would you like to configure ?: Que souhaitez-vous configurer ?
closing motives list: Liste des motifs de clotûre
closing motive explanation: >
Les motifs de clotûre donnent des indications sur la fermeture
d'une période d'accompagnement.
accompanying_period:
dates: Période
dates_from_%opening_date%: Ouvert depuis le %opening_date%
dates_from_%opening_date%_to_%closing_date%: Ouvert du %opening_date% au %closing_date%

View File

@@ -8,10 +8,9 @@
<table class="rounded">
<thead>
<tr>
<th class="chill-red">{{ 'Opening date'|trans }}</th>
<th class="chill-green">{{ 'Closing date'|trans }}</th>
<th class="chill-red">{{ 'accompanying_period.dates'|trans }}</th>
{% if chill_accompanying_periods.fields.user == 'visible' %}
<th class="chill-green">{{ 'Accompanying user'|trans }}</th>
<th class="chill-blue">{{ 'Accompanying user'|trans }}</th>
{% endif %}
<th class="chill-orange">{{ 'Remark'|trans }}</th>
<th>&nbsp;</th>
@@ -21,14 +20,17 @@
<tbody>
{% for accompanying_period in accompanying_periods %}
<tr>
<td>{{ accompanying_period.openingDate|localizeddate('long', 'none', app.request.locale) }}</td>
<td>{% spaceless %}
{% if accompanying_period.isOpen %}
{{ 'Period opened'|trans }}
<td>
{% if accompanying_period.isOpen == false %}
{{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|localizeddate('long', 'none') } ) }}
{% else %}
{{ accompanying_period.closingDate|localizeddate('long', 'none', app.request.locale) }}
{{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({
'%opening_date%': accompanying_period.openingDate|localizeddate('long', 'none'),
'%closing_date%': accompanying_period.closingDate|localizeddate('long', 'none')}
) }}
<div>{{ accompanying_period.closingMotive|chill_entity_render_box }}</div>
{% endif %}
{% endspaceless %}</td>
</td>
{% if chill_accompanying_periods.fields.user == 'visible' %}
<td>
{% if accompanying_period.user %}
@@ -39,13 +41,7 @@
</td>
{% endif %}
<td>
{% if accompanying_period.remark is empty %}
<p class="chill-no-data-statement">{{ 'No remark'|trans }}</p>
{% else %}
<blockquote class="chill-user-quote">
{{ accompanying_period.remark|nl2br }}
</blockquote>
{% endif %}
{{ accompanying_period.remark|chill_print_or_message('No remark', 'blockquote') }}
</td>
<td>
<ul class="record_actions">
@@ -82,14 +78,15 @@
</a>
</li>
<li>
<a href="{{ path ('chill_person_accompanying_period_create', {'person_id' : person.id } ) }}" class="sc-button bt-create">
{{ 'Add an accompanying period in the past'|trans }}
<a href="{{ path ('chill_person_accompanying_period_create', {'person_id' : person.id } ) }}" class="sc-button bt-create has-hidden">
<span class="show-on-hover">{{ 'Add an accompanying period in the past'|trans }}</span>
</a>
</li>
{% if person.isOpen == false %}
<li>
<a href="{{ path('chill_person_accompanying_period_open', {'person_id' : person.id} ) }}" class="sc-button bt-create change-icon">
<i class="fa fa-unlock" aria-hidden="true"></i>{{'Begin a new accompanying period'|trans }}
<a href="{{ path('chill_person_accompanying_period_open', {'person_id' : person.id} ) }}" class="sc-button bt-create change-icon has-hidden">
<i class="fa fa-unlock" aria-hidden="true"></i>
<span class="show-on-hover">{{'Begin a new accompanying period'|trans }}</span>
</a>
</li>
{% endif %}

View File

@@ -0,0 +1,44 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillMainBundle::Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_person') }}
{% endblock %}
{% block admin_content %}
<div class="grid-12 centered">
<h1>{{ 'Configuration of person bundle' |trans }}</h1>
<p>{{ 'person_admin.What would you like to configure ?'|trans }}</p>
<ul>
<li>
<p>
<a href="{{ path('chill_crud_closing_motive_index') }}">
<strong>{{ 'person_admin.closing motives list'|trans }}</strong>
</a>
</p>
<p>{{ 'person_admin.closing motive explanation'|trans }}</p>
</li>
</ul>
</div>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -0,0 +1,32 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>{{ 'Ordering'|trans }}</th>
<th>{{ 'Label'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.ordering }}</td>
<td>{{ entity|chill_entity_render_box }}</td>
<td>{{ entity.active }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_closing_motive_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_crud_closing_motive_new', { 'parent_id': entity.id } ) }}" class="sc-button bt-new">{{ 'closing_motive.new child'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}