added tags for timesheets (#604)
This commit is contained in:
@@ -176,29 +176,31 @@
|
||||
{# no call to parent(), as we use a custom built for the frontend assets and don't want the default <script> #}
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
new KimaiWebLoader(
|
||||
window.kimai = new KimaiWebLoader(
|
||||
{
|
||||
locale: '{{ app.request.locale }}',
|
||||
twentyFourHours: {{ 'true'|hour24('false') }}
|
||||
},
|
||||
{
|
||||
apply: '{{ 'daterangepicker.apply'|trans({}, 'daterangepicker') }}',
|
||||
cancel: '{{ 'daterangepicker.cancel'|trans({}, 'daterangepicker') }}',
|
||||
today: '{{ 'daterangepicker.today'|trans({}, 'daterangepicker') }}',
|
||||
yesterday: '{{ 'daterangepicker.yesterday'|trans({}, 'daterangepicker') }}',
|
||||
lastWeek: '{{ 'daterangepicker.lastWeek'|trans({}, 'daterangepicker') }}',
|
||||
thisWeek: '{{ 'daterangepicker.thisWeek'|trans({}, 'daterangepicker') }}',
|
||||
lastMonth: '{{ 'daterangepicker.lastMonth'|trans({}, 'daterangepicker') }}',
|
||||
thisMonth: '{{ 'daterangepicker.thisMonth'|trans({}, 'daterangepicker') }}',
|
||||
lastYear: '{{ 'daterangepicker.lastYear'|trans({}, 'daterangepicker') }}',
|
||||
thisYear: '{{ 'daterangepicker.thisYear'|trans({}, 'daterangepicker') }}',
|
||||
customRange: '{{ 'daterangepicker.customRange'|trans({}, 'daterangepicker') }}',
|
||||
'confirm': '{{ 'confirm'|trans }}',
|
||||
'cancel': '{{ 'cancel'|trans }}',
|
||||
'today': '{{ 'daterangepicker.today'|trans({}, 'daterangepicker') }}',
|
||||
'yesterday': '{{ 'daterangepicker.yesterday'|trans({}, 'daterangepicker') }}',
|
||||
'lastWeek': '{{ 'daterangepicker.lastWeek'|trans({}, 'daterangepicker') }}',
|
||||
'thisWeek': '{{ 'daterangepicker.thisWeek'|trans({}, 'daterangepicker') }}',
|
||||
'lastMonth': '{{ 'daterangepicker.lastMonth'|trans({}, 'daterangepicker') }}',
|
||||
'thisMonth': '{{ 'daterangepicker.thisMonth'|trans({}, 'daterangepicker') }}',
|
||||
'lastYear': '{{ 'daterangepicker.lastYear'|trans({}, 'daterangepicker') }}',
|
||||
'thisYear': '{{ 'daterangepicker.thisYear'|trans({}, 'daterangepicker') }}',
|
||||
'customRange': '{{ 'daterangepicker.customRange'|trans({}, 'daterangepicker') }}',
|
||||
'timesheet.stop.success': '{{ 'timesheet.stop.success'|trans({}, 'flashmessages') }}',
|
||||
'timesheet.stop.error': '{{ 'timesheet.stop.error'|trans({}, 'flashmessages') }}',
|
||||
'action.update.success': '{{ 'action.update.success'|trans({}, 'flashmessages') }}',
|
||||
'action.update.error': '{{ 'action.update.error'|trans({}, 'flashmessages') }}',
|
||||
'action.delete.success': '{{ 'action.delete.success'|trans({}, 'flashmessages') }}',
|
||||
'action.delete.error': '{{ 'action.delete.error'|trans({}, 'flashmessages') }}'
|
||||
'action.delete.error': '{{ 'action.delete.error'|trans({}, 'flashmessages') }}',
|
||||
'confirm.delete': '{{ 'confirm.delete' |trans }}',
|
||||
'delete': '{{ 'action.delete' |trans }}'
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
'<li>' + '{{ 'label.customer'|trans }}: ' + eventObj.customer + '</li>' +
|
||||
'<li>' + '{{ 'label.project'|trans }}: ' + eventObj.project + '</li>' +
|
||||
'<li>' + '{{ 'label.activity'|trans }}: ' + eventObj.activity + '</li>' +
|
||||
(eventObj.tags !== null && eventObj.tags.length > 0 ? '<li>' + '{{ 'label.tags'|trans }}: ' + eventObj.tags + '</li>' : '') +
|
||||
'</ul>' +
|
||||
(eventObj.description ? '<hr><p>' + eventObj.description + '</p>' : '') +
|
||||
'</div>'
|
||||
|
||||
@@ -18,4 +18,4 @@
|
||||
|
||||
{{ block('form_widget_simple') }}
|
||||
</div>
|
||||
{% endblock daterange_widget %}
|
||||
{% endblock daterange_widget %}
|
||||
@@ -316,7 +316,7 @@
|
||||
|
||||
{% set actions = {'home': {'url': plugin.metadata.homepage, 'target': '_blank'}} %}
|
||||
|
||||
{% set event = trigger('actions.plugin', {'actions': actions, 'view': view}) %}
|
||||
{% set event = trigger('actions.plugin', {'actions': actions, 'view': view, 'plugin': plugin}) %}
|
||||
{% if view == 'index' %}
|
||||
{{ widgets.table_actions(event.payload.actions) }}
|
||||
{% else %}
|
||||
@@ -335,3 +335,28 @@
|
||||
{% set event = trigger('actions.about', {'actions': actions, 'view': view}) %}
|
||||
{{ widgets.page_actions(event.payload.actions) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro tags(view) %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% set actions = {'filter': '#collapseTags'} %}
|
||||
|
||||
{% set event = trigger('actions.tags', {'actions': actions, 'view': view}) %}
|
||||
{{ widgets.page_actions(event.payload.actions) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro tag(tag, view) %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
|
||||
{% set actions = {} %}
|
||||
|
||||
{% if is_granted('view_other_timesheet') %}
|
||||
{% set actions = actions|merge({'timesheet': path('admin_timesheet', {'tags': tag.name})}) %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('delete_tag') %}
|
||||
{% set actions = actions|merge({'trash': {'url': path('delete_tag', {'id' : tag.id}), 'class': 'api-link', 'attr': {'data-event': 'kimai.tagDelete kimai.tagUpdate', 'data-method': 'DELETE', 'data-question': 'confirm.delete', 'data-msg-error': 'action.delete.error', 'data-msg-success': 'action.delete.success'}}}) %}
|
||||
{% endif %}
|
||||
|
||||
{% set event = trigger('actions.tag', {'actions': actions, 'view': view, 'tag': tag}) %}
|
||||
{{ widgets.table_actions(event.payload.actions) }}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<tbody>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro data_table_footer(columns, route) %}
|
||||
{% macro data_table_footer(entries, route) %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -96,9 +96,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if route is not empty and columns is not null%}
|
||||
{% if route is not empty and entries is not null%}
|
||||
<div class="navigation text-center no-print">
|
||||
{{ pagerfanta(columns, 'twitter_bootstrap3_translated', { proximity: 1, routeName: route }) }}
|
||||
{{ pagerfanta(entries, 'twitter_bootstrap3_translated', { proximity: 1, routeName: route }) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -165,7 +165,9 @@
|
||||
{% set class = '' %}
|
||||
{% if icon == 'trash' %}
|
||||
{% set class = 'delete' %}
|
||||
{% if actions|length > 1 %}
|
||||
<li class="divider"></li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<li class="{{ class }}">
|
||||
{% if values is iterable %}
|
||||
@@ -275,3 +277,10 @@
|
||||
{{ macro.icon(icon) }}
|
||||
</a>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro tag_list(taglist) %}
|
||||
{% import _self as macro %}
|
||||
{% for tag in taglist %}
|
||||
{{ macro.badge(tag.name , 'green') }}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{{ tables.data_table_footer(null, 'admin_timesheet_paginated') }}
|
||||
{{ tables.data_table_footer(plugins) }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
48
templates/tags/index.html.twig
Normal file
48
templates/tags/index.html.twig
Normal file
@@ -0,0 +1,48 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% import "macros/actions.html.twig" as actions %}
|
||||
{% import "macros/datatables.html.twig" as tables %}
|
||||
{% import "macros/toolbar.html.twig" as toolbar %}
|
||||
|
||||
{% block page_title %}{{ 'tags.title'|trans({}, 'tags') }}{% endblock %}
|
||||
{% block page_subtitle %}{{ 'tags.subtitle'|trans({}, 'tags') }}{% endblock %}
|
||||
{% block page_actions %}{{ actions.tags('index') }}{% endblock %}
|
||||
|
||||
{% block main_before %}
|
||||
{{ toolbar.toolbar(toolbarForm, 'collapseTags', showFilter) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
|
||||
{% if tags|length == 0 %}
|
||||
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
||||
{% else %}
|
||||
|
||||
{% set columns = {
|
||||
'name': '',
|
||||
'amount': '',
|
||||
'actions': 'actions alwaysVisible',
|
||||
} %}
|
||||
|
||||
{% set tableName = 'admin_tags' %}
|
||||
|
||||
{{ tables.data_table_header(tableName, columns, false, 'kimai.tagUpdate') }}
|
||||
{% for tag in tags %}
|
||||
{% set type = 'primary' %}
|
||||
{% if tag.amount == 0 %}
|
||||
{% set type = 'warning' %}
|
||||
{% endif %}
|
||||
|
||||
<tr>
|
||||
<td>{{ tag.name }}</td>
|
||||
<td>{{ widgets.label(tag.amount, type) }}</td>
|
||||
<td class="actions">
|
||||
{{ actions.tag(tag, 'index') }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{{ tables.data_table_footer(tags, 'tags_paginated') }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -21,6 +21,7 @@
|
||||
'activity': 'hidden-xs hidden-sm',
|
||||
'username': 'hidden-xs',
|
||||
'description': 'hidden-xs hidden-sm',
|
||||
'tags': 'hidden-xs hidden-sm',
|
||||
'actions': 'actions alwaysVisible',
|
||||
}) %}
|
||||
|
||||
@@ -83,6 +84,7 @@
|
||||
{{ widgets.label_user(entry.user) }}
|
||||
</td>
|
||||
<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') }}
|
||||
</td>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
'project': 'hidden-xs hidden-sm hidden-md',
|
||||
'activity': 'hidden-xs hidden-sm',
|
||||
'description': 'hidden-xs hidden-sm',
|
||||
'tags': 'hidden-xs hidden-sm',
|
||||
'actions': 'actions alwaysVisible',
|
||||
}) %}
|
||||
|
||||
@@ -89,6 +90,7 @@
|
||||
<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 class="{{ tables.data_table_column_class(tableName, columns, 'tags') }}">{{ widgets.tag_list(entry.tags) }}</td>
|
||||
<td class="actions">
|
||||
{{- actions.timesheet(entry, 'index') -}}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user