javascript and api to stop and display active records (#772)
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
<li>jQuery UI: <a href="https://jqueryui.com" target="_blank">http://jqueryui.com</a></li>
|
||||
<li>MomentJS: <a href="https://momentjs.com" target="_blank">https://momentjs.com</a></li>
|
||||
<li>PHPOffice: <a href="https://github.com/PHPOffice" target="_blank">https://github.com/PHPOffice</a></li>
|
||||
<li>SweetAlert 2: <a href="https://sweetalert2.github.io" target="_blank">https://sweetalert2.github.io</a></li>
|
||||
<li>Symfony: <a href="https://symfony.com" target="_blank">https://symfony.com</a></li>
|
||||
<li>…</li>
|
||||
</ul>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
||||
{% else %}
|
||||
|
||||
{{ tables.data_table_header(tableName, columns) }}
|
||||
{{ tables.data_table_header(tableName, columns, false, 'kimai.activityUpdate') }}
|
||||
|
||||
{% for entry in entries %}
|
||||
<tr{% if is_granted('edit', entry) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_activity_edit', {'id': entry.id}) }}"{% endif %}>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
{% extends '@AdminLTE/layout/default-layout.html.twig' %}
|
||||
|
||||
{% block body_start %}
|
||||
data-title="{{- get_title() -}}"
|
||||
{% endblock %}
|
||||
|
||||
{% block after_body_start %}
|
||||
{% embed 'embeds/modal.html.twig' %}
|
||||
{% block modal_id %}remote_form_modal{% endblock %}
|
||||
@@ -188,7 +192,13 @@
|
||||
thisMonth: '{{ 'daterangepicker.thisMonth'|trans({}, 'daterangepicker') }}',
|
||||
lastYear: '{{ 'daterangepicker.lastYear'|trans({}, 'daterangepicker') }}',
|
||||
thisYear: '{{ 'daterangepicker.thisYear'|trans({}, 'daterangepicker') }}',
|
||||
customRange: '{{ 'daterangepicker.customRange'|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') }}'
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
{% if entries.count == 0 %}
|
||||
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
||||
{% else %}
|
||||
{{ tables.data_table_header(tableName, columns) }}
|
||||
{{ tables.data_table_header(tableName, columns, false, 'kimai.customerUpdate') }}
|
||||
|
||||
{% for entry in entries %}
|
||||
<tr{% if is_granted('edit', entry) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_customer_edit', {'id': entry.id}) }}"{% endif %}>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-{{ color|default(kimai_context.box_color) }}"><i class="{{ icon|icon(icon) }}"></i></span>
|
||||
<span class="info-box-icon bg-{{ color|default('green') }}"><i class="{{ icon|icon(icon) }}"></i></span>
|
||||
|
||||
<div class="info-box-content">
|
||||
{% if url %}<a href="{{ url }}" class="small-box-footer">{% endif %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="small-box bg-{{ color|default(kimai_context.box_color) }}">
|
||||
<div class="small-box bg-{{ color|default('green') }}">
|
||||
<div class="inner">
|
||||
<h3>{{ data }}<sup style="font-size: 20px">{{ unit|default('') }}</sup></h3>
|
||||
<p>{{ title|trans }}</p>
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
{% if is_granted('view_other_timesheet') %}
|
||||
{% set actions = actions|merge({'timesheet': path('admin_timesheet', {'customer': customer.id})}) %}
|
||||
{% endif %}
|
||||
{% if is_granted('create_project') and customer.visible %}
|
||||
{% if customer.visible and is_granted('create_project') %}
|
||||
{% set actions = actions|merge({'create-project': path('admin_project_create_with_customer', {'customer': customer.id})}) %}
|
||||
{% endif %}
|
||||
{% if view == 'index' and is_granted('delete', customer) %}
|
||||
@@ -215,7 +215,7 @@
|
||||
|
||||
{% if timesheet.id is not empty %}
|
||||
{% if not timesheet.end and is_granted('stop', timesheet) %}
|
||||
{% set actions = actions|merge({'stop': path('timesheet_stop', {'id' : timesheet.id})}) %}
|
||||
{% set actions = actions|merge({'stop': {'url': path('stop_timesheet', {'id' : timesheet.id}), 'class': 'api-link', 'attr': {'data-event': 'kimai.timesheetStop kimai.timesheetUpdate', 'data-method': 'PATCH', 'data-msg-error': 'timesheet.stop.error', 'data-msg-success': 'timesheet.stop.success'}}}) %}
|
||||
{% endif %}
|
||||
|
||||
{% if timesheet.end and is_granted('start', timesheet) %}
|
||||
@@ -270,7 +270,7 @@
|
||||
|
||||
{% if timesheet.id is not empty %}
|
||||
{% if not timesheet.end and is_granted('stop', timesheet) %}
|
||||
{% set actions = actions|merge({'stop': path('admin_timesheet_stop', {'id' : timesheet.id})}) %}
|
||||
{% set actions = actions|merge({'stop': {'url': path('stop_timesheet', {'id' : timesheet.id}), 'class': 'api-link', 'attr': {'data-event': 'kimai.timesheetStop kimai.timesheetUpdate', 'data-method': 'PATCH', 'data-msg-error': 'timesheet.stop.error', 'data-msg-success': 'timesheet.stop.success'}}}) %}
|
||||
{% endif %}
|
||||
|
||||
{% if timesheet.end and is_granted('start', timesheet) %}
|
||||
|
||||
@@ -70,14 +70,14 @@
|
||||
{% endspaceless %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro data_table_header(name, columns, skipStripped) %}
|
||||
{% macro data_table_header(name, columns, skipStripped, reloadEvent) %}
|
||||
{% import _self as macro %}
|
||||
<div class="box data_table" id="datatable_{{ name }}">
|
||||
<div class="box-body no-padding">
|
||||
<div class="dataTables_wrapper form-inline dt-bootstrap">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table class="table {% if not skipStripped %}table-striped {% endif %}table-hover dataTable" role="grid">
|
||||
<table class="table {% if not skipStripped %}table-striped {% endif %}table-hover dataTable" role="grid" data-reload-event="{{ reloadEvent }}">
|
||||
<thead>
|
||||
<tr>
|
||||
{%- for title, class in columns -%}
|
||||
@@ -96,7 +96,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if route is not empty %}
|
||||
{% if route is not empty and columns is not null%}
|
||||
<div class="navigation text-center no-print">
|
||||
{{ pagerfanta(columns, 'twitter_bootstrap3_translated', { proximity: 1, routeName: route }) }}
|
||||
</div>
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro info_box_progress(title, description, amount, percentage, icon, color) %}
|
||||
<div class="info-box bg-{{ color|default(kimai_context.box_color) }}">
|
||||
<div class="info-box bg-{{ color }}">
|
||||
<span class="info-box-icon"><i class="{{ icon|icon(icon) }}"></i></span>
|
||||
|
||||
<div class="info-box-content">
|
||||
@@ -192,6 +192,7 @@
|
||||
{% set target = null %}
|
||||
{% set title = null %}
|
||||
{% set disabled = false %}
|
||||
{% set attr = {} %}
|
||||
{% if type is same as (false) %}
|
||||
{% set class = "" %}
|
||||
{% elseif type is null %}
|
||||
@@ -223,6 +224,7 @@
|
||||
{% set id = values.id ?? null %}
|
||||
{% set title = values.title ?? null %}
|
||||
{% set class = class ~ ( values.class | default("")) %}
|
||||
{% set attr = values.attr ?? {} %}
|
||||
{% endif %}
|
||||
|
||||
{% if disabled is same as (true) %}
|
||||
@@ -248,6 +250,11 @@
|
||||
{%- if target is not empty -%}
|
||||
target="{{ target }}"
|
||||
{%- endif -%}
|
||||
{%- if attr is not empty -%}
|
||||
{%- for name, value in attr -%}
|
||||
{{ name }}="{{ value }}"
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
>{% if title is not null %}{{ title }}{% else %}{{ macro.icon(icon) }}{% endif %}</a>
|
||||
{% endfilter %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -1,48 +1,45 @@
|
||||
{% if entries is not empty %}
|
||||
<li class="dropdown messages-menu">
|
||||
<li class="dropdown messages-menu" style="{% if entries is empty %}display:none{% endif %}">
|
||||
<a href="#" class="dropdown-toggle ddt-large ticktac" data-toggle="dropdown">
|
||||
<i class="{{ 'start'|icon }} fa-2x"></i>
|
||||
<span class="label label-{% if entries|length > soft_limit %}danger{% elseif entries|length == soft_limit %}warning{% else %}primary{% endif %}">{{ entries|length }}</span>
|
||||
<span data-warning="{{ soft_limit }}" class="label label-{% if entries|length > soft_limit %}danger{% else %}warning{% endif %}">{% if entries|length > 0 %}{{ entries|length }}{% endif %}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown-menu"
|
||||
data-api="{{ path('active_timesheet') }}"
|
||||
data-href="{{ path('stop_timesheet', {'id' : '000'}) }}"
|
||||
data-icon="{{ 'stop-small'|icon }}"
|
||||
data-format="{{ get_format_duration() }}">
|
||||
<li class="header">
|
||||
{{ 'active.entries'|trans({'%count%':(entries|length)}) }}
|
||||
{{ 'active.entries'|trans }}
|
||||
</li>
|
||||
<li>
|
||||
{% if entries is not empty %}
|
||||
<ul class="menu">
|
||||
{% for entry in entries %}
|
||||
<li>
|
||||
<a href="{{ path('timesheet_stop', {'id' : entry.id}) }}">
|
||||
<div class="pull-left">
|
||||
<i class="{{ 'stop-small'|icon }} fa-2x"></i>
|
||||
</div>
|
||||
<h4>
|
||||
<span>{{ entry.activity.name }}</span>
|
||||
<small>
|
||||
<span data-title="true" data-since="{{ entry.begin.format(constant('DATE_ISO8601')) }}" data-format="{{ get_format_duration() }}">{{ entry|duration }}</span>
|
||||
</small>
|
||||
</h4>
|
||||
<p>{{ entry.project.name }} ({{ entry.project.customer.name }})</p>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="start_record">
|
||||
<a href="{{ path('timesheet_create') }}"><i class="{{ 'start'|icon }} fa-5x"></i></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<ul class="menu">
|
||||
{% for entry in entries %}
|
||||
<li>
|
||||
<a href="{{ path('stop_timesheet', {'id' : entry.id}) }}" class="api-link" data-event="kimai.timesheetStop kimai.timesheetUpdate" data-method="PATCH" data-msg-error="timesheet.stop.error" data-msg-success="timesheet.stop.success">
|
||||
<div class="pull-left">
|
||||
<i class="{{ 'stop-small'|icon }} fa-2x"></i>
|
||||
</div>
|
||||
<h4>
|
||||
<span>{{ entry.activity.name }}</span>
|
||||
<small>
|
||||
<span data-title="true" data-since="{{ entry.begin.format(constant('DATE_ISO8601')) }}" data-format="{{ get_format_duration() }}">{{ entry|duration }}</span>
|
||||
</small>
|
||||
</h4>
|
||||
<p>{{ entry.project.name }} ({{ entry.project.customer.name }})</p>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% if is_granted('create_own_timesheet') %}
|
||||
<li class="footer"><a href="{{ path('timesheet_create') }}">{{ 'timesheet.start'|trans }}</a></li>
|
||||
<li class="footer"><a href="{{ path('timesheet_create') }}" class="modal-ajax-form">{{ 'timesheet.start'|trans }}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
{% elseif is_granted('create_own_timesheet') %}
|
||||
<li class="messages-menu">
|
||||
<a href="{{ path('timesheet_create') }}" class="ddt-large">
|
||||
<i class="{{ 'start'|icon }} fa-2x"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% if is_granted('create_own_timesheet') %}
|
||||
<li class="messages-menu-empty" style="{% if entries is not empty %}display:none{% endif %}">
|
||||
<a href="{{ path('timesheet_create') }}" class="ddt-large modal-ajax-form">
|
||||
<i class="{{ 'start'|icon }} fa-2x"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
@@ -5,7 +5,7 @@
|
||||
</a>
|
||||
<ul class="dropdown-menu"
|
||||
data-api="{{ path('recent_timesheet', {'size' : 10}) }}"
|
||||
data-url="{{ path('timesheet_start', {'id' : '000'}) }}"
|
||||
data-href="{{ path('timesheet_start', {'id' : '000'}) }}"
|
||||
data-icon="{{ 'start-small'|icon }}"
|
||||
data-template="{{ 'recent.activities.format'|trans }}">
|
||||
<li class="header">{{ 'recent.activities'|trans }}</li>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% 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 %}
|
||||
|
||||
{% block page_title %}{{ 'plugins.title'|trans({}, 'plugins') }}{% endblock %}
|
||||
{% block page_subtitle %}{{ 'plugins.subtitle'|trans({}, 'plugins') }}{% endblock %}
|
||||
@@ -8,51 +9,42 @@
|
||||
|
||||
{% block main %}
|
||||
|
||||
{% if plugins|length == 0 %}
|
||||
{{ widgets.callout('warning', 'plugin.none_installed'|trans({}, 'plugins')) }}
|
||||
{% else %}
|
||||
<div class="box data_table" id="datatable_plugins">
|
||||
<div class="box-body no-padding">
|
||||
<div class="dataTables_wrapper form-inline dt-bootstrap">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-striped table-hover dataTable" role="grid">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ 'label.name'|trans }}</th>
|
||||
<th>{{ 'label.version'|trans({}, 'plugins') }}</th>
|
||||
<th class="hidden-xs">{{ 'label.description'|trans }}</th>
|
||||
<th class="hidden-xs hidden-sm">{{ 'label.required_version'|trans({}, 'plugins') }}</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for plugin in plugins %}
|
||||
<tr>
|
||||
<td>{{ plugin.name }}</td>
|
||||
<td>{{ widgets.label(plugin.metadata.version, 'primary') }}</td>
|
||||
<td class="hidden-xs">{{ plugin.metadata.description }}</td>
|
||||
<td class="hidden-xs hidden-sm">
|
||||
{% if plugin.metadata.kimaiVersion > constant('App\\Constants::VERSION') %}
|
||||
{{ widgets.label(plugin.metadata.kimaiVersion, 'danger') }}
|
||||
{% elseif plugin.metadata.kimaiVersion < constant('App\\Constants::VERSION') %}
|
||||
{{ widgets.label(plugin.metadata.kimaiVersion, 'warning') }}
|
||||
{% else %}
|
||||
{{ widgets.label(plugin.metadata.kimaiVersion, 'success') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ actions.plugin(plugin, 'index') }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if plugins|length == 0 %}
|
||||
{{ widgets.callout('warning', 'plugin.none_installed'|trans({}, 'plugins')) }}
|
||||
{% else %}
|
||||
|
||||
{% set columns = {
|
||||
'name': '',
|
||||
'version': '',
|
||||
'description': 'hidden-xs',
|
||||
'required_version': 'hidden-xs hidden-sm',
|
||||
'actions': 'actions alwaysVisible',
|
||||
} %}
|
||||
|
||||
{% set tableName = 'plugins' %}
|
||||
|
||||
{{ tables.data_table_header(tableName, columns) }}
|
||||
{% for plugin in plugins %}
|
||||
<tr>
|
||||
<td>{{ plugin.name }}</td>
|
||||
<td>{{ widgets.label(plugin.metadata.version, 'primary') }}</td>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }}">{{ plugin.metadata.description }}</td>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'required_version') }}">
|
||||
{% if plugin.metadata.kimaiVersion > constant('App\\Constants::VERSION') %}
|
||||
{{ widgets.label(plugin.metadata.kimaiVersion, 'danger') }}
|
||||
{% elseif plugin.metadata.kimaiVersion < constant('App\\Constants::VERSION') %}
|
||||
{{ widgets.label(plugin.metadata.kimaiVersion, 'warning') }}
|
||||
{% else %}
|
||||
{{ widgets.label(plugin.metadata.kimaiVersion, 'success') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="actions">
|
||||
{{ actions.plugin(plugin, 'index') }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{{ tables.data_table_footer(null, 'admin_timesheet_paginated') }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
{% if entries.count == 0 %}
|
||||
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
||||
{% else %}
|
||||
{{ tables.data_table_header(tableName, columns) }}
|
||||
{{ tables.data_table_header(tableName, columns, false, 'kimai.projectUpdate') }}
|
||||
|
||||
{% for entry in entries %}
|
||||
<tr{% if is_granted('edit', entry) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_project_edit', {'id': entry.id}) }}"{% endif %}>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
{% if entries.count == 0 %}
|
||||
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
||||
{% else %}
|
||||
{{ tables.data_table_header(tableName, columns) }}
|
||||
{{ tables.data_table_header(tableName, columns, false, 'kimai.timesheetUpdate') }}
|
||||
|
||||
{% for entry in entries %}
|
||||
<tr{% if is_granted('edit', entry) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_timesheet_edit', {'id': entry.id}) }}"{% endif %}>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
{% if entries.count == 0 %}
|
||||
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
||||
{% else %}
|
||||
{{ tables.data_table_header(tableName, columns, showSummary) }}
|
||||
{{ tables.data_table_header(tableName, columns, showSummary, 'kimai.timesheetUpdate') }}
|
||||
|
||||
{% set day = null %}
|
||||
{% set dayDuration = 0 %}
|
||||
|
||||
@@ -82,13 +82,13 @@
|
||||
{% endmacro %}
|
||||
|
||||
{# -------------------------------- UNUSED FOR NOW -------------------------------- #}
|
||||
{% macro profile_list_unused(user, items, color) %}
|
||||
{% macro profile_list_unused(user, items) %}
|
||||
{% import "@AdminLTE/Macros/default.html.twig" as macro %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
|
||||
<div class="box box-widget widget-user-2">
|
||||
<!-- Add the bg color to the header using any of the bg-* classes -->
|
||||
<div class="widget-user-header bg-{{ color|default(kimai_context.box_color) }}">
|
||||
<div class="widget-user-header bg-green">
|
||||
<div class="widget-user-image">
|
||||
{{ macro.avatar(user.avatar, user.username) }}
|
||||
</div>
|
||||
@@ -107,12 +107,12 @@
|
||||
{% endmacro %}
|
||||
|
||||
{# -------------------------------- UNUSED FOR NOW -------------------------------- #}
|
||||
{% macro profile_box_unused(user, stats, color) %}
|
||||
{% macro profile_box_unused(user, stats) %}
|
||||
{% import "@AdminLTE/Macros/default.html.twig" as macro %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
|
||||
<div class="box box-widget widget-user">
|
||||
<div class="widget-user-header bg-{{ color|default(kimai_context.box_color) }}">
|
||||
<div class="widget-user-header bg-green">
|
||||
<h3 class="widget-user-username">{{ widgets.username(user) }}</h3>
|
||||
<h5 class="widget-user-desc">{{ user.title }}</h5>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user