Files
kimai2/templates/reporting/monthly_user_list.html.twig
2020-07-12 14:05:14 +02:00

64 lines
2.5 KiB
Twig

{% extends 'reporting/layout.html.twig' %}
{% block report_title %}{{ 'report_monthly_users'|trans({}, 'reporting') }}{% endblock %}
{% block report %}
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% block box_before %}
{{ form_start(form, {'action': path('report_monthly_users'), 'attr': {'class': 'form-inline'}}) }}
{% endblock %}
{% block box_after %}
{{ form_end(form) }}
{% endblock %}
{% block box_title %}
{{ form_widget(form.date) }}
{% endblock %}
{% block box_body_class %}monthly-user-list-reporting-box no-padding table-responsive{% endblock %}
{% block box_body %}
<table class="table table-bordered table-hover dataTable">
<tr>
<th></th>
{% for day in days %}
<th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}">
{{ day|day_name(true) }}<br>
{{ day|date_format('d.m') }}
</th>
{% endfor %}
<th></th>
</tr>
{% for userDay in rows %}
{% set usersMonthDuration = 0 %}
<tr>
<td class="text-nowrap">
<strong>{{ widgets.username(userDay.user) }}</strong>
</td>
{% for day in userDay.days %}
<td class="text-nowrap{% if day.day is weekend %} weekend{% endif %}">
{% if day.totalDuration > 0 %}
{{ day.totalDuration|duration }}
{% set usersMonthDuration = usersMonthDuration + day.totalDuration %}
{% endif %}
</td>
{% endfor %}
<th class="text-nowrap">{{ usersMonthDuration|duration }}</th>
</tr>
{% endfor %}
</table>
{% endblock %}
{% endembed %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="text/javascript">
document.addEventListener('kimai.initialized', function() {
$('#{{ form.date.vars.id }}').on('change', function(ev) {
$(this).closest('form').submit();
});
});
</script>
{% endblock %}