improve summary rows in reports (#2861)

This commit is contained in:
Kevin Papst
2021-10-16 13:38:08 +02:00
committed by GitHub
parent 8539938b8a
commit e2be5b401c
8 changed files with 95 additions and 69 deletions

View File

@@ -89,6 +89,15 @@ table.dataTable {
opacity: 0.8; opacity: 0.8;
} }
} }
tfoot {
tr {
/* overwritten if used in tfoot, to switch the border from below to top */
&.summary td {
border-top: 1px solid #ccc;
border-bottom: 0;
}
}
}
} }
table.table-hover { table.table-hover {

View File

@@ -1,7 +1,6 @@
.dataTable { .dataTable {
.weekend { .weekend {
background-color: #f9f9f9; background-color: #f9f9f9;
opacity: 0.6;
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
"build/app.e22732af.js" "build/app.e22732af.js"
], ],
"css": [ "css": [
"build/app.fdf3c5fb.css" "build/app.c57cdec8.css"
] ]
}, },
"invoice": { "invoice": {

View File

@@ -1,5 +1,5 @@
{ {
"build/app.css": "build/app.fdf3c5fb.css", "build/app.css": "build/app.c57cdec8.css",
"build/app.js": "build/app.e22732af.js", "build/app.js": "build/app.e22732af.js",
"build/invoice.css": "build/invoice.ff32661a.css", "build/invoice.css": "build/invoice.ff32661a.css",
"build/invoice.js": "build/invoice.19f36eca.js", "build/invoice.js": "build/invoice.19f36eca.js",

View File

@@ -25,18 +25,21 @@
{% set totals = {'totals': 0} %} {% set totals = {'totals': 0} %}
{% set columns = 2 %} {% set columns = 2 %}
<table class="table table-bordered table-hover dataTable"> <table class="table table-bordered table-hover dataTable">
<tr> <thead>
<th>&nbsp;</th> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
{% for day in days.dateTimes %} <th>&nbsp;</th>
<th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}"> {% for day in days.dateTimes %}
{{ day|day_name(true) }}<br> <th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}">
{{ day|format_date('short') }} {{ day|day_name(true) }}<br>
</th> {{ day|format_date('short') }}
{% set columns = columns + 1 %} </th>
{% set totals = totals|merge({(day|report_date): 0}) %} {% set columns = columns + 1 %}
{% endfor %} {% set totals = totals|merge({(day|report_date): 0}) %}
</tr> {% endfor %}
</tr>
</thead>
<tbody>
{% set oldCustomer = null %} {% set oldCustomer = null %}
{% for pid, project in rows|sort((a,b) => a.project.customer.id <=> b.project.customer.id) %} {% for pid, project in rows|sort((a,b) => a.project.customer.id <=> b.project.customer.id) %}
{% if oldCustomer is null or oldCustomer != project.project.customer.id %} {% if oldCustomer is null or oldCustomer != project.project.customer.id %}
@@ -76,15 +79,18 @@
</tr> </tr>
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
<tr class="summary"> </tbody>
<th></th> <tfoot>
<th class="text-nowrap text-center total">{{ totals['totals']|duration }}</th> <tr class="summary">
{% for day in days.dateTimes %} <td>{{ 'stats.durationTotal'|trans }}</td>
<th class="text-nowrap text-center day-total{% if day is weekend %} weekend{% endif %}"> <td class="text-nowrap text-center total">{{ totals['totals']|duration }}</td>
{{ totals[day|report_date]|duration }} {% for day in days.dateTimes %}
</th> <td class="text-nowrap text-center day-total{% if day is weekend %} weekend{% endif %}">
{% endfor %} {{ totals[day|report_date]|duration }}
</tr> </td>
{% endfor %}
</tr>
</tfoot>
</table> </table>
{% endblock %} {% endblock %}
{% endembed %} {% endembed %}

View File

@@ -23,17 +23,20 @@
{% set absoluteTotals = 0 %} {% set absoluteTotals = 0 %}
{% set totals = {} %} {% set totals = {} %}
<table class="table table-bordered table-hover dataTable"> <table class="table table-bordered table-hover dataTable">
<tr> <thead>
<th>&nbsp;</th> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
{% for day in stats.0.getDateTimes() %} <th>&nbsp;</th>
<th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}"> {% for day in stats.0.getDateTimes() %}
{{ day|day_name(true) }}<br> <th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}">
{{ day|format_date('short') }} {{ day|day_name(true) }}<br>
</th> {{ day|format_date('short') }}
{% set totals = totals|merge({(day|report_date): 0}) %} </th>
{% endfor %} {% set totals = totals|merge({(day|report_date): 0}) %}
</tr> {% endfor %}
</tr>
</thead>
<tbody>
{% for userDay in stats %} {% for userDay in stats %}
{% set usersTotalDuration = 0 %} {% set usersTotalDuration = 0 %}
<tr class="user"> <tr class="user">
@@ -59,17 +62,20 @@
{% endfor %} {% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
<tr> </tbody>
<th>&nbsp;</th> <tfoot>
<th class="text-center text-nowrap"> <tr class="summary">
{{ absoluteTotals|duration }} <td>{{ 'stats.durationTotal'|trans }}</td>
</th> <td class="text-center text-nowrap">
{% for id, duration in totals %} {{ absoluteTotals|duration }}
<th class="text-center text-nowrap"> </td>
{{ duration|duration }} {% for id, duration in totals %}
</th> <td class="text-center text-nowrap">
{% endfor %} {{ duration|duration }}
</tr> </td>
{% endfor %}
</tr>
</tfoot>
</table> </table>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@@ -22,19 +22,22 @@
{% else %} {% else %}
{% set totals = {} %} {% set totals = {} %}
<table class="table table-bordered table-hover dataTable"> <table class="table table-bordered table-hover dataTable">
<tr> <thead>
<th>&nbsp;</th> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
{% for month in stats.0.getDateTimes() %} <th>&nbsp;</th>
<th class="text-center text-nowrap"> {% for month in stats.0.getDateTimes() %}
<a href="{{ path('report_monthly_users', {'date': month|report_date}) }}"> <th class="text-center text-nowrap">
{{ month|month_name }}<br> <a href="{{ path('report_monthly_users', {'date': month|report_date}) }}">
{{ month|date_format('Y') }} {{ month|month_name }}<br>
</a> {{ month|date_format('Y') }}
</th> </a>
{% set totals = totals|merge({(month|report_date): 0}) %} </th>
{% endfor %} {% set totals = totals|merge({(month|report_date): 0}) %}
</tr> {% endfor %}
</tr>
</thead>
<tbody>
{% for userYear in stats|filter(row => row.user is not null) %} {% for userYear in stats|filter(row => row.user is not null) %}
{% set usersTotalDuration = 0 %} {% set usersTotalDuration = 0 %}
<tr class="user"> <tr class="user">
@@ -61,15 +64,18 @@
{% endfor %} {% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
<tr> </tbody>
<th>&nbsp;</th> <tfoot>
<th>&nbsp;</th> <tr class="summary">
{% for id, total in totals %} <td>{{ 'stats.durationTotal'|trans }}</td>
<th class="text-center text-nowrap"> <td>&nbsp;</td>
{{ total|duration }} {% for id, total in totals %}
</th> <td class="text-center text-nowrap">
{% endfor %} {{ total|duration }}
</tr> </td>
{% endfor %}
</tr>
</tfoot>
</table> </table>
{% endif %} {% endif %}
{% endblock %} {% endblock %}