index templates fixed for display of past and future budgets

This commit is contained in:
Julie Lenaerts 2022-02-25 17:01:24 +01:00
parent 416665f209
commit 274c6115cc
2 changed files with 136 additions and 126 deletions

View File

@ -214,16 +214,92 @@
{% endif %} {% endif %}
</div> </div>
{% if household.getCurrentMembers|length > 0 %} {# {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %}
<style> <ul class="record_actions sticky-form-buttons">
button[aria-expanded="true"] > span.folded, <li>
button[aria-expanded="false"] > span.unfolded { display: none; } <a class="btn btn-create" href="{{ path('chill_budget_resource_household_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
button[aria-expanded="false"] > span.folded, </li>
button[aria-expanded="true"] > span.unfolded { display: inline; } <li>
</style> <a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
<h2 class="subtitle">{{ 'Budget household members'|trans }}</h2> </li>
</ul>
{% endif %} #}
{% for hm in household.getCurrentMembers %} {% endif %}
{% if pastCharges|length > 0 or pastResources|length > 0 %}
<h2 class="subtitle">{{ 'Past budget'|trans }}</h2>
<div class="flex-table">
<h3 class="family-title">{{ 'Past resources'|trans }}</h3>
{% if pastResources|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(pastResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past resources registered'|trans }}</span>
<div class="item-bloc">
{% endif %}
</div>
<div class="flex-table">
<h3 class="family-title">{{ 'Past charges'|trans }}</h3>
{% if pastCharges|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(pastCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past charges registered'|trans }}</span>
</div>
{% endif %}
</div>
{% endif %}
{% if futureCharges|length > 0 or futureResources|length > 0 %}
<h2 class="subtitle">{{ 'Future budget'|trans }}</h2>
<div class="flex-table">
<h3 class="family-title">{{ 'Future resources'|trans }}</h3>
{% if futureResources|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(futureResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future resources registered'|trans }}</span>
</div>
{% endif %}
</div>
<div class="flex-table">
<h3 class="family-title">{{ 'Future charges'|trans }}</h3>
{% if futureCharges|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(futureCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future charges registered'|trans }}</span>
</div>
{% endif %}
</div>
{% endif %}
{% if household.getCurrentMembers|length > 0 %}
<style>
button[aria-expanded="true"] > span.folded,
button[aria-expanded="false"] > span.unfolded { display: none; }
button[aria-expanded="false"] > span.folded,
button[aria-expanded="true"] > span.unfolded { display: inline; }
</style>
<h2 class="subtitle">{{ 'Budget household members'|trans }}</h2>
{% for hm in household.getCurrentMembers %}
<div class="accordion" id="nonCurrent"> <div class="accordion" id="nonCurrent">
<div class="accordion-item"> <div class="accordion-item">
{% set member = hm.person %} {% set member = hm.person %}
@ -278,77 +354,7 @@
</div> </div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% endif %}
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %}
<ul class="record_actions sticky-form-buttons">
<li>
<a class="btn btn-create" href="{{ path('chill_budget_resource_household_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
</li>
<li>
<a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
</li>
</ul>
{% endif %}
{% endif %}
{% if pastCharges|length > 0 or pastResources|length > 0 %}
<h2 class="subtitle">{{ 'Past budget'|trans }}</h2>
<h3 class="family-title">{{ 'Past resources'|trans }}</h3>
{% if pastResources|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(pastResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past resources registered'|trans }}</span>
<div class="item-bloc">
{% endif %}
<h3 class="family-title">{{ 'Past charges'|trans }}</h3>
{% if pastCharges|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(pastCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past charges registered'|trans }}</span>
</div>
{% endif %}
{% endif %}
{% if futureCharges|length > 0 or futureResources|length > 0 %}
<h2 class="subtitle">{{ 'Future budget'|trans }}</h2>
<h3 class="family-title">{{ 'Future resources'|trans }}</h3>
{% if futureResources|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(futureResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future resources registered'|trans }}</span>
</div>
{% endif %}
<h3 class="family-title">{{ 'Future charges'|trans }}</h3>
{% if futureCharges|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(futureCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future charges registered'|trans }}</span>
</div>
{% endif %}
{% endif %} {% endif %}
{% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %} {% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %}

View File

@ -214,7 +214,7 @@
{% endif %} {% endif %}
</div> </div>
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %} {# {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %}
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li> <li>
<a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': person.id} ) }}">{{ 'Create new resource'|trans }}</a> <a class="btn btn-create" href="{{ path('chill_budget_resource_new', { 'id': person.id} ) }}">{{ 'Create new resource'|trans }}</a>
@ -223,64 +223,68 @@
<a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': person.id} ) }}">{{ 'Create new charge'|trans }}</a> <a class="btn btn-create" href="{{ path('chill_budget_charge_new', { 'id': person.id} ) }}">{{ 'Create new charge'|trans }}</a>
</li> </li>
</ul> </ul>
{% endif %} {% endif %} #}
{% endif %} {% endif %}
{% if pastCharges|length > 0 or pastResources|length > 0 %} {% if pastCharges|length > 0 or pastResources|length > 0 %}
<h2 class="subtitle">{{ 'Past budget'|trans }}</h2> <h2 class="subtitle">{{ 'Past budget'|trans }}</h2>
<div class="flex-table">
<h3 class="family-title">{{ 'Past resources'|trans }}</h3>
<h3 class="family-title">{{ 'Past resources'|trans }}</h3> {% if pastResources|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(pastResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past resources registered'|trans }}</span>
<div class="item-bloc">
{% endif %}
</div>
<div class="flex-table">
<h3 class="family-title">{{ 'Past charges'|trans }}</h3>
{% if pastResources|length > 0 %} {% if pastCharges|length > 0 %}
<div class="item-bloc"> <div class="item-bloc">
{{ m.table_elements(pastResources, 'resource') }} {{ m.table_elements(pastCharges, 'charge') }}
</div> </div>
{% else %} {% else %}
<div class="item-bloc"> <div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past resources registered'|trans }}</span> <span class="chill-no-data-statement">{{ 'No past charges registered'|trans }}</span>
<div class="item-bloc"> </div>
{% endif %} {% endif %}
</div>
<h3 class="family-title">{{ 'Past charges'|trans }}</h3>
{% if pastCharges|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(pastCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No past charges registered'|trans }}</span>
</div>
{% endif %}
{% endif %} {% endif %}
{% if futureCharges|length > 0 or futureResources|length > 0 %} {% if futureCharges|length > 0 or futureResources|length > 0 %}
<h2 class="subtitle">{{ 'Future budget'|trans }}</h2> <h2 class="subtitle">{{ 'Future budget'|trans }}</h2>
<div class="flex-table">
<h3 class="family-title">{{ 'Future resources'|trans }}</h3>
<h3 class="family-title">{{ 'Future resources'|trans }}</h3> {% if futureResources|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(futureResources, 'resource') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future resources registered'|trans }}</span>
</div>
{% endif %}
</div>
<div class="flex-table">
<h3 class="family-title">{{ 'Future charges'|trans }}</h3>
{% if futureResources|length > 0 %} {% if futureCharges|length > 0 %}
<div class="item-bloc"> <div class="item-bloc">
{{ m.table_elements(futureResources, 'resource') }} {{ m.table_elements(futureCharges, 'charge') }}
</div> </div>
{% else %} {% else %}
<div class="item-bloc"> <div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future resources registered'|trans }}</span> <span class="chill-no-data-statement">{{ 'No future charges registered'|trans }}</span>
</div> </div>
{% endif %} {% endif %}
</div>
<h3 class="family-title">{{ 'Future charges'|trans }}</h3>
{% if futureCharges|length > 0 %}
<div class="item-bloc">
{{ m.table_elements(futureCharges, 'charge') }}
</div>
{% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No future charges registered'|trans }}</span>
</div>
{% endif %}
{% endif %} {% endif %}
{% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %} {% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %}