new user-year reporting and data-type chooser (#3155)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% block box_before %}
|
||||
{{ form_start(form, {'attr': {'class': 'form-inline'}}) }}
|
||||
{{ form_start(form, {'attr': {'class': 'form-inline', 'id': 'user-filter-form'}}) }}
|
||||
{% endblock %}
|
||||
{% block box_after %}
|
||||
{{ form_end(form) }}
|
||||
@@ -19,78 +19,35 @@
|
||||
{{ widgets.username(user) }}
|
||||
{% endif %}
|
||||
{{ form_widget(form.date) }}
|
||||
<div class="btn-group"{% if form.sumType.vars.choices|length <= 1 %} style="display: none"{% endif %}>
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="{{ 'display'|icon }}"></i> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu checkbox-menu">
|
||||
<li>
|
||||
{{ form_widget(form.sumType) }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% 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|date_weekday }}
|
||||
</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>
|
||||
{% embed 'reporting/report_by_user_data.html.twig' %}
|
||||
{% block period_name %}
|
||||
<th class="text-center text-nowrap{% if column is weekend %} weekend{% endif %}{% if column is today %} today{% endif %}">
|
||||
{{ column|date_weekday }}
|
||||
</th>
|
||||
{% endblock %}
|
||||
{% block column_classes_project -%}
|
||||
{% if column.date is weekend %} weekend{% endif %}{% if column.date is today %} today{% endif %}
|
||||
{%- endblock %}
|
||||
{% block column_classes_activity -%}
|
||||
{% if column.date is weekend %} weekend{% endif %}{% if column.date is today %} today{% endif %}
|
||||
{%- endblock %}
|
||||
{% block column_classes_total -%}
|
||||
{% if column is weekend %} weekend{% endif %}
|
||||
{%- endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
@@ -100,13 +57,8 @@
|
||||
{{ 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();
|
||||
jQuery('#user-filter-form').on('change', function(ev) {
|
||||
jQuery(this).submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user