restyling layout of table

This commit is contained in:
2022-03-02 11:42:54 +01:00
parent cefa304fb5
commit 86de8137e4
3 changed files with 43 additions and 27 deletions

View File

@@ -18,24 +18,32 @@
}
.budget-table {
th.resource {
background-color: #9bcebd;
background-color: #6d9e63;
}
}
.budget-table {
th, td {
padding: 10px;
text-align: left;
text-align: right;
}
td.column-wide {
width: 25%;
width: 20%;
}
td.column-small {
width: 15%;
&.right {
align-items: right;
}
}
}
.bold {
.btn-budget {
margin-right: 1rem !important;
}
.el-type {
font-weight: 600;
text-align: left !important;
}
.total {

View File

@@ -2,7 +2,7 @@
<table class="budget-table">
<thead>
<tr>
<th class="{{ family }}">{{ 'Budget element type'|trans }}</th>
<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 }}">&nbsp;</th>
@@ -13,11 +13,11 @@
{% for f in elements %}
{% set total = total + f.amount %}
<tr>
<td class="column-wide bold">
<td class="column-wide el-type">
{{ f.type|budget_element_type_display(family) }}
</td>
<td class="column-small">{{ f.amount|format_currency('EUR') }}</td>
<td class="column-small">
<td class="column-wide">
{% if f.endDate is not null %}
{{ 'Valid since %startDate% until %endDate%'|trans( { '%startDate%': f.startDate|format_date('short'), '%endDate%': f.endDate|format_date('short') } ) }}
{% else %}
@@ -46,7 +46,7 @@
</tr>
{% endfor %}
<tr class="total">
<td>
<td class="el-type">
{{ 'Total'|trans }}
</td>
<td>
@@ -59,29 +59,36 @@
</table>
{% endmacro %}
{% macro table_results(results) %}
{% 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>
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>{{ 'Budget calculator result'|trans }}</th>
</tr>
</thead>
<tbody>
{% for result in results %}
<tr>
<td>{{ result.label }}</td>
<td>Result</td>
<td>&nbsp;</td>
<td>
{% if result.type == constant('CHILL\\BudgetBundle\\Calculator\\CalculatorResult::TYPE_CURRENCY') %}
{{ result.result|format_currency('EUR') }}
{% elseif result.type == constant('CHILL\\BudgetBundle\\Calculator\\CalculatorResult::TYPE_PERCENTAGE') %}
{{ result.result|round(2, 'ceil') ~ '%' }}
{% else %}
{{ result.result|round(2, 'common') }}
{% endif %}
{{ result|format_currency('EUR') }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro %}