timesheet controller refactoring (#796)
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
{% for entry in entries %}
|
||||
{% set timeWorked = timeWorked + entry.duration %}
|
||||
<tr>
|
||||
<td>{{ entry.begin|date_short }}</td>
|
||||
<td class="text-nowrap">{{ entry.begin|date_short }}</td>
|
||||
{% if query.user is empty %}
|
||||
<td>{{ widgets.username(entry.user) }}</td>
|
||||
{% endif %}
|
||||
@@ -58,7 +58,7 @@
|
||||
{{ 'label.customer'|trans }}: {{ entry.project.customer.name }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ entry.duration|duration }}</td>
|
||||
<td class="text-nowrap">{{ entry.duration|duration }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@@ -4,13 +4,17 @@
|
||||
{% import "macros/toolbar.html.twig" as toolbar %}
|
||||
{% import "macros/actions.html.twig" as actions %}
|
||||
|
||||
{% set tableName = 'timesheet_admin' %}
|
||||
{% set duration_only = is_duration_only() %}
|
||||
{% set columns = {
|
||||
'date': 'alwaysVisible',
|
||||
} %}
|
||||
|
||||
{% if not duration_only %}
|
||||
{% set columns = columns|merge({'starttime': 'hidden-xs', 'endtime': 'hidden-xs'}) %}
|
||||
{% set columns = columns|merge({
|
||||
'starttime': 'hidden-xs',
|
||||
'endtime': 'hidden-xs'
|
||||
}) %}
|
||||
{% endif %}
|
||||
|
||||
{% set columns = columns|merge({
|
||||
@@ -25,8 +29,6 @@
|
||||
'actions': 'actions alwaysVisible',
|
||||
}) %}
|
||||
|
||||
{% set tableName = 'timesheet_admin' %}
|
||||
|
||||
{% block page_title %}{{ 'admin_timesheet.title'|trans }}{% endblock %}
|
||||
{% block page_subtitle %}{{ 'admin_timesheet.subtitle'|trans }}{% endblock %}
|
||||
{% block page_actions %}{{ actions.timesheets_team('index') }}{% endblock %}
|
||||
@@ -49,21 +51,23 @@
|
||||
|
||||
{% if not duration_only %}
|
||||
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|time }}</td>
|
||||
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'endtime') }}">
|
||||
{% if entry.end %}
|
||||
{{ entry.end|time }}
|
||||
{% else %}
|
||||
‐
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{% if entry.end %}
|
||||
{% if not duration_only %}
|
||||
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'endtime') }}">{{ entry.end|time }}</td>
|
||||
{% endif %}
|
||||
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}">{{ entry.duration|duration }}</td>
|
||||
{% else %}
|
||||
{% if not duration_only %}
|
||||
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'endtime') }}">‐</td>
|
||||
{% endif %}
|
||||
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}">
|
||||
<i data-since="{{ entry.begin.format(constant('DATE_ISO8601')) }}" data-format="{{ get_format_duration() }}">{{ entry|duration }}</i>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'rate') }}">
|
||||
{% if not entry.end or not is_granted('view_rate', entry) %}
|
||||
‐
|
||||
@@ -86,7 +90,7 @@
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }}">{{ entry.description|nl2br }}</td>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'tags') }}">{{ widgets.tag_list(entry.tags) }}</td>
|
||||
<td class="actions">
|
||||
{{ actions.timesheet_team(entry, 'index') }}
|
||||
{{- actions.timesheet_team(entry, 'index') -}}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -95,17 +99,3 @@
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
<script type="text/javascript">
|
||||
function exportTimesheet() {
|
||||
var form = $("div.toolbar form.navbar-form");
|
||||
var prevAction = form.attr('action');
|
||||
form.attr('target', '_blank').attr('action', '{{ path('admin_timesheet_export') }}');
|
||||
form.submit();
|
||||
form.removeAttr('target').attr('action', prevAction);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user