household: if no addresses, misc stuffs

This commit is contained in:
Mathieu Jaumotte 2021-08-01 16:17:29 +02:00
parent 96e979f92d
commit a096266ca5
3 changed files with 150 additions and 145 deletions

View File

@ -1,141 +1,145 @@
{% block content %} {% block content %}
<div class="flex-table accompanyingcourse-list"> <div class="flex-table">
{% for accompanying_period in accompanying_periods %} {% for accompanying_period in accompanying_periods %}
<div class="item-bloc"> <div class="item-bloc">
<div class="item-row"> <div class="item-row">
<div class="item-col"> <div class="item-col">
<b>#{{ accompanying_period.id }}</b> <b>#{{ accompanying_period.id }}</b>
{% if accompanying_period.emergency %} {% if accompanying_period.emergency %}
<span class="badge bg-primary">{{- 'Emergency'|trans|upper -}}</span> <span class="badge bg-primary">{{- 'Emergency'|trans|upper -}}</span>
{% endif %} {% endif %}
{% if accompanying_period.confidential %} {% if accompanying_period.confidential %}
<span class="badge bg-primary">{{- 'Confidential'|trans|upper -}}</span> <span class="badge bg-primary">{{- 'Confidential'|trans|upper -}}</span>
{% endif %} {% endif %}
{% if accompanying_period.step == 'DRAFT' %} {% if accompanying_period.step == 'DRAFT' %}
<span class="badge bg-primary">{{- 'Draft'|trans|upper -}}</span> <span class="badge bg-primary">{{- 'Draft'|trans|upper -}}</span>
{% else %} {% else %}
<span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span> <span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span>
{% endif %}
</div>
<div class="item-col">
{% if chill_accompanying_periods.fields.user == 'visible' %}
{% if accompanying_period.user %}
{{ accompanying_period.user.username }}
{% else %}
<span class="chill-no-data-statement">{{ 'No accompanying user'|trans }}</span>
{% endif %}
{% endif %} {% endif %}
</div>
</div> </div>
<div class="item-row">
<div class="item-col"> {% if accompanying_period.closingDate == null %}
{% if chill_accompanying_periods.fields.user == 'visible' %} {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }}
{% if accompanying_period.user %}
{{ accompanying_period.user.username }}
{% else %} {% else %}
<span class="chill-no-data-statement">{{ 'No accompanying user'|trans }}</span> {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({
'%opening_date%': accompanying_period.openingDate|format_date('long'),
'%closing_date%': accompanying_period.closingDate|format_date('long')}
) }}
{% if accompanying_period.isOpen == false %}
<dl class="chill_view_data">
<dt>{{ 'Closing motive'|trans }}&nbsp;:</dt>
<dd>{{ accompanying_period.closingMotive|chill_entity_render_box }}</dd>
</dl>
{% endif %}
{% endif %} {% endif %}
{% endif %}
</div> </div>
<div class="item-row">
</div> <div class="item-col"><h3>{{ 'Participants'|trans }}</h3></div>
<div class="item-row"> <div class="item-col">
{% if accompanying_period.participations.count > 0 %}
{% for p in accompanying_period.participations %}
<p>
<a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}">
{{ p.person.firstname ~ ' ' ~ p.person.lastname }}
</a>
</p>
{% endfor %}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</div>
{% if accompanying_period.closingDate == null %} </div>
{{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} <div class="item-row">
{% else %}
{{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({
'%opening_date%': accompanying_period.openingDate|format_date('long'),
'%closing_date%': accompanying_period.closingDate|format_date('long')}
) }}
{% if accompanying_period.isOpen == false %}
<dl class="chill_view_data">
<dt>{{ 'Closing motive'|trans }}&nbsp;:</dt>
<dd>{{ accompanying_period.closingMotive|chill_entity_render_box }}</dd>
</dl>
{% endif %}
{% endif %}
</div> <div class="item-col"><h3>{{ 'Requestor'|trans }}</h3></div>
<div class="item-row"> <div class="item-col">
{% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %}
{% if accompanying_period.requestorPerson is not null %}
<p>
{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}
</p>
{% endif %}
{% if accompanying_period.requestorThirdParty is not null %}
<p>
{{ accompanying_period.requestorThirdParty.name }}
</p>
{% endif %}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</div>
<div class="item-col"><h3>{{ 'Participants'|trans }}</h3></div> </div>
<div class="item-col"> <div class="item-row">
{% if accompanying_period.participations.count > 0 %}
{% for p in accompanying_period.participations %} <h3>{{ 'Social issues'|trans }}</h3>
<p> {% if accompanying_period.socialIssues.count > 0 %}
<a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}"> {% for si in accompanying_period.socialIssues %}
{{ p.person.firstname ~ ' ' ~ p.person.lastname }} <p>{{ si.title|localize_translatable_string }}</p>
</a>
</p>
{% endfor %} {% endfor %}
{% else %} {% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span> <span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %} {% endif %}
</div> </div>
<div class="item-row">
</div> <ul class="record_actions">
<div class="item-row">
<div class="item-col"><h3>{{ 'Requestor'|trans }}</h3></div> {# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
<div class="item-col">
{% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %}
{% if accompanying_period.requestorPerson is not null %}
<p>
{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}
</p>
{% endif %}
{% if accompanying_period.requestorThirdParty is not null %}
<p>
{{ accompanying_period.requestorThirdParty.name }}
</p>
{% endif %}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</div>
</div>
<div class="item-row">
<h3>{{ 'Social issues'|trans }}</h3>
{% if accompanying_period.socialIssues.count > 0 %}
{% for si in accompanying_period.socialIssues %}
<p>{{ si.title|localize_translatable_string }}</p>
{% endfor %}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</div>
<div class="item-row">
<ul class="record_actions">
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': accompanying_period.id }) }}"
class="btn btn-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-fw fa-random"></i>
{{ 'See this period'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}"
class="btn btn-update" title="{{ 'Edit Accompanying Course'|trans }}"></a>
</li>
{% if accompanying_period.isOpen == true %}
<li> <li>
<a href="{{ path('chill_person_accompanying_period_close', {'person_id' : person.id}) }}" <a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': accompanying_period.id }) }}"
class="btn btn-update change-icon"> class="btn btn-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-fw fa-lock" aria-hidden="true"></i> <i class="fa fa-fw fa-random"></i>
{{'Close accompanying period'|trans }} {{ 'See this period'|trans }}
</a> </a>
</li> </li>
{% endif %}
{% if accompanying_period.canBeReOpened(person) == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_re_open', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}"
class="btn btn-create change-icon">
<i class="fa fa-fw fa-unlock" aria-hidden="true"></i>
{{'Re-open accompanying period'|trans }}
</a>
</li>
{% endif %}
</ul>
{# TODO cause error in household context. only works in person context
<li>
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}"
class="btn btn-update" title="{{ 'Edit Accompanying Course'|trans }}"></a>
</li>
{% if accompanying_period.isOpen == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_close', {'person_id' : person.id}) }}"
class="btn btn-update change-icon">
<i class="fa fa-fw fa-lock" aria-hidden="true"></i>
{{'Close accompanying period'|trans }}
</a>
</li>
{% endif %}
{% if accompanying_period.canBeReOpened(person) == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_re_open', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}"
class="btn btn-create change-icon">
<i class="fa fa-fw fa-unlock" aria-hidden="true"></i>
{{'Re-open accompanying period'|trans }}
</a>
</li>
{% endif %}
#}
</ul>
</div>
</div> </div>
</div> {% endfor %}
{% endfor %}
</div> </div>
{% endblock content %} {% endblock content %}

View File

@ -5,24 +5,24 @@
{% block content %} {% block content %}
<div class="household-members"> <div class="household-members">
<h1>{{ block('title') }}</h1> <h1>{{ block('title') }}</h1>
{% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %} {% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %}
<div class="form_control"> <ul class="record_actions">
<ul class="record_actions"> <li class="cancel">
<li class="cancel"> <a href="{{ path ('chill_person_household_summary', {'household_id' : household.id } ) }}" class="btn btn-cancel">
<a href="{{ path ('chill_person_household_summary', {'household_id' : household.id } ) }}" class="btn btn-cancel"> {{ 'Household summary'|trans }}
{{ 'Household summary'|trans }} </a>
</a> </li>
</li> {#
{#<li> <li>
<a href="{{ path ('chill_person_household_accompanying_course_new', {'household_id' : [ household.id ] } ) }}" class="btn btn-create"> <a href="{{ path ('chill_person_household_accompanying_course_new', {'household_id' : [ household.id ] } ) }}" class="btn btn-create">
{{ 'Create an accompanying period'|trans }} {{ 'Create an accompanying period'|trans }}
</a> </a>
</li>#} </li>
</ul> #}
</div> </ul>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -7,22 +7,22 @@
<h1>{{ block('title') }}</h1> <h1>{{ block('title') }}</h1>
<ul class="record_actions my-3"> {% if household.addresses|length == 0 %}
<li style="margin: auto;"> <span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
<a class="btn btn-lg btn-create" {% else %}
href="{{ chill_path_add_return_path('chill_person_household_address_move', { 'household_id': household.id }) }}">
{{ 'Move household'|trans }}
</a>
</li>
</ul>
<div class="address-timeline grid"> <ul class="record_actions my-3">
<li style="margin: auto;">
<a class="btn btn-lg btn-create"
href="{{ chill_path_add_return_path('chill_person_household_address_move', { 'household_id': household.id }) }}">
{{ 'Move household'|trans }}
</a>
</li>
</ul>
{% if household.addresses|length == 0 %} <div class="address-timeline grid">
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% else %} <div class="top"><i class="fa fa-caret-up fa-3x"></i></div>
<div class="top"><i class="fa fa-caret-up fa-3x"></i></div>
{% endif %}
{% set row = 0 %} {% set row = 0 %}
{% set previousRowFrom = null %} {% set previousRowFrom = null %}
@ -68,6 +68,7 @@
{% set previousRowFrom = address.validFrom %} {% set previousRowFrom = address.validFrom %}
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">