mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
FIX [budget][templates] reimplement display of all calculator results
This commit is contained in:
parent
197d69ef4a
commit
edd66f6a6c
@ -1,11 +1,12 @@
|
|||||||
{% macro table_elements(elements, family) %}
|
{% macro table_elements(elements, type) %}
|
||||||
|
|
||||||
<table class="table table-bordered border-dark budget-table">
|
<table class="table table-bordered border-dark budget-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="{{ family }} el-type">{{ 'Budget element type'|trans }}</th>
|
<th class="{{ type }} el-type">{{ 'Budget element type'|trans }}</th>
|
||||||
<th class="{{ family }}">{{ 'Amount'|trans }}</th>
|
<th class="{{ type }}">{{ 'Amount'|trans }}</th>
|
||||||
<th class="{{ family }}">{{ 'Validity period'|trans }}</th>
|
<th class="{{ type }}">{{ 'Validity period'|trans }}</th>
|
||||||
<th class="{{ family }}"> </th>
|
<th class="{{ type }}"> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -38,17 +39,17 @@
|
|||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
{% if is_granted('CHILL_BUDGET_ELEMENT_SEE', f) %}
|
{% if is_granted('CHILL_BUDGET_ELEMENT_SEE', f) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_budget_' ~ family ~ '_view', { 'id': f.id } ) }}" class="btn btn-sm btn-show"></a>
|
<a href="{{ path('chill_budget_' ~ type ~ '_view', { 'id': f.id } ) }}" class="btn btn-sm btn-show"></a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', f) %}
|
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', f) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_budget_' ~ family ~'_edit', { 'id': f.id } ) }}" class="btn btn-sm btn-edit"></a>
|
<a href="{{ path('chill_budget_' ~ type ~'_edit', { 'id': f.id } ) }}" class="btn btn-sm btn-edit"></a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_BUDGET_ELEMENT_DELETE', f) %}
|
{% if is_granted('CHILL_BUDGET_ELEMENT_DELETE', f) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_budget_' ~ family ~ '_delete', { 'id': f.id } ) }}" class="btn btn-sm btn-delete"></a>
|
<a href="{{ path('chill_budget_' ~ type ~ '_delete', { 'id': f.id } ) }}" class="btn btn-sm btn-delete"></a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
@ -69,7 +70,7 @@
|
|||||||
</table>
|
</table>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro table_results(actualCharges, actualResources) %}
|
{% macro table_results(actualCharges, actualResources, results) %}
|
||||||
|
|
||||||
{% set totalCharges = 0 %}
|
{% set totalCharges = 0 %}
|
||||||
{% for c in actualCharges %}
|
{% for c in actualCharges %}
|
||||||
@ -97,6 +98,20 @@
|
|||||||
{{ result|format_currency('EUR') }}
|
{{ result|format_currency('EUR') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% for result in results %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ result.label }}</td>
|
||||||
|
<td>
|
||||||
|
{% if result.type == 'currency' %}
|
||||||
|
{{ result.result|format_currency('EUR') }}
|
||||||
|
{% elseif result.type == 'percentage' %}
|
||||||
|
{{ result.result|round(2, 'ceil') ~ '%' }}
|
||||||
|
{% else %}
|
||||||
|
{{ result.result|round(2, 'common') }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
<h3 class="subtitle">{{ 'Budget calculator'|trans }}</h3>
|
<h3 class="subtitle">{{ 'Budget calculator'|trans }}</h3>
|
||||||
{{ table_results(charges, resources) }}
|
{{ table_results(charges, resources, results) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %}
|
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user