From 274c6115ccb7452962747f77c4911ce259782fa5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 25 Feb 2022 17:01:24 +0100 Subject: [PATCH] index templates fixed for display of past and future budgets --- .../Resources/views/Household/index.html.twig | 166 +++++++++--------- .../Resources/views/Person/index.html.twig | 96 +++++----- 2 files changed, 136 insertions(+), 126 deletions(-) diff --git a/src/Bundle/ChillBudgetBundle/Resources/views/Household/index.html.twig b/src/Bundle/ChillBudgetBundle/Resources/views/Household/index.html.twig index 6fe00a70f..1b9c91596 100644 --- a/src/Bundle/ChillBudgetBundle/Resources/views/Household/index.html.twig +++ b/src/Bundle/ChillBudgetBundle/Resources/views/Household/index.html.twig @@ -214,16 +214,92 @@ {% endif %} - {% if household.getCurrentMembers|length > 0 %} - -

{{ 'Budget household members'|trans }}

+ {# {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %} + + {% endif %} #} - {% for hm in household.getCurrentMembers %} +{% endif %} + +{% if pastCharges|length > 0 or pastResources|length > 0 %} +

{{ 'Past budget'|trans }}

+ +
+

{{ 'Past resources'|trans }}

+ + {% if pastResources|length > 0 %} +
+ {{ m.table_elements(pastResources, 'resource') }} +
+ {% else %} +
+ {{ 'No past resources registered'|trans }} +
+ {% endif %} +
+ +
+

{{ 'Past charges'|trans }}

+ + {% if pastCharges|length > 0 %} +
+ {{ m.table_elements(pastCharges, 'charge') }} +
+ {% else %} +
+ {{ 'No past charges registered'|trans }} +
+ {% endif %} +
+{% endif %} + +{% if futureCharges|length > 0 or futureResources|length > 0 %} +

{{ 'Future budget'|trans }}

+ +
+

{{ 'Future resources'|trans }}

+ + {% if futureResources|length > 0 %} +
+ {{ m.table_elements(futureResources, 'resource') }} +
+ {% else %} +
+ {{ 'No future resources registered'|trans }} +
+ {% endif %} +
+
+

{{ 'Future charges'|trans }}

+ + {% if futureCharges|length > 0 %} +
+ {{ m.table_elements(futureCharges, 'charge') }} +
+ {% else %} +
+ {{ 'No future charges registered'|trans }} +
+ {% endif %} +
+{% endif %} + +{% if household.getCurrentMembers|length > 0 %} + +

{{ 'Budget household members'|trans }}

+ + {% for hm in household.getCurrentMembers %}
{% set member = hm.person %} @@ -278,77 +354,7 @@
- {% endfor %} - - {% endif %} - - {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %} - - {% endif %} - -{% endif %} - -{% if pastCharges|length > 0 or pastResources|length > 0 %} -

{{ 'Past budget'|trans }}

- -

{{ 'Past resources'|trans }}

- - {% if pastResources|length > 0 %} -
- {{ m.table_elements(pastResources, 'resource') }} -
- {% else %} -
- {{ 'No past resources registered'|trans }} -
- {% endif %} - -

{{ 'Past charges'|trans }}

- - {% if pastCharges|length > 0 %} -
- {{ m.table_elements(pastCharges, 'charge') }} -
- {% else %} -
- {{ 'No past charges registered'|trans }} -
- {% endif %} -{% endif %} - -{% if futureCharges|length > 0 or futureResources|length > 0 %} -

{{ 'Future budget'|trans }}

- -

{{ 'Future resources'|trans }}

- - {% if futureResources|length > 0 %} -
- {{ m.table_elements(futureResources, 'resource') }} -
- {% else %} -
- {{ 'No future resources registered'|trans }} -
- {% endif %} - -

{{ 'Future charges'|trans }}

- - {% if futureCharges|length > 0 %} -
- {{ m.table_elements(futureCharges, 'charge') }} -
- {% else %} -
- {{ 'No future charges registered'|trans }} -
- {% endif %} + {% endfor %} {% endif %} {% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %} diff --git a/src/Bundle/ChillBudgetBundle/Resources/views/Person/index.html.twig b/src/Bundle/ChillBudgetBundle/Resources/views/Person/index.html.twig index 377f4383d..621aa9f83 100644 --- a/src/Bundle/ChillBudgetBundle/Resources/views/Person/index.html.twig +++ b/src/Bundle/ChillBudgetBundle/Resources/views/Person/index.html.twig @@ -214,7 +214,7 @@ {% endif %}
- {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %} + {# {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %} - {% endif %} + {% endif %} #} {% endif %} {% if pastCharges|length > 0 or pastResources|length > 0 %}

{{ 'Past budget'|trans }}

+
+

{{ 'Past resources'|trans }}

-

{{ 'Past resources'|trans }}

+ {% if pastResources|length > 0 %} +
+ {{ m.table_elements(pastResources, 'resource') }} +
+ {% else %} +
+ {{ 'No past resources registered'|trans }} +
+ {% endif %} +
+
+

{{ 'Past charges'|trans }}

- {% if pastResources|length > 0 %} -
- {{ m.table_elements(pastResources, 'resource') }} -
- {% else %} -
- {{ 'No past resources registered'|trans }} -
- {% endif %} - -

{{ 'Past charges'|trans }}

- - {% if pastCharges|length > 0 %} -
- {{ m.table_elements(pastCharges, 'charge') }} -
- {% else %} -
- {{ 'No past charges registered'|trans }} -
- {% endif %} + {% if pastCharges|length > 0 %} +
+ {{ m.table_elements(pastCharges, 'charge') }} +
+ {% else %} +
+ {{ 'No past charges registered'|trans }} +
+ {% endif %} +
{% endif %} {% if futureCharges|length > 0 or futureResources|length > 0 %}

{{ 'Future budget'|trans }}

+
+

{{ 'Future resources'|trans }}

-

{{ 'Future resources'|trans }}

+ {% if futureResources|length > 0 %} +
+ {{ m.table_elements(futureResources, 'resource') }} +
+ {% else %} +
+ {{ 'No future resources registered'|trans }} +
+ {% endif %} +
+
+

{{ 'Future charges'|trans }}

- {% if futureResources|length > 0 %} -
- {{ m.table_elements(futureResources, 'resource') }} -
- {% else %} -
- {{ 'No future resources registered'|trans }} -
- {% endif %} - -

{{ 'Future charges'|trans }}

- - {% if futureCharges|length > 0 %} -
- {{ m.table_elements(futureCharges, 'charge') }} -
- {% else %} -
- {{ 'No future charges registered'|trans }} -
- {% endif %} + {% if futureCharges|length > 0 %} +
+ {{ m.table_elements(futureCharges, 'charge') }} +
+ {% else %} +
+ {{ 'No future charges registered'|trans }} +
+ {% endif %} +
{% endif %} {% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %}