added reporting screen (#1805)

This commit is contained in:
Kevin Papst
2020-07-12 14:05:14 +02:00
committed by GitHub
parent b97d9f692d
commit 164af7ae02
44 changed files with 1294 additions and 79 deletions

View File

@@ -0,0 +1,11 @@
{% macro reporting() %}
{% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %}
{% set children = {} %}
{% for id, report in available_reports(app.user) %}
{% set children = children|merge({(report.id): {'title': report.label|trans({}, 'reporting'), 'url': path(report.route), 'class': 'toolbar-action report-' ~ report.id}}) %}
{% endfor %}
{% set actions = actions|merge({'reporting': {'children': children}}) %}
{% set event = trigger('actions.reporting', {'actions': actions}) %}
{{ widgets.page_actions(event.payload.actions) }}
{% endmacro %}

View File

@@ -0,0 +1,14 @@
{% extends 'base.html.twig' %}
{% import "reporting/actions.html.twig" as actions %}
{% block page_title %}{{ 'reporting.title'|trans({}, 'reporting') }}{% endblock %}
{% block page_subtitle %}{% block report_title %}{% endblock %}{% endblock %}
{% block page_actions %}{{ actions.reporting() }}{% endblock %}
{% block main %}
<div class="row">
<div class="col-md-12">
{% block report %}{% endblock %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,99 @@
{% extends 'reporting/layout.html.twig' %}
{% block report_title %}{{ 'report_user_month'|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_user_month'), 'attr': {'class': 'form-inline'}}) }}
{% endblock %}
{% block box_after %}
{{ form_end(form) }}
{% endblock %}
{% block box_title %}
{% if form.user is defined %}
{{ form_widget(form.user) }}
{% else %}
{{ widgets.username(user) }}
{% endif %}
{{ form_widget(form.date) }}
{% endblock %}
{% block box_body_class %}user-month-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.day is weekend %} weekend{% endif %}">
{{ day.day|day_name(true) }}<br>
{{ day.day|date_format('d.m') }}
</th>
{% endfor %}
<th></th>
</tr>
{% for project in rows %}
<tr>
<td class="text-nowrap">
<strong>{{ widgets.label_project(project.project) }}</strong>
</td>
{% for day in project.days %}
<td class="text-nowrap{% if day.date is weekend %} weekend{% endif %}">
{% if day.duration > 0 %}
{{ day.duration|duration }}
{% endif %}
</td>
{% endfor %}
<th class="text-nowrap">{{ project.duration|duration }}</th>
</tr>
{% for activity in project.activities %}
<tr>
<td class="text-nowrap">
{{ widgets.label_activity(activity.activity) }}
</td>
{% for day in activity.days %}
<td class="text-nowrap{% if day.date is weekend %} weekend{% endif %}">
{% if day.duration > 0 %}
{{ day.duration|duration }}
{% endif %}
</td>
{% endfor %}
<th class="text-nowrap">{{ activity.duration|duration }}</th>
</tr>
{% endfor %}
{% endfor %}
{% set total = 0 %}
<tr>
<th></th>
{% for day in days %}
<th class="text-nowrap{% if day.day is weekend %} weekend{% endif %}">
{% if day.totalDuration > 0 %}
{{ day.totalDuration|duration }}
{% set total = total + day.totalDuration %}
{% endif %}
</th>
{% endfor %}
<th class="text-nowrap">{{ total|duration }}</th>
</tr>
</table>
{% endblock %}
{% endembed %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="text/javascript">
document.addEventListener('kimai.initialized', function() {
{% if form.user is defined %}
$('#{{ form.user.vars.id }}').on('change', function(ev) {
$(this).closest('form').submit();
});
{% endif %}
$('#{{ form.date.vars.id }}').on('change', function(ev) {
$(this).closest('form').submit();
});
});
</script>
{% endblock %}

View File

@@ -0,0 +1,63 @@
{% 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 %}