UX: Better use of flex-table and tables in budget twig templates

This commit is contained in:
Mathieu Jaumotte 2023-03-30 00:07:38 +02:00
parent 96ddc73e45
commit 087ada2250
4 changed files with 16 additions and 37 deletions

View File

@ -32,28 +32,21 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<h3 class="subtitle">{{ 'Actual budget'|trans }}</h3> <h3 class="subtitle">{{ 'Actual budget'|trans }}</h3>
{% if actualCharges|length > 0 or actualResources|length > 0 %} {% if actualCharges|length > 0 or actualResources|length > 0 %}
{% include 'ChillBudgetBundle:Budget:_current_budget.html.twig' with { {% include '@ChillBudget/Budget/_current_budget.html.twig' with {
'actualResources': actualResources, 'actualResources': actualResources,
'actualCharges': actualCharges, 'actualCharges': actualCharges,
'results': results, 'results': results,
'entity': entity 'entity': entity
} %} } %}
{% else %} {% else %}
<div class="flex-table"> <p><span class="chill-no-data-statement">{{ "There isn't any element recorded"|trans }}</span></p>
<div class="item-bloc">
<p><span class="chill-no-data-statement">{{ "There isn't any element recorded"|trans }}</span></p>
</div>
</div>
{% 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> <h3 class="subtitle">{{ 'Past budget'|trans }}</h3>a
{% include '@ChillBudget/Budget/_past_budget.html.twig' with {
{% include 'ChillBudgetBundle:Budget:_past_budget.html.twig' with {
'pastCharges': pastCharges, 'pastCharges': pastCharges,
'pastResources': pastResources, 'pastResources': pastResources,
'entity': entity 'entity': entity
@ -61,9 +54,8 @@
{% 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> <h3 class="subtitle">{{ 'Future budget'|trans }}</h3>
{% include '@ChillBudget/Budget/_future_budget.html.twig' with {
{% include 'ChillBudgetBundle:Budget:_future_budget.html.twig' with {
'futureResources': futureResources, 'futureResources': futureResources,
'futureCharges': futureCharges, 'futureCharges': futureCharges,
'entity': entity 'entity': entity

View File

@ -1,30 +1,21 @@
{% from 'ChillBudgetBundle:Budget:_macros.html.twig' import table_elements, table_results %} {% from '@ChillBudget/Budget/_macros.html.twig' import table_elements, table_results %}
{# <h2 class="subtitle">{{ 'Actual budget'|trans }}</h2> #} {# <h2 class="subtitle">{{ 'Actual budget'|trans }}</h2> #}
<div class="flex-table"> <div class="mb-2">
<h4 class="family-title">{{ 'Actual resources'|trans }}</h4> <h4 class="family-title">{{ 'Actual resources'|trans }}</h4>
{% if actualResources|length > 0 %} {% if actualResources|length > 0 %}
<div class="item-bloc">
{{ table_elements(actualResources, 'resource') }} {{ table_elements(actualResources, 'resource') }}
</div>
{% else %} {% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No resources registered'|trans }}</span> <span class="chill-no-data-statement">{{ 'No resources registered'|trans }}</span>
</div>
{% endif %} {% endif %}
</div> </div>
<div class="flex-table"> <div class="mb-2">
<h4 class="family-title">{{ 'Actual charges'|trans }}</h4> <h4 class="family-title">{{ 'Actual charges'|trans }}</h4>
{% if actualCharges|length > 0 %} {% if actualCharges|length > 0 %}
<div class="item-bloc">
{{ table_elements(actualCharges, 'charge') }} {{ table_elements(actualCharges, 'charge') }}
</div>
{% else %} {% else %}
<div class="item-bloc">
<span class="chill-no-data-statement">{{ 'No charges registered'|trans }}</span> <span class="chill-no-data-statement">{{ 'No charges registered'|trans }}</span>
</div>
{% endif %} {% endif %}
</div> </div>

View File

@ -1,5 +1,5 @@
{% macro table_elements(elements, family) %} {% macro table_elements(elements, family) %}
<table class="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="{{ family }} el-type">{{ 'Budget element type'|trans }}</th>
@ -28,7 +28,7 @@
{% if f.endDate is not null %} {% if f.endDate is not null %}
{{ f.startDate|format_date('short') ~ ' - ' ~ f.endDate|format_date('short') }} {{ f.startDate|format_date('short') ~ ' - ' ~ f.endDate|format_date('short') }}
{% else %} {% else %}
{{ f.startDate|format_date('short') ~ ' - ...' }} {{ 'depuis le ' ~ f.startDate|format_date('short') }}
{% endif %} {% endif %}
</td> </td>
<td class="column-small"> <td class="column-small">
@ -80,10 +80,9 @@
{% set result = (totalResources - totalCharges) %} {% set result = (totalResources - totalCharges) %}
<table> <table class="table table-bordered border-dark">
<thead> <thead>
<tr> <tr>
<th>&nbsp;</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>{{ 'Budget calculator result'|trans }}</th> <th>{{ 'Budget calculator result'|trans }}</th>
</tr> </tr>
@ -91,7 +90,6 @@
<tbody> <tbody>
<tr> <tr>
<td>{{ 'The balance'|trans }}</td> <td>{{ 'The balance'|trans }}</td>
<td>&nbsp;</td>
<td> <td>
{{ result|format_currency('EUR') }} {{ result|format_currency('EUR') }}
</td> </td>

View File

@ -17,17 +17,15 @@
{% block content %} {% block content %}
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
{% include 'ChillBudgetBundle:Budget:_budget.html.twig' with { {% include '@ChillBudget/Budget/_budget.html.twig' with {
'resources': resources, 'resources': resources,
'charges': charges, 'charges': charges,
'person': person 'person': person
} %} } %}
<div class="flex-table"> <div class="mt-5">
<h3 class="family-title">{{ 'Budget calculator'|trans }}</h2> <h3 class="subtitle">{{ 'Budget calculator'|trans }}</h3>
<div class="item-bloc"> {{ table_results(charges, resources) }}
{{ table_results(charges, resources) }}
</div>
</div> </div>
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %} {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %}