added export module (#538)

This commit is contained in:
Kevin Papst
2019-02-05 21:37:33 +01:00
committed by GitHub
parent 062735c9e3
commit 816866549c
104 changed files with 3770 additions and 608 deletions

View File

@@ -18,54 +18,56 @@
{% endblock %}
{% block main %}
{% if entries.count == 0 %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% else %}
{% set columns = {
'name': 'alwaysVisible',
'customer': 'hidden-xs',
'project': '',
'comment': 'hidden-xs',
'visible': 'hidden-xs',
'actions': 'alwaysVisible',
} %}
{% set tableName = 'activity_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td>{{ entry.name }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
{% if entry.project and entry.project.customer %}
<a href="{{ path('admin_customer_edit', {'id' : entry.project.customer.id}) }}">{{ widgets.label_customer(entry.project.customer) }}</a>
{% else %}
{#{ widgets.label('x', 'success') }#}
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">
{% if entry.project %}
<a href="{{ path('admin_project_edit', {'id' : entry.project.id}) }}">{{ widgets.label_project(entry.project) }}</a>
{% else %}
{#{ widgets.label('x', 'success') }#}
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('admin_activity_edit', {'id': entry.id})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_activity_delete', {'id': entry.id})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_activity_paginated') }}
{% endif %}
{% set columns = {
'name': 'alwaysVisible',
'customer': 'hidden-xs',
'project': '',
'comment': 'hidden-xs',
'visible': 'hidden-xs',
'actions': 'alwaysVisible',
} %}
{% set tableName = 'activity_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td>{{ entry.name }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
{% if entry.project and entry.project.customer %}
<a href="{{ path('admin_customer_edit', {'id' : entry.project.customer.id}) }}">{{ widgets.label_customer(entry.project.customer) }}</a>
{% else %}
{#{ widgets.label('x', 'success') }#}
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">
{% if entry.project %}
<a href="{{ path('admin_project_edit', {'id' : entry.project.id}) }}">{{ widgets.label_project(entry.project) }}</a>
{% else %}
{#{ widgets.label('x', 'success') }#}
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('admin_activity_edit', {'id': entry.id})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_activity_delete', {'id': entry.id})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_activity_paginated') }}
{% endblock %}

View File

@@ -18,51 +18,49 @@
{% endblock %}
{% block main %}
{% if entries.count == 0 %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% else %}
{% set columns = {
'name': 'alwaysVisible',
'comment': 'hidden-xs',
'country': 'hidden-xs',
'customer_number': 'hidden-xs',
'currency': 'hidden-xs',
'visible': 'hidden-xs',
'actions': 'alwaysVisible',
} %}
{% set tableName = 'customer_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td>{{ entry.name }} {% if entry.company is not empty %}({{ entry.company }}){% endif %}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'country') }}">{{ entry.country|country }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer_number') }}">{{ entry.number }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'currency') }}">{{ entry.currency }} {{ entry.currency|currency }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('admin_customer_edit', {'id': entry.id})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('view_project') %}
{% set actionButtons = actionButtons|merge({'project': path('admin_project', {'customer': entry.id})}) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_customer_delete', {'id': entry.id})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_customer_paginated') }}
{% endif %}
{% set columns = {
'name': 'alwaysVisible',
'project': '',
'comment': 'hidden-xs',
'country': 'hidden-xs',
'customer_number': 'hidden-xs',
'currency': 'hidden-xs',
'visible': 'hidden-xs',
'actions': 'alwaysVisible',
} %}
{% set tableName = 'customer_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td>{{ entry.name }} {% if entry.company is not empty %}({{ entry.company }}){% endif %}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">
{% for project in entry.projects %}
<a href="{{ path('admin_project_edit', {'id' : project.id}) }}">{{ widgets.label_project(project) }}</a>
<br class="visible-xs-block">
{% endfor %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'country') }}">{{ entry.country|country }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer_number') }}">{{ entry.number }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'currency') }}">{{ entry.currency }} {{ entry.currency|currency }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('admin_customer_edit', {'id': entry.id})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_customer_delete', {'id': entry.id})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_customer_paginated') }}
{% endblock %}

View File

@@ -18,44 +18,49 @@
{% endblock %}
{% block main %}
{% if entries.count == 0 %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% else %}
{% set columns = {
'name': 'alwaysVisible',
'customer': '',
'comment': 'hidden-xs hidden-sm',
'budget': 'hidden-xs',
'visible': 'hidden-xs',
'actions': 'alwaysVisible',
} %}
{% set tableName = 'project_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td>{{ entry.name }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
<a href="{{ path('admin_customer_edit', {'id' : entry.customer.id}) }}">{{ widgets.label_customer(entry.customer) }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">{{ entry.budget|money(entry.customer.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('admin_project_edit', {'id': entry.id})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('view_activity') %}
{% set actionButtons = actionButtons|merge({'activity': path('admin_activity', {'customer': entry.customer.id, 'project': entry.id})}) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_project_delete', {'id': entry.id})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_project_paginated') }}
{% endif %}
{% set columns = {
'name': 'alwaysVisible',
'customer': '',
'comment': 'hidden-xs hidden-sm',
'budget': 'hidden-xs',
'visible': 'hidden-xs',
'actions': 'alwaysVisible',
} %}
{% set tableName = 'project_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td>{{ entry.name }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
<a href="{{ path('admin_customer_edit', {'id' : entry.customer.id}) }}">{{ widgets.label_customer(entry.customer) }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">{{ entry.budget|money(entry.customer.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('admin_project_edit', {'id': entry.id})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_project_delete', {'id': entry.id})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_project_paginated') }}
{% endblock %}

View File

@@ -22,85 +22,87 @@
{% endblock %}
{% block main %}
{% if entries.count == 0 %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% endif %}
{% else %}
{% set columns = {'date': ''} %}
{% set columns = {'date': ''} %}
{% if not duration_only %}
{% set columns = columns|merge({'starttime': 'hidden-xs', 'endtime': 'hidden-xs'}) %}
{% endif %}
{% if not duration_only %}
{% set columns = columns|merge({'starttime': 'hidden-xs', 'endtime': 'hidden-xs'}) %}
{% endif %}
{% set columns = columns|merge({
'duration': '',
'rate': '',
'customer': 'hidden-xs hidden-sm',
'project': 'hidden-xs hidden-sm',
'activity': 'hidden-xs hidden-sm',
'username': 'hidden-xs',
'description': 'hidden-xs hidden-sm',
'actions': 'alwaysVisible',
}) %}
{% set columns = columns|merge({
'duration': '',
'rate': '',
'customer': 'hidden-xs hidden-sm',
'project': 'hidden-xs hidden-sm',
'activity': 'hidden-xs hidden-sm',
'username': 'hidden-xs',
'description': 'hidden-xs hidden-sm',
'actions': 'alwaysVisible',
}) %}
{% set tableName = 'timesheet_admin' %}
{% set tableName = 'timesheet_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'date') }}">{{ entry.begin|date_short }}</td>
{% for entry in entries %}
<tr>
<td class="{{ tables.data_table_column_class(tableName, columns, 'date') }}">{{ entry.begin|date_short }}</td>
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|date("H:i") }}</td>
{% endif %}
{% if entry.end %}
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}">{{ entry.end|date("H:i") }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|date("H:i") }}</td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'duration') }}">{{ entry.duration|duration }}</td>
{% else %}
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}">&dash;</td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'duration') }}"><i>{{ entry|duration }}</i></td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'rate') }}">
{% if not entry.end or not is_granted('view_rate', entry) %}
&dash;
{% if entry.end %}
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}">{{ entry.end|date("H:i") }}</td>
{% endif %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}">{{ entry.duration|duration }}</td>
{% else %}
{{ entry.rate|money(entry.project.customer.currency) }}
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}">&dash;</td>
{% endif %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}"><i>{{ entry|duration }}</i></td>
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
<a href="{{ path('admin_customer_edit', {'id': entry.project.customer.id}) }}">{{ widgets.label_customer(entry.project.customer) }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">
<a href="{{ path('admin_project_edit', {'id': entry.project.id}) }}">{{ widgets.label_project(entry.project) }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">
<a href="{{ path('admin_activity_edit', {'id': entry.activity.id}) }}">{{ widgets.label_activity(entry.activity) }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'username') }}"><a href="{{ path('user_profile'|route_alias, {'username' : entry.user.username}) }}">{{ widgets.label_user(entry.user) }}</a></td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }}">{{ entry.description|nl2br }}</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 %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'rate') }}">
{% if not entry.end or not is_granted('view_rate', entry) %}
&dash;
{% else %}
{{ entry.rate|money(entry.project.customer.currency) }}
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
<a href="{{ path('admin_customer_edit', {'id': entry.project.customer.id}) }}">{{ widgets.label_customer(entry.project.customer) }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">
<a href="{{ path('admin_project_edit', {'id': entry.project.id}) }}">{{ widgets.label_project(entry.project) }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">
<a href="{{ path('admin_activity_edit', {'id': entry.activity.id}) }}">{{ widgets.label_activity(entry.activity) }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'username') }}"><a href="{{ path('user_profile'|route_alias, {'username' : entry.user.username}) }}">{{ widgets.label_user(entry.user) }}</a></td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }}">{{ entry.description|nl2br }}</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') }}
{% endif %}
{{ tables.data_table_footer(entries, 'admin_timesheet_paginated') }}
{% endblock %}
{% block javascripts %}

View File

@@ -19,50 +19,53 @@
{% endblock %}
{% block main %}
{% if entries.count == 0 %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% else %}
{% set columns = {
'alias': 'alwaysVisible',
'username': 'hidden-xs',
'email': 'hidden-xs hidden-sm',
'title': 'hidden-xs',
'active': '',
'roles': '',
'actions': 'alwaysVisible',
} %}
{% set tableName = 'user_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td>{{ widgets.username(entry) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'username') }}">{{ entry.username }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'email') }}">{{ entry.email }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'title') }}">{{ entry.title }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'active') }}">{{ widgets.label_visible(entry.enabled) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'roles') }}">
{% for role in entry.roles %}
{{ widgets.label_role(role) }}
{% endfor %}
</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = actionButtons|merge({'edit': path('user_profile', {'username' : entry.username})}) %}
{% endif %}
{% if is_granted('view_other_timesheet') %}
{% set actionButtons = actionButtons|merge({'timesheet': path('admin_timesheet', {'user' : entry.id})}) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_user_delete', {'id': entry.id})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_user_paginated') }}
{% endif %}
{% set columns = {
'id': 'hidden-xs',
'alias': 'alwaysVisible',
'username': 'hidden-xs',
'email': 'hidden-xs hidden-sm',
'title': 'hidden-xs',
'active': '',
'roles': '',
'actions': 'alwaysVisible',
} %}
{% set tableName = 'user_admin' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td class="{{ tables.data_table_column_class(tableName, columns, 'id') }}">{{ entry.id }}</td>
<td>{{ widgets.username(entry) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'username') }}">{{ entry.username }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'email') }}">{{ entry.email }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'title') }}">{{ entry.title }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'active') }}">{{ widgets.label_visible(entry.enabled) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'roles') }}">
{% for role in entry.roles %}
{{ widgets.label_role(role) }}
{% endfor %}
</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = {'edit': path('user_profile', {'username' : entry.username})}|merge(actionButtons) %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('admin_user_delete', {'id': entry.id})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_user_paginated') }}
{% endblock %}

