Files
kimai2/templates/admin/timesheet.html.twig
2018-02-10 22:19:49 +01:00

75 lines
3.1 KiB
Twig

{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}
{% block page_title %}{{ 'admin_timesheet.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'admin_timesheet.subtitle'|trans }}{% endblock %}
{% block main %}
{% if entries.count == 0 %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% endif %}
{% set columns = {'label.date': ''} %}
{% if not duration_only %}
{% set columns = columns|merge({'label.starttime': 'hidden-xs', 'label.endtime': 'hidden-xs'}) %}
{% endif %}
{% set columns = columns|merge({
'label.duration': '',
'label.rate': '',
'label.activity': 'hidden-xs hidden-sm',
'label.username': 'hidden-xs',
'label.description': 'hidden-xs hidden-sm',
'label.actions': '',
}) %}
{{ tables.data_table_header(columns, toolbarForm, {'plus-square': path('admin_timesheet_create')}) }}
{% for entry in entries %}
<tr>
<td>{{ entry.begin|date(kimai_context.date_1) }}</td>
{% if not duration_only %}
<td class="hidden-xs">{{ entry.begin|date("H:i") }}</td>
{% endif %}
{% if entry.end %}
{% if not duration_only %}
<td class="hidden-xs">{{ entry.end|date("H:i") }}</td>
{% endif %}
<td>{{ entry.duration|duration }}</td>
<td>{{ entry.rate|money(entry.activity.project.customer.currency) }}</td>
{% else %}
{% if not duration_only %}
<td class="hidden-xs">&dash;</td>
{% endif %}
<td><i>{{ entry.duration|duration }}</i></td>
<td>&dash;</td>
{% endif %}
<td class="hidden-xs hidden-sm">
<a href="{{ path('admin_activity_edit', {'id': entry.activity.id}) }}">{{ widgets.label_activity(entry.activity) }}</a>
</td>
<td class="hidden-xs"><a href="{{ path('profile'|route_alias, {'username' : entry.user.username}) }}">{{ widgets.label_user(entry.user) }}</a></td>
<td class="hidden-xs hidden-sm">{{ entry.description }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('admin_timesheet_edit', {'id' : entry.id, 'page': page})}|merge(actionButtons) %}
{% endif %}
{% if not entry.end and is_granted('stop', entry) %}
{% set actionButtons = {'stop': path('admin_timesheet_stop', {'id' : entry.id})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_timesheet_delete', {'id' : entry.id, 'page': page})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_timesheet_paginated') }}
{% endblock %}