[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

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