View File

@@ -1,7 +1,7 @@
{% extends '@AdminLTE/layout/default-layout-avanzu.html.twig' %}
{% block avanzu_page_content_before %}
<div class="pad no-print">
<div class="toolbar-pad no-print">
{% block main_before %}{% endblock %}
</div>
{% endblock %}
@@ -42,14 +42,14 @@
{% block avanzu_navbar_messages %}
{% if app.user is not null and is_granted('IS_AUTHENTICATED_REMEMBERED') %}
{% if is_granted('ROLE_USER') %}
{% if is_granted('view_own_timesheet') %}
<li class="visible-xs-inline-block">
<a href="{{ path('timesheet') }}" class="ddt-large">
<i class="{{ 'timesheet'|icon }} fa-2x"></i>
</a>
</li>
{% endif %}
{% if is_granted('ROLE_TEAMLEAD') %}
{% if is_granted('view_invoice') %}
<li class="visible-xs-inline-block">
<a href="{{ path('invoice') }}" class="ddt-large">
<i class="{{ 'invoice'|icon }} fa-2x"></i>

View File

@@ -0,0 +1,249 @@
{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/toolbar.html.twig" as toolbar %}
{% import "macros/datatables.html.twig" as tables %}
{% block page_title %}{{ 'export.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'export.subtitle'|trans }}{% endblock %}
{% block page_actions %}
{% set actions = {
'filter': '#collapseExport',
'fas fa-toggle-off': {'id':'export-toggle-button'}
} %}
{{ widgets.page_actions(actions) }}
{% endblock %}
{% block main_before %}
{{ toolbar.toolbar(form, 'collapseExport', true) }}
{% endblock %}
{% block main_after %}
<div class="clearfix"></div>
{% endblock %}
{% block main %}
{% if entries is empty %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% else %}
{#
{% set columns = {'date': ''} %}
{% if not duration_only %}
{% set columns = columns|merge({'starttime': 'hidden-xs', 'endtime': 'hidden-xs'}) %}
{% endif %}
{% set columns = columns|merge({
'duration': '',
'rate': '',
'customer': 'hidden-xs hidden-sm',
'project': 'hidden-xs hidden-sm',
'activity': 'hidden-xs hidden-sm',
'username': 'hidden-xs',
'description': 'hidden-xs hidden-sm',
'actions': 'alwaysVisible',
}) %}
#}
{% set columns = {
'date': '',
'user': 'hidden-xs hidden-sm',
'customer': 'hidden-xs hidden-sm',
'project': 'hidden-xs hidden-sm',
'activity': 'hidden-xs hidden-sm',
'description': 'hidden-xs hidden-sm',
'unit_price': '',
'duration': '',
'total_rate': '',
'exported': 'alwaysVisible',
} %}
{% set tableName = 'export' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
{% set currency = entry.project.customer.currency %}
{% set duration = entry.duration|duration() %}
{% if entry.fixedRate is not null %}
{% set rate = entry.fixedRate %}
{% set duration = 1 %}
{% elseif entry.hourlyRate is not null %}
{% set rate = entry.hourlyRate %}
{% else %}
{% set rate = entry.user.preferenceValue('hourly_rate') %}
{% endif %}
<tr>
<td class="text-nowrap">{{ entry.begin|date_short }}</td>
<td class="hidden-xs hidden-sm">{{ widgets.label_user(entry.user) }}</td>
<td class="hidden-xs hidden-sm">{{ widgets.label_customer(entry.project.customer) }}</td>
<td class="hidden-xs hidden-sm">{{ widgets.label_project(entry.project) }}</td>
<td class="hidden-xs hidden-sm">{{ widgets.label_activity(entry.activity) }}</td>
<td class="hidden-xs hidden-sm timesheet-description">
{{ entry.description }}
</td>
<td class="text-nowrap">
{{ rate|money(currency) }}
</td>
<td class="text-nowrap">
{{ duration }}
</td>
<td class="text-nowrap">
{{ entry.rate|money(currency) }}
</td>
<td>
{% if is_granted('edit_export', entry) %}
{% if entry.exported %}
<button type="button" class="btn btn-default exportBtn active" data-toggle="button" aria-pressed="true" autocomplete="off"
data-exported-text="{{ 'entryState.exported'|trans }}" data-clean-text="{{ 'entryState.not_exported'|trans }}" data-timesheet="{{ entry.id }}">
{{ 'entryState.exported'|trans }}
</button>
{% else %}
<button type="button" class="btn btn-default exportBtn" data-toggle="button" aria-pressed="false" autocomplete="off"
data-exported-text="{{ 'entryState.exported'|trans }}" data-clean-text="{{ 'entryState.not_exported'|trans }}" data-timesheet="{{ entry.id }}">
{{ 'entryState.not_exported'|trans }}
</button>
{% endif %}
{% else %}
{% if entry.exported %}
{{ 'entryState.exported'|trans }}
{% else %}
{{ 'entryState.not_exported'|trans }}
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries) }}
{% if is_granted('create_export') %}
<div class="row no-print">
<div class="col-xs-12">
<div class="btn-group pull-right" id="export-buttons" role="group">
{% for button in renderer %}
<button type="button" id="export-{{ button.id }}-button" class="btn btn-success startExportBtn" data-type="{{ button.id }}">
<i class="{{ button.icon|icon }}"></i> {{ ('button.' ~ button.title)|trans }}
</button>
{% endfor %}
</div>
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="text/javascript">
function confirmToggleState()
{
if ($('#export-toggle-button').hasClass('export-off')) {
if (confirm('{{ 'export.clear_all'|trans }}')) {
$('.exportBtn').each(function () {
if ($(this).hasClass('active')) {
$(this).click();
}
});
return true;
}
} else {
if (confirm('{{ 'export.mark_all'|trans }}')) {
$('.exportBtn').each(function () {
if (!$(this).hasClass('active')) {
$(this).click();
}
});
return true;
}
}
return false;
}
function updateTimesheetExportState(button, id, exported)
{
$.ajax({
url: '{{ path('patch_timesheet', {id: '-s-'}) }}'.replace('-s-', id),
headers: {
'X-AUTH-SESSION': true,
'Content-Type':'application/json'
},
method: 'PATCH',
dataType: 'json',
data: JSON.stringify({'exported': exported}),
success: function(data) {
if (exported) {
button.button('exported');
} else {
button.button('clean');
}
if ($('select#exported').val() !== '{{ constant('App\\Repository\\Query\\TimesheetQuery::STATE_ALL') }}') {
button.closest('tr').hide('ease', function() {
$(this).remove();
if($(this).closest('table').find('tbody tr:visible').length === 0) {
$('#export-buttons button').prop('disabled', true);
}
});
}
}, error: function(jqXHR, textStatus, errorThrown) {
var message = 'An error occured';
if (jqXHR.responseJSON !== undefined) {
console.log(jqXHR);
message = jqXHR.responseJSON.message;
if (jqXHR.responseJSON.errors !== undefined)
{
var errors = jqXHR.responseJSON.errors.errors;
for (var i = 0; i < errors.length; i++) {
message += ' / ' + errors[i];
}
}
}
alert('{{ 'action.update.error'|trans({}, 'flashmessages') }}'.replace('%reason%', message));
button.button('reset');
if (exported) {
button.removeClass('active');
} else {
button.addClass('active');
}
}
});
}
$(document).ready(function () {
$('body').on('click', '.exportBtn', function() {
var button = $(this);
var id = button.attr('data-timesheet');
if (button.hasClass('active')) {
updateTimesheetExportState(button, id, false);
} else {
updateTimesheetExportState(button, id, true);
}
});
$('#export-toggle-button').on('click', function () {
if (!confirmToggleState()) {
return;
}
if ($(this).hasClass('export-off')) {
$(this).removeClass('export-off');
$(this).html('<i class="fas fa-toggle-off"></i>');
} else {
$(this).addClass('export-off');
$(this).html('<i class="fas fa-toggle-on"></i>');
}
});
$('body').on('click', '#export-buttons .startExportBtn', function() {
$('#type').val($(this).attr('data-type'));
var $form = $("#export-form");
var prevAction = $form.attr('action');
$form.attr('target', '_blank').attr('action', '{{ path('export_data') }}');
$form.submit();
$('#type').val('');
$form.removeAttr('target').attr('action', prevAction);
});
});
</script>
{% endblock %}

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="{{ app.request.locale }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
<script src="{{ asset('build/app.js') }}"></script>
</head>
<body class="pad export_print">
<div class="wrapper">
<section class="export">
{% block export %}{% endblock %}
</section>
</div>
</body>
</html>

View File

@@ -0,0 +1,172 @@
{% import "macros/widgets.html.twig" as widgets %}
{% extends 'export/layout.html.twig' %}
{% block export %}
<style>
.items tr.summary {
}
.items td.totals {
font-weight: bold;
text-align: right;
}
.items td.duration,
.items th.duration,
.items th.cost,
.items td.cost {
text-align: center;
}
</style>
<div class="row">
<div class="col-xs-12">
<h2>{{ 'export.document_title'|trans }}</h2>
<p>
{{ 'export.period'|trans }}:
{{ query.begin|date_short }} - {{ query.end|date_short }}
</p>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h3>{{ 'export.summary'|trans }}</h3>
<table class="items table table-condensed table-bordered dataTable">
<thead>
<tr>
<th>{{ 'label.customer'|trans }}</th>
<th>{{ 'label.project'|trans }}</th>
<th class="duration">{{ 'label.duration'|trans }}</th>
<th class="cost">{{ 'label.rate'|trans }}</th>
</tr>
</thead>
<tbody>
{% set customer = null %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% set customerCurrency = null %}
{% for summary in summaries %}
{% if customer is same as(null) %}
{% set customer = summary.customer %}
{% set customerCurrency = summary.currency %}
{% endif %}
{% if customer is not same as(summary.customer) %}
<tr class="summary">
<td colspan="2"></td>
<td class="totals duration">{{ customerDuration|duration }}</td>
<td class="totals cost">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% set customerCurrency = summary.currency %}
{% set customer = summary.customer %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% endif %}
<tr>
<td>{{ summary.customer }}</td>
<td>{{ summary.project }}</td>
<td class="duration">{{ summary.duration|duration }}</td>
<td class="cost">{{ summary.rate|money(summary.currency) }}</td>
</tr>
{% set customerDuration = customerDuration + summary.duration %}
{% set customerRate = customerRate + summary.rate %}
{% endfor %}
{% if customer is not same as(null) %}
<tr class="summary">
<td colspan="2"></td>
<td class="totals duration">{{ customerDuration|duration }}</td>
<td class="totals cost">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
{% set columns = [
'label.date',
'label.begin',
'label.end',
'label.username',
'label.customer',
'label.project',
'label.activity',
'label.description',
'label.exported',
'label.hourly_rate',
'label.fixed_rate',
'label.duration',
'label.rate',
] %}
<div class="row" id="export-records">
<div class="col-xs-12">
<h3>{{ 'export.full_list'|trans }}</h3>
<table class="table table-condensed table-bordered dataTable">
<thead>
<tr>
{% for columnTitle in columns %}
<th>{{ columnTitle|trans }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% set timeWorked = 0 %}
{% set rateTotal = 0 %}
{% set currency = false %}
{% for entry in entries %}
{% set timeWorked = timeWorked + entry.duration %}
{% set rateTotal = rateTotal + entry.rate %}
{% if currency is same as(false) %}
{% set currency = entry.project.customer.currency %}
{% endif %}
{% if currency is not same as(entry.project.customer.currency) %}
{% set currency = null %}
{% endif %}
<tr>
<td class="text-nowrap">{{ entry.begin|date_short }}</td>
<td class="text-nowrap">{{ entry.begin|date("H:i") }}</td>
<td class="text-nowrap">{{ entry.end|date("H:i") }}</td>
<td>{{ widgets.username(entry.user) }}</td>
<td>{{ entry.project.customer.name }}</td>
<td>{{ entry.project.name }}</td>
<td>{{ entry.activity.name }}</td>
<td>
{% if entry.description is not empty %}
{{ entry.description|desc2html }}
{% endif %}
</td>
<td>
{% if entry.exported %}
{{ 'entryState.exported'|trans }}
{% else %}
{{ 'entryState.not_exported'|trans }}
{% endif %}
</td>
<td class="text-nowrap">{{ entry.hourlyRate|money(entry.project.customer.currency) }}</td>
<td class="text-nowrap">{{ entry.fixedRate|money(entry.project.customer.currency) }}</td>
<td class="text-nowrap">{{ entry.duration|duration }}</td>
<td class="text-nowrap">
{{ entry.rate|money(entry.project.customer.currency) }}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="{{ ( columns|length ) - 2 }}" class="text-right"></th>
<th class="text-nowrap">
{{ timeWorked|duration }}
</th>
<th class="text-nowrap">
{% if currency is not null and currency is not same as(false) %}
{{ rateTotal|money(currency) }}
{% else %}
{{ rateTotal|money }}
{% endif %}
</th>
</tr>
</tfoot>
</table>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,169 @@
<html>
<head>
<style>
body {font-family: sans-serif;
font-size: 10pt;
}
p { margin: 0pt; }
table.items {
border: 0.1mm solid #000000;
}
td { vertical-align: top; }
.items td {
border-left: 0.1mm solid #000000;
border-right: 0.1mm solid #000000;
}
.items tr.even {
background-color: #e0ebff;
}
.items tr.summary {
background-color: #efefef;
}
.items tr.summary td {
font-weight: bold;
border-top: 0.1mm solid #000000;
border-bottom: 0.1mm solid #000000;
}
table thead td {
background-color: #ececec;
text-align: center;
border: 0.1mm solid #000000;
font-variant: small-caps;
}
.items td.totals {
font-weight: bold;
text-align: right;
border: 0.1mm solid #000000;
}
.items td.duration,
.items td.cost {
text-align: center;
}
</style>
</head>
<body>
<!--mpdf
<htmlpagefooter name="myfooter">
<table style="border-top: 1px solid #000000; font-size: 9pt; padding-top: 3mm; width: 100%">
<tr>
<td align="left">
{{ 'export.page_of'|trans({'%page%': '{PAGENO}', '%pages%': '{nb}'}) }}
</td>
<td align="right">
{{ 'export.date_copyright'|trans({'%date%': now|date_short ~ ' ' ~ now|date('H:i'), '%kimai%': '<a href="' ~ constant('App\\Constants::HOMEPAGE') ~ '">' ~ constant('App\\Constants::SOFTWARE') ~ '</a>'})|raw }}
</td>
</tr>
</table>
</htmlpagefooter>
<sethtmlpagefooter name="myfooter" value="on" />
mpdf-->
<h2 style="margin-bottom: 0; padding-bottom: 0">{{ 'export.document_title'|trans }}</h2>
<p>
{{ 'export.period'|trans }}:
{{ query.begin|date_short }} - {{ query.end|date_short }}
</p>
<h3>{{ 'export.summary'|trans }}</h3>
<table class="items" width="100%" style="font-size: 9pt; border-collapse: collapse; " cellpadding="8">
<thead>
<tr>
<td>{{ 'label.customer'|trans }}</td>
<td>{{ 'label.project'|trans }}</td>
<td>{{ 'label.duration'|trans }}</td>
<td>{{ 'label.rate'|trans }}</td>
</tr>
</thead>
<tbody>
{% set customer = null %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% set customerCurrency = null %}
{% set customerCount = 0 %}
{% for summary in summaries %}
{% if customer is same as(null) %}
{% set customer = summary.customer %}
{% set customerCurrency = summary.currency %}
{% endif %}
{% if customer is not same as(summary.customer) %}
<tr class="summary">
<td colspan="2"></td>
<td class="totals duration">{{ customerDuration|duration }}</td>
<td class="totals cost">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% set customerCurrency = summary.currency %}
{% set customer = summary.customer %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% set customerCount = 0 %}
{% endif %}
<tr class="{{ cycle(['odd', 'even'], customerCount) }}">
<td>{{ summary.customer }}</td>
<td>{{ summary.project }}</td>
<td class="duration">{{ summary.duration|duration }}</td>
<td class="cost">{{ summary.rate|money(summary.currency) }}</td>
</tr>
{% set customerDuration = customerDuration + summary.duration %}
{% set customerRate = customerRate + summary.rate %}
{% set customerCount = customerCount + 1 %}
{% endfor %}
{% if customer is not same as(null) %}
<tr class="summary">
<td colspan="2"></td>
<td class="totals duration">{{ customerDuration|duration }}</td>
<td class="totals cost">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% endif %}
</tbody>
</table>
<pagebreak>
<h3>{{ 'export.full_list'|trans }}</h3>
{% set duration = 0 %}
{% set rate = 0 %}
{% set currency = false %}
<table class="items" width="100%" style="font-size: 9pt; border-collapse: collapse; " cellpadding="8">
<thead>
<tr>
<td>{{ 'label.date'|trans }}</td>
<td width="">{{ 'label.description'|trans }}</td>
<td>{{ 'label.duration'|trans }}</td>
<td>{{ 'label.rate'|trans }}</td>
</tr>
</thead>
<tbody>
{% for entry in entries %}
{% set duration = duration + entry.duration %}
{% set rate = rate + entry.rate %}
{% if currency is same as(false) %}
{% set currency = entry.project.customer.currency %}
{% endif %}
{% if currency is not same as(entry.project.customer.currency) %}
{% set currency = null %}
{% endif %}
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
<td>
{{ entry.begin|date_time }}
<br>
{{ entry.end|date_time }}
</td>
<td>
{{ entry.project.customer.name }} - {{ entry.project.name }} - {{ entry.activity.name }}
{% if entry.description is not empty %}
<br>
<i>{{ entry.description|desc2html }}</i>
{% endif %}
</td>
<td class="duration">{{ entry.duration|duration }}</td>
<td class="cost">{{ entry.rate|money(entry.project.customer.currency) }}</td>
</tr>
{% endfor %}
<tr class="summary">
<td colspan="2"></td>
<td class="totals duration">{{ duration|duration }}</td>
<td class="totals cost">{{ rate|money(currency) }}</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@@ -1,6 +1,7 @@
{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/toolbar.html.twig" as toolbar %}
{% import "macros/datatables.html.twig" as tables %}
{% block page_title %}{{ 'invoice.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'invoice.subtitle'|trans }}{% endblock %}
@@ -15,8 +16,6 @@
{{ widgets.page_actions(actions) }}
{% endblock %}
{% block page_content_class %}{{ parent() }} invoice{% endblock %}
{% block main_before %}
{{ toolbar.toolbar(form, 'collapseInvoice', true) }}
{% endblock %}
@@ -27,10 +26,54 @@
{% block main %}
{% if model.entries is empty %}
{{ widgets.callout('warning', 'invoice.select_filter') }}
{% set entries = {} %}
{% if model.calculator is not empty and model.calculator.entries is not empty %}
{% set entries = model.calculator.entries %}
{% endif %}
{% if entries is empty %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% else %}
{{ include('invoice/preview.html.twig') }}
{{ widgets.callout('success', 'invoice.preview') }}
{% set columns = {
'date': '',
'user': 'hidden-xs hidden-sm',
'activity': 'hidden-xs hidden-sm',
'unit_price': 'text-center',
'amount': 'text-center',
'total_rate': 'text-right',
} %}
{% set tableName = 'invoice' %}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
{% set duration = entry.duration|duration() %}
{% if entry.fixedRate is not null %}
{% set rate = entry.fixedRate %}
{% set duration = 1 %}
{% elseif entry.hourlyRate is not null %}
{% set rate = entry.hourlyRate %}
{% else %}
{% set rate = entry.user.preferenceValue('hourly_rate') %}
{% endif %}
<tr>
<td>{{ entry.begin|date_short }}</td>
<td class="hidden-xs hidden-sm">{{ widgets.username(entry.user) }}</td>
<td class="hidden-xs hidden-sm timesheet-description">
{% if entry.description is not empty %}
{{ entry.description|desc2html }}
{% else %}
{{ entry.activity.name }} / {{ entry.project.name }}
{% endif %}
</td>
<td class="text-center">{{ rate|money(model.calculator.currency) }}</td>
<td class="text-center">{{ duration }}</td>
<td class="text-right">{{ entry.rate|money(model.calculator.currency) }}</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries) }}
{% if is_granted('create_invoice') %}
<div class="row no-print">

