115 lines
5.5 KiB
Twig
115 lines
5.5 KiB
Twig
{% extends 'reporting/layout.html.twig' %}
|
|
|
|
{% block report_title %}{{ report_title|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, {'attr': {'class': 'form-inline'}}) }}
|
|
{% endblock %}
|
|
{% block box_after %}
|
|
{{ form_end(form) }}
|
|
{% endblock %}
|
|
{% block box_title %}
|
|
{% if form.user is defined %}
|
|
{{ form_row(form.user, {'label': false}) }}
|
|
{% else %}
|
|
{{ widgets.username(user) }}
|
|
{% endif %}
|
|
{{ form_widget(form.date) }}
|
|
{% endblock %}
|
|
{% block box_body_class %}{{ box_id }} table-responsive no-padding{% endblock %}
|
|
{% block box_body %}
|
|
{% set totals = {'totals': 0} %}
|
|
{% set columns = 2 %}
|
|
<table class="table table-bordered table-hover dataTable">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th> </th>
|
|
{% for day in days.dateTimes %}
|
|
<th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}{% if day is today %} today{% endif %}">
|
|
{{ day|day_name(true) }}<br>
|
|
{{ day|format_date('short') }}
|
|
</th>
|
|
{% set columns = columns + 1 %}
|
|
{% set totals = totals|merge({(day|report_date): 0}) %}
|
|
{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% set oldCustomer = null %}
|
|
{% 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 %}
|
|
{% set oldCustomer = project.project.customer.id %}
|
|
<tr class="summary">
|
|
<td colspan="{{ columns }}">{{ widgets.label_customer(project.project.customer) }}</td>
|
|
</tr>
|
|
{% endif %}
|
|
{% set totals = totals|merge({'totals': (totals['totals'] + project.duration)}) %}
|
|
<tr class="project">
|
|
<td class="text-nowrap">
|
|
<strong>{{ widgets.label_project(project.project) }}</strong>
|
|
</td>
|
|
<th class="text-nowrap text-center total">{{ project.duration|duration }}</th>
|
|
{% for day in project.days.days %}
|
|
<td class="text-nowrap text-center day-total{% if day.date is weekend %} weekend{% endif %}{% if day.date is today %} today{% endif %}">
|
|
{% if day.duration > 0 %}
|
|
{% set totals = totals|merge({(day.date|report_date): (totals[day.date|report_date] + day.duration)}) %}
|
|
<strong>{{ day.duration|duration }}</strong>
|
|
{% endif %}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% for activity in project.activities %}
|
|
<tr class="activity">
|
|
<td class="text-nowrap">
|
|
{{ widgets.label_activity(activity.activity) }}
|
|
</td>
|
|
<th class="text-nowrap text-center total">{{ activity.duration|duration }}</th>
|
|
{% for day in activity.days.days %}
|
|
<td class="text-nowrap text-center day-total{% if day.date is weekend %} weekend{% endif %}{% if day.date is today %} today{% endif %}">
|
|
{% if day.duration > 0 %}
|
|
{{ day.duration|duration }}
|
|
{% endif %}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</tbody>
|
|
<tfoot>
|
|
<tr class="summary">
|
|
<td>{{ 'stats.durationTotal'|trans }}</td>
|
|
<td class="text-nowrap text-center total">{{ totals['totals']|duration }}</td>
|
|
{% for day in days.dateTimes %}
|
|
<td class="text-nowrap text-center day-total{% if day is weekend %} weekend{% endif %}">
|
|
{{ totals[day|report_date]|duration }}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
{% endblock %}
|
|
{% endembed %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block javascripts %}
|
|
{{ parent() }}
|
|
<script type="text/javascript">
|
|
document.addEventListener('kimai.initialized', function() {
|
|
{% if form.user is defined %}
|
|
jQuery('#{{ form.user.vars.id }}').on('change', function(ev) {
|
|
jQuery(this).closest('form').submit();
|
|
});
|
|
{% endif %}
|
|
jQuery('#{{ form.date.vars.id }}').on('change', function(ev) {
|
|
jQuery(this).closest('form').submit();
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|