reporting cleanup (#1903)

- show form error when trying to load invalid user
- added non-breaking space to first table cells to allow copy&paste to excel
- added several css classes to allow customizations
- remove team assignment check for user selection
This commit is contained in:
Kevin Papst
2020-08-21 11:31:42 +02:00
committed by GitHub
parent e6d01f2a23
commit 5c79e68c77
5 changed files with 33 additions and 45 deletions

View File

@@ -65,17 +65,7 @@ final class ReportingController extends AbstractController
return false; return false;
} }
$currentUser = $this->getUser(); return true;
if ($currentUser->canSeeAllData()) {
return true;
}
if ($currentUser->hasTeamAssignment()) {
return true;
}
return false;
} }
/** /**

View File

@@ -7,7 +7,7 @@
{% block main %} {% block main %}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12" id="reporting-content">
{% block report %}{% endblock %} {% block report %}{% endblock %}
</div> </div>
</div> </div>

View File

@@ -21,7 +21,7 @@
{% endblock %} {% endblock %}
{% block box_title %} {% block box_title %}
{% if form.user is defined %} {% if form.user is defined %}
{{ form_widget(form.user) }} {{ form_row(form.user, {'label': false}) }}
{% else %} {% else %}
{{ widgets.username(user) }} {{ widgets.username(user) }}
{% endif %} {% endif %}
@@ -34,8 +34,8 @@
{% else %} {% else %}
<table class="table table-bordered table-hover dataTable"> <table class="table table-bordered table-hover dataTable">
<tr> <tr>
<th></th> <th>&nbsp;</th>
<th></th> <th>&nbsp;</th>
{% for day in days %} {% for day in days %}
<th class="text-center text-nowrap{% if day.day is weekend %} weekend{% endif %}"> <th class="text-center text-nowrap{% if day.day is weekend %} weekend{% endif %}">
{{ day.day|day_name(true) }}<br> {{ day.day|day_name(true) }}<br>
@@ -44,13 +44,13 @@
{% endfor %} {% endfor %}
</tr> </tr>
{% for project in rows %} {% for project in rows %}
<tr> <tr class="project">
<td class="text-nowrap"> <td class="text-nowrap">
<strong>{{ widgets.label_project(project.project) }}</strong> <strong>{{ widgets.label_project(project.project) }}</strong>
</td> </td>
<th class="text-nowrap text-center">{{ project.duration|duration }}</th> <th class="text-nowrap text-center total">{{ project.duration|duration }}</th>
{% for day in project.days %} {% for day in project.days %}
<td class="text-nowrap text-center{% if day.date is weekend %} weekend{% endif %}"> <td class="text-nowrap text-center day-total{% if day.date is weekend %} weekend{% endif %}">
{% if day.duration > 0 %} {% if day.duration > 0 %}
<strong>{{ day.duration|duration }}</strong> <strong>{{ day.duration|duration }}</strong>
{% endif %} {% endif %}
@@ -58,13 +58,13 @@
{% endfor %} {% endfor %}
</tr> </tr>
{% for activity in project.activities %} {% for activity in project.activities %}
<tr> <tr class="activity">
<td class="text-nowrap"> <td class="text-nowrap">
{{ widgets.label_activity(activity.activity) }} {{ widgets.label_activity(activity.activity) }}
</td> </td>
<th class="text-nowrap text-center">{{ activity.duration|duration }}</th> <th class="text-nowrap text-center total">{{ activity.duration|duration }}</th>
{% for day in activity.days %} {% for day in activity.days %}
<td class="text-nowrap text-center{% if day.date is weekend %} weekend{% endif %}"> <td class="text-nowrap text-center day-total{% if day.date is weekend %} weekend{% endif %}">
{% if day.duration > 0 %} {% if day.duration > 0 %}
{{ day.duration|duration }} {{ day.duration|duration }}
{% endif %} {% endif %}
@@ -74,14 +74,14 @@
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% set total = 0 %} {% set total = 0 %}
<tr> <tr class="summary">
{% for day in days %} {% for day in days %}
{% set total = total + day.totalDuration %} {% set total = total + day.totalDuration %}
{% endfor %} {% endfor %}
<th></th> <th></th>
<th class="text-nowrap text-center">{{ total|duration }}</th> <th class="text-nowrap text-center total">{{ total|duration }}</th>
{% for day in days %} {% for day in days %}
<th class="text-nowrap text-center{% if day.day is weekend %} weekend{% endif %}"> <th class="text-nowrap text-center day-total{% if day.day is weekend %} weekend{% endif %}">
{% if day.totalDuration > 0 %} {% if day.totalDuration > 0 %}
{{ day.totalDuration|duration }} {{ day.totalDuration|duration }}
{% endif %} {% endif %}

View File

@@ -19,8 +19,8 @@
{% block box_body %} {% block box_body %}
<table class="table table-bordered table-hover dataTable"> <table class="table table-bordered table-hover dataTable">
<tr> <tr>
<th></th> <th>&nbsp;</th>
<th></th> <th>&nbsp;</th>
{% for day in days %} {% for day in days %}
<th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}"> <th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}">
{{ day|day_name(true) }}<br> {{ day|day_name(true) }}<br>
@@ -30,7 +30,7 @@
</tr> </tr>
{% for userDay in rows %} {% for userDay in rows %}
{% set usersMonthDuration = 0 %} {% set usersMonthDuration = 0 %}
<tr> <tr class="user">
<td class="text-nowrap"> <td class="text-nowrap">
<strong>{{ widgets.username(userDay.user) }}</strong> <strong>{{ widgets.username(userDay.user) }}</strong>
</td> </td>
@@ -39,15 +39,13 @@
{% set usersMonthDuration = usersMonthDuration + day.totalDuration %} {% set usersMonthDuration = usersMonthDuration + day.totalDuration %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<th class="text-nowrap text-center"> <th class="text-nowrap text-center total">
{% if usersMonthDuration == 0 %} {% if usersMonthDuration > 0 %}
- {{ usersMonthDuration|duration }}
{% else %}
{{ usersMonthDuration|duration }}
{% endif %} {% endif %}
</th> </th>
{% for day in userDay.days %} {% for day in userDay.days %}
<td class="text-nowrap{% if day.day is weekend %} weekend{% endif %}"> <td class="text-nowrap day-total{% if day.day is weekend %} weekend{% endif %}">
{% if day.totalDuration > 0 %} {% if day.totalDuration > 0 %}
{{ day.totalDuration|duration }} {{ day.totalDuration|duration }}
{% endif %} {% endif %}

View File

@@ -21,7 +21,7 @@
{% endblock %} {% endblock %}
{% block box_title %} {% block box_title %}
{% if form.user is defined %} {% if form.user is defined %}
{{ form_widget(form.user) }} {{ form_row(form.user, {'label': false}) }}
{% else %} {% else %}
{{ widgets.username(user) }} {{ widgets.username(user) }}
{% endif %} {% endif %}
@@ -34,8 +34,8 @@
{% else %} {% else %}
<table class="table table-bordered table-hover dataTable"> <table class="table table-bordered table-hover dataTable">
<tr> <tr>
<th></th> <th>&nbsp;</th>
<th></th> <th>&nbsp;</th>
{% for day in days %} {% for day in days %}
<th class="text-center text-nowrap{% if day.day is weekend %} weekend{% endif %}"> <th class="text-center text-nowrap{% if day.day is weekend %} weekend{% endif %}">
{{ day.day|day_name(true) }}<br> {{ day.day|day_name(true) }}<br>
@@ -44,13 +44,13 @@
{% endfor %} {% endfor %}
</tr> </tr>
{% for project in rows %} {% for project in rows %}
<tr> <tr class="project">
<td class="text-nowrap"> <td class="text-nowrap">
<strong>{{ widgets.label_project(project.project) }}</strong> <strong>{{ widgets.label_project(project.project) }}</strong>
</td> </td>
<th class="text-nowrap text-center">{{ project.duration|duration }}</th> <th class="text-nowrap text-center total">{{ project.duration|duration }}</th>
{% for day in project.days %} {% for day in project.days %}
<td class="text-nowrap text-center{% if day.date is weekend %} weekend{% endif %}"> <td class="text-nowrap text-center day-total{% if day.date is weekend %} weekend{% endif %}">
{% if day.duration > 0 %} {% if day.duration > 0 %}
<strong>{{ day.duration|duration }}</strong> <strong>{{ day.duration|duration }}</strong>
{% endif %} {% endif %}
@@ -58,13 +58,13 @@
{% endfor %} {% endfor %}
</tr> </tr>
{% for activity in project.activities %} {% for activity in project.activities %}
<tr> <tr class="activity">
<td class="text-nowrap"> <td class="text-nowrap">
{{ widgets.label_activity(activity.activity) }} {{ widgets.label_activity(activity.activity) }}
</td> </td>
<th class="text-nowrap text-center">{{ activity.duration|duration }}</th> <th class="text-nowrap text-center total">{{ activity.duration|duration }}</th>
{% for day in activity.days %} {% for day in activity.days %}
<td class="text-nowrap text-center{% if day.date is weekend %} weekend{% endif %}"> <td class="text-nowrap text-center day-total{% if day.date is weekend %} weekend{% endif %}">
{% if day.duration > 0 %} {% if day.duration > 0 %}
{{ day.duration|duration }} {{ day.duration|duration }}
{% endif %} {% endif %}
@@ -74,14 +74,14 @@
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% set total = 0 %} {% set total = 0 %}
<tr> <tr class="summary">
{% for day in days %} {% for day in days %}
{% set total = total + day.totalDuration %} {% set total = total + day.totalDuration %}
{% endfor %} {% endfor %}
<th></th> <th></th>
<th class="text-nowrap text-center">{{ total|duration }}</th> <th class="text-nowrap text-center total">{{ total|duration }}</th>
{% for day in days %} {% for day in days %}
<th class="text-nowrap text-center{% if day.day is weekend %} weekend{% endif %}"> <th class="text-nowrap text-center day-total{% if day.day is weekend %} weekend{% endif %}">
{% if day.totalDuration > 0 %} {% if day.totalDuration > 0 %}
{{ day.totalDuration|duration }} {{ day.totalDuration|duration }}
{% endif %} {% endif %}