mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
97 lines
3.3 KiB
Twig
97 lines
3.3 KiB
Twig
{% macro table_elements(elements, family) %}
|
|
<table class="table table-bordered border-dark budget-table">
|
|
<thead>
|
|
<tr>
|
|
<th class="{{ family }} el-type">{{ 'Budget element type'|trans }}</th>
|
|
<th class="{{ family }}">{{ 'Amount'|trans }}</th>
|
|
<th class="{{ family }}">{{ 'Validity period'|trans }}</th>
|
|
<th class="{{ family }}"> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% set total = 0 %}
|
|
{% for f in elements %}
|
|
{% set total = total + f.amount %}
|
|
<tr>
|
|
<td class="el-type">
|
|
{% if f.isResource %}
|
|
{{ f.resource.name|localize_translatable_string }}
|
|
{% else %}
|
|
{{ f.charge.name|localize_translatable_string }}
|
|
{% endif %}
|
|
</td>
|
|
<td>{{ f.amount|format_currency('EUR') }}</td>
|
|
<td>
|
|
{% if f.endDate is not null %}
|
|
{{ f.startDate|format_date('short') ~ ' - ' ~ f.endDate|format_date('short') }}
|
|
{% else %}
|
|
{{ 'depuis le ' ~ f.startDate|format_date('short') }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="column-fixed">
|
|
<ul class="record_actions">
|
|
{% if is_granted('CHILL_BUDGET_ELEMENT_SEE', f) %}
|
|
<li>
|
|
<a href="{{ path('chill_budget_' ~ family ~ '_view', { 'id': f.id } ) }}" class="btn btn-sm btn-show"></a>
|
|
</li>
|
|
{% endif %}
|
|
{% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', f) %}
|
|
<li>
|
|
<a href="{{ path('chill_budget_' ~ family ~'_edit', { 'id': f.id } ) }}" class="btn btn-sm btn-edit"></a>
|
|
</li>
|
|
{% endif %}
|
|
{% if is_granted('CHILL_BUDGET_ELEMENT_DELETE', f) %}
|
|
<li>
|
|
<a href="{{ path('chill_budget_' ~ family ~ '_delete', { 'id': f.id } ) }}" class="btn btn-sm btn-delete"></a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
<tr class="total">
|
|
<td class="el-type">
|
|
{{ 'Total'|trans }}
|
|
</td>
|
|
<td>
|
|
{{ total|format_currency('EUR') }}
|
|
</td>
|
|
<td> </td>
|
|
<td> </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
{% endmacro %}
|
|
|
|
{% macro table_results(actualCharges, actualResources) %}
|
|
|
|
{% set totalCharges = 0 %}
|
|
{% for c in actualCharges %}
|
|
{% set totalCharges = totalCharges + c.amount %}
|
|
{% endfor %}
|
|
|
|
{% set totalResources = 0 %}
|
|
{% for r in actualResources %}
|
|
{% set totalResources = totalResources + r.amount %}
|
|
{% endfor %}
|
|
|
|
{% set result = (totalResources - totalCharges) %}
|
|
|
|
<table class="table table-bordered border-dark">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th>{{ 'Budget calculator result'|trans }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>{{ 'The balance'|trans }}</td>
|
|
<td>
|
|
{{ result|format_currency('EUR') }}
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
{% endmacro %}
|