View File

@@ -1,52 +0,0 @@
{% import "macros/widgets.html.twig" as widgets %}
{{ widgets.callout('success', 'invoice.preview') }}
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ 'label.date'|trans }}</th>
<th class="hidden-xs hidden-sm">{{ 'label.user'|trans }}</th>
<th class="hidden-xs hidden-sm">{{ 'label.activity'|trans }}</th>
<th class="text-center">{{ 'invoice.unit_price'|trans }}</th>
<th class="text-center">{{ 'invoice.amount'|trans }}</th>
<th class="text-right">{{ 'invoice.total_rate'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entry in model.calculator.entries %}
{% set duration = entry.duration|duration() %}
{% if entry.fixedRate is not null %}
{% set rate = entry.fixedRate %}
{% set duration = 1 %}
{% elseif entry.hourlyRate is not null %}
{% set rate = entry.hourlyRate %}
{% else %}
{% set rate = app.user.getPreferenceValue('hourly_rate') %}
{% endif %}
<tr>
<td>{{ entry.begin|date_short }}</td>
<td class="hidden-xs hidden-sm">{{ widgets.username(entry.user) }}</td>
<td class="hidden-xs hidden-sm timesheet-description">
{% if entry.description is not empty %}
{{ entry.description|desc2html }}
{% else %}
{{ entry.activity.name }} / {{ entry.project.name }}
{% endif %}
</td>
<td class="text-center" contenteditable="true">
{{ rate|money(model.calculator.currency) }}
</td>
<td class="text-center">
{{ duration }}
</td>
<td class="text-right">{{ entry.rate|money(model.calculator.currency) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -57,9 +57,9 @@
<tr>
<th>{{ 'label.date'|trans }}</th>
<th>{{ 'label.activity'|trans }}</th>
<th>{{ 'invoice.unit_price'|trans }}</th>
<th>{{ 'label.unit_price'|trans }}</th>
<th>{{ 'label.hours'|trans }}</th>
<th>{{ 'invoice.total_rate'|trans }}</th>
<th>{{ 'label.total_rate'|trans }}</th>
</tr>
</thead>
<tbody>

View File

@@ -70,9 +70,9 @@
<thead>
<tr>
<th>{{ 'label.description'|trans }}</th>
<th>{{ 'invoice.unit_price'|trans }}</th>
<th>{{ 'invoice.amount'|trans }}</th>
<th>{{ 'invoice.total_rate'|trans }}</th>
<th>{{ 'label.unit_price'|trans }}</th>
<th>{{ 'label.amount'|trans }}</th>
<th>{{ 'label.total_rate'|trans }}</th>
</tr>
</thead>
<tbody>

View File

@@ -89,11 +89,9 @@
<table class="table table-striped table-hover dataTable" role="grid">
<thead>
<tr>
{% for title, class in entries %}
<th class="{{ macro.data_table_column_class(name, entries, title) }}">
{{ ('label.' ~ title)|trans }}
</th>
{% endfor %}
{%- for title, class in entries -%}
<th class="{{ macro.data_table_column_class(name, entries, title) }}">{{ ('label.' ~ title)|trans }}</th>
{%- endfor -%}
</tr>
</thead>
<tbody>
@@ -104,23 +102,12 @@
</table>
</div>
</div>
{#<div class="row">
<div class="col-sm-5">
{#<div class="dataTables_info" id="example2_info" role="status" aria-live="polite">
{{ 'datatables.entry_counter'|trans({'%from%': '1', '%to%': '10', '%total%': entries.count}) }}
</div># }
</div>
<div class="col-sm-7">
<div class="dataTables_paginate paging_simple_numbers">
{{ pagerfanta(entries, 'twitter_bootstrap3_translated', { routeName: route }) }}
</div>
</div>
</div>#}
</div>
</div>
</div>
{% if route is not empty %}
<div class="navigation text-center no-print">
{{ pagerfanta(entries, 'twitter_bootstrap3_translated', { proximity: 1, routeName: route }) }}
</div>
{% endif %}
{% endmacro %}

View File

@@ -2,26 +2,58 @@
<i class="{{ icon|icon(icon) }}"></i>
{% endmacro %}
{% macro page_actions(tools) %}
{%- macro page_actions(tools) -%}
<div class="breadcrumb">
<div class="box-tools">
<div class="btn-group">
{%- for icon,url in tools %}
{%- for icon,values in tools %}
{% spaceless %}
{% set id = null %}
{% set onclick = null %}
{% set modal = null %}
{% set toggle = null %}
{% set url = null %}
{% if not values is iterable %}
{% set url = values %}
{% if 'onclick:' in url %}
{% set onclick = url|replace({'onclick:': ''}) %}
{% set url = '#' %}
{% endif %}
{% if '#collapse' in url %}
{% set toggle = 'collapse' %}
{% endif %}
{% if '#modal' in url %}
{% set modal = url %}
{% set url = '#' %}
{% endif %}
{% else %}
{% set url = values.url ?? '#' %}
{% set onclick = values.onclick ?? null %}
{% set modal = values.modal ?? null %}
{% set toggle = values.toggle ?? null %}
{% set id = values.id ?? null %}
{% endif %}
{% endspaceless %}
<a class="btn btn-default" href="{{ url }}"
{% if '#collapse' in url %}
data-toggle="collapse"
{% elseif '#modal' in url %}
data-toggle="modal" data-target="{{ url }}"
{% endif %}
{% if 'onclick:' in url %}
onclick="{{ url|replace({'onclick:': ''}) }}"
{% endif %}
{%- if id is not empty -%}
id="{{ id }}"
{%- endif -%}
{%- if toggle is not empty -%}
data-toggle="{{ toggle }}"
{%- endif -%}
{%- if modal is not empty -%}
data-toggle="modal" data-target="{{ modal }}"
{%- endif -%}
{%- if onclick is not empty -%}
onclick="{{ onclick }}"
{%- endif -%}
><i class="{{ icon|icon(icon) }}"></i></a>
{% endfor -%}
</div>
</div>
</div>
{% endmacro %}
{%- endmacro -%}
{% macro page_header(title) %}
<h2 class="page-header">{{ title|trans }}</h2>

View File

@@ -18,7 +18,12 @@
<i class="{{ 'stop-small'|icon }} fa-2x"></i>
</div>
<h4>
{{ entry.activity.name }}
{# TODO find a CSS solution for this #}
{% if entry.activity.name|length > 23 %}
{{ entry.activity.name|slice(0,20) }}...
{% else %}
{{ entry.activity.name }}
{% endif %}
<small><i class="{{ 'timesheet'|icon }}"></i> {{ entry|duration }}</small>
</h4>
<p>{{ entry.project.name }} ({{ entry.project.customer.name }})</p>

View File

@@ -28,7 +28,7 @@
</div>
</a>
</li>
{% if is_granted('ROLE_SUPER_ADMIN') %}
{% if is_granted('system_information') %}
<li>
<a href="{{ path('about') }}">
<i class="menu-icon far fa-copyright bg-aqua"></i>

View File

@@ -26,87 +26,87 @@
{% if entries.count == 0 %}
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% endif %}
{% else %}
{% set columns = {'date': ''} %}
{% set columns = {'date': ''} %}
{% if not duration_only %}
{% set columns = columns|merge({'starttime': '', 'endtime': 'hidden-xs'}) %}
{% endif %}
{% if not duration_only %}
{% set columns = columns|merge({'starttime': '', 'endtime': 'hidden-xs'}) %}
{% endif %}
{% set columns = columns|merge({'duration': ''}) %}
{% set columns = columns|merge({'duration': ''}) %}
{% if is_granted('view_rate_own_timesheet') %}
{% set columns = columns|merge({'rate': 'hidden-xs'}) %}
{% endif %}
{% if is_granted('view_rate_own_timesheet') %}
{% set columns = columns|merge({'rate': 'hidden-xs'}) %}
{% endif %}
{% set columns = columns|merge({
'customer': 'hidden-xs hidden-sm',
'project': 'hidden-xs hidden-sm',
'activity': 'hidden-xs hidden-sm',
'description': 'hidden-xs hidden-sm',
'actions': 'alwaysVisible',
}) %}
{% set columns = columns|merge({
'customer': 'hidden-xs hidden-sm',
'project': 'hidden-xs hidden-sm',
'activity': 'hidden-xs hidden-sm',
'description': 'hidden-xs hidden-sm',
'actions': 'alwaysVisible',
}) %}
{% set tableName = 'timesheet' %}
{% set tableName = 'timesheet' %}
{{ tables.data_table_header(tableName, columns) }}
{{ tables.data_table_header(tableName, columns) }}
{% for entry in entries %}
<tr>
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'date') }}">{{ entry.begin|date_short }}</td>
{% for entry in entries %}
<tr>
<td class="{{ tables.data_table_column_class(tableName, columns, 'date') }}">{{ entry.begin|date_short }}</td>
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|date("H:i") }}</td>
{% endif %}
{% if entry.end %}
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}">{{ entry.end|date("H:i") }}</td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'duration') }}">{{ entry.duration|duration }}</td>
{% if is_granted('view_rate', entry) %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'rate') }}">{{ entry.rate|money(entry.project.customer.currency) }}</td>
{% endif %}
{% else %}
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}">&dash;</td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'duration') }}"><i>{{ entry|duration }}</i></td>
{% if is_granted('view_rate', entry) %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'rate') }}">&dash;</td>
{% endif %}
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">{{ widgets.label_customer(entry.project.customer) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">{{ widgets.label_project(entry.project) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">{{ widgets.label_activity(entry.activity) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }} timesheet-description">{{ entry.description|desc2html }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = actionButtons|merge({'edit': path('timesheet_edit', {'id' : entry.id, 'page': page})}) %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|date("H:i") }}</td>
{% endif %}
{% if entry.end %}
{% if is_granted('start', entry) %}
{% set actionButtons = {'repeat': path('timesheet_start', {'id' : entry.id})}|merge(actionButtons) %}
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}">{{ entry.end|date("H:i") }}</td>
{% endif %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}">{{ entry.duration|duration }}</td>
{% if is_granted('view_rate', entry) %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'rate') }}">{{ entry.rate|money(entry.project.customer.currency) }}</td>
{% endif %}
{% else %}
{% if is_granted('stop', entry) %}
{% set actionButtons = {'stop': path('timesheet_stop', {'id' : entry.id})}|merge(actionButtons) %}
{% if not duration_only %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}">&dash;</td>
{% endif %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}"><i>{{ entry|duration }}</i></td>
{% if is_granted('view_rate', entry) %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'rate') }}">&dash;</td>
{% endif %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('timesheet_delete', {'id' : entry.id, 'page': page})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">{{ widgets.label_customer(entry.project.customer) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">{{ widgets.label_project(entry.project) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">{{ widgets.label_activity(entry.activity) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }} timesheet-description">{{ entry.description|desc2html }}</td>
<td>
{% set actionButtons = {} %}
{% if is_granted('edit', entry) %}
{% set actionButtons = actionButtons|merge({'edit': path('timesheet_edit', {'id' : entry.id, 'page': page})}) %}
{% endif %}
{{ tables.data_table_footer(entries, 'timesheet_paginated') }}
{% if entry.end %}
{% if is_granted('start', entry) %}
{% set actionButtons = {'repeat': path('timesheet_start', {'id' : entry.id})}|merge(actionButtons) %}
{% endif %}
{% else %}
{% if is_granted('stop', entry) %}
{% set actionButtons = {'stop': path('timesheet_stop', {'id' : entry.id})}|merge(actionButtons) %}
{% endif %}
{% endif %}
{% if is_granted('delete', entry) %}
{% set actionButtons = actionButtons|merge({'trash': path('timesheet_delete', {'id' : entry.id, 'page': page})}) %}
{% endif %}
{{ widgets.button_group(actionButtons) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'timesheet_paginated') }}
{% endif %}
{% endblock %}