fix bugs in accompanying periods

ref #11
This commit is contained in:
2016-05-17 10:02:45 +02:00
parent 8b98e8a4b6
commit ce7c149c35
12 changed files with 355 additions and 77 deletions

View File

@@ -2,16 +2,36 @@
{% set activeRouteKey = null %}
{% block title %}{% endblock title %}
{# define the title of the page #}
{% if form.vars.action == 'update' %}
{% set page_title = 'Update accompanying period'|trans %}
{% elseif form.vars.action == 'open' %}
{% set page_title = 'Update accompanying period'|trans %}
{% elseif form.vars.action == 'close' %}
{% set page_title = 'Update accompanying period'|trans %}
{% elseif form.vars.action == 'create' %}
{% set page_title = 'Create an accompanying period'|trans %}
{% else %}
{% set page_title = '' %}
{% endif %}
{% block title page_title %}
{% block personcontent %}
<h1>{{ page_title }}</h1>
{{ form_start(form) }}
<p>
{{ 'Last opening since %last_opening%'|trans(
{ '%last_opening%' : accompanying_period.openingDate|localizeddate('long', 'none', app.request.locale) }) }}
</p>
{% if form.openingDate is defined %}
{{ form_row(form.openingDate, { 'label': 'Opening date'} ) }}
{% endif %}
{% if form.closingDate is defined %}
{{ form_row(form.closingDate, {'label' : 'Closing date'} ) }}
{% endif %}
@@ -24,10 +44,14 @@
{{ form_rest(form) }}
<div class="">
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id } ) }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
</li>
<li>
<button type="submit" class="sc-button bt-update">{{ 'Submit'|trans }}</button>
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id } ) }}" class="sc-button bt-reset">{{ 'Back to the list'|trans }}</a>
</div>
</li>
</ul>
{{ form_end(form) }}

View File

@@ -30,9 +30,28 @@
{{ accompanying_period.remark }}
</td>
<td>
<div class="small warning btn icon-right entypo icon-pencil">
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}" class="sc-button bt-update">{{ 'Edit'|trans }}</a>
</div>
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}" class="sc-button bt-update">
{{ 'Edit'|trans }}
</a>
</li>
{% if accompanying_period.isOpen == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_close', {'person_id' : person.id}) }}" class="sc-button bt-update">
<i class="fa fa-lock" aria-hidden="true"></i> {{'Close accompanying period'|trans }}
</a>
</li>
{% endif %}
{% if accompanying_period.canBeReOpened == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_re_open', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}" class="sc-button bt-create">
{{'Re-open accompanying period'|trans }}
</a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
@@ -40,21 +59,20 @@
</table>
<div class="form_control">
<p>
<a href="{{ path ('chill_person_accompanying_period_create', {'person_id' : person.id } ) }}" class="sc-button bt-create">
{{ 'Create accompanying period'|trans }}
</a>
{% if person.isOpen == true %}
<a href="{{ path('chill_person_accompanying_period_close', {'person_id' : person.id}) }}" class="sc-button bt-update">
{{'Close accompanying period'|trans }}
<ul class="record_actions">
<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>
{% else %}
</li>
{% if person.isOpen == false %}
<li>
<a href="{{ path('chill_person_accompanying_period_open', {'person_id' : person.id} ) }}" class="sc-button bt-create">
{{'Open accompanying period'|trans }}
<i class="fa fa-unlock" aria-hidden="true"></i>{{'Begin a new accompanying period'|trans }}
</a>
</li>
{% endif %}
</p>
</ul>
</div>
{% endblock personcontent %}

View File

@@ -0,0 +1,27 @@
{% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'chill_person_accompanying_period_list' %}
{% block title 'Re-Open a period'|trans %}
{% block personcontent %}
<h1>{{ 'Re-Open a period'|trans }}</h1>
<p class="message-confirm">{{ 'Are you sure you want to re-open this period ?'|trans }}<p>
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id } ) }}" class="sc-button bt-cancel">
{{ 'Cancel'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_person_accompanying_period_re_open', {'confirm' : true, 'person_id' : person.id, 'period_id' : period.id } ) }}" class="sc-button bt-create">
{{'Confirm'|trans }}
</a>
</li>
</ul>
{% endblock personcontent %}