timesheet export (#317)

* remove autocomplete for begin and end
* fix minute display in timesheet-edit form
* toolbar form label in separate row
* added export action
This commit is contained in:
Kevin Papst
2018-09-24 16:46:10 +02:00
committed by GitHub
parent 7bcd6a6382
commit 98dc38ed99
29 changed files with 422 additions and 95 deletions

View File

@@ -94,7 +94,7 @@
{# we do not call parent() as we use a custom built for the frontend assets and don't want the default <script> #}
<script type="text/javascript">
$(document).ready(function () {
$.kimai.init({imagePath: '{{ asset('images') }}', confirmDelete: '{{ 'confirm.delete'|trans }}'});
$.kimai.init({confirmDelete: '{{ 'confirm.delete'|trans }}'});
//$.kimai.pauseRecord('li.messages-menu ul.menu li');
});
</script>

View File

@@ -23,5 +23,3 @@
})|raw }}
{% endif %}
{% endblock %}
{#% block form_label %}{% endblock %#}

View File

@@ -37,6 +37,7 @@
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="text/javascript">
$(document).ready(function () {
$( "#print-invoice-button" ).click(function() {

View File

@@ -10,6 +10,9 @@
{% elseif '#modal' in url %}
data-toggle="modal" data-target="{{ url }}"
{% endif %}
{% if 'onclick:' in url %}
onclick="{{ url|replace({'onclick:': ''}) }}"
{% endif %}
><i class="{{ icon|icon(icon) }}"></i></a>
{% endfor -%}
</div>

View File

@@ -0,0 +1,70 @@
{% import "macros/widgets.html.twig" as widgets %}
{% extends 'invoice/layout.html.twig' %}
{% block invoice %}
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
<span contenteditable="true">
{% if query.begin is not empty and query.end is not empty %}
{% if query.begin|date('m') != query.end|date('m') or query.begin|date('Y') != query.end|date('Y') %}
{{ query.begin|date_short }} - {{ query.end|date_short }}:
{% elseif query.end is not empty %}
{{ query.end|month_name|trans }} {{ query.end|date('Y') }}:
{% elseif query.begin is not empty %}
{{ query.begin|month_name|trans }} {{ query.begin|date('Y') }}:
{% endif %}
{% endif %}
{{ widgets.username(query.user) }}
</span>
</h2>
</div>
</div>
<div class="row">
<div class="col-xs-12 table-responsive">
<table class="table">
<thead>
<tr>
<th>{{ 'label.date'|trans }}</th>
<th>{{ 'label.description'|trans }}</th>
<th>{{ 'label.hours'|trans }}</th>
</tr>
</thead>
<tbody>
{% set timeWorked = 0 %}
{% for entry in entries %}
{% set timeWorked = timeWorked + entry.duration %}
<tr>
<td>{{ entry.begin|date_short }}</td>
<td>
{% if entry.description is not empty %}
<div>
{{ entry.description|desc2html }}
</div>
{% endif %}
<span class="small">
{{ 'label.activity'|trans }}: {{ entry.activity.name }} |
{{ 'label.project'|trans }}: {{ entry.activity.project.name }} |
{{ 'label.customer'|trans }}: {{ entry.activity.project.customer.name }}
</span>
</td>
<td>{{ entry.duration|duration }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th></th>
<th>{{ 'invoice.total_working_time'|trans }}</th>
<th>{{ timeWorked|duration }}</th>
</tr>
</tfoot>
</table>
</div>
</div>
{% endblock %}
{% block print_button %}{% endblock %}

View File

@@ -5,7 +5,7 @@
{% block page_title %}{{ 'timesheet.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'timesheet.subtitle'|trans }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseTimesheet', 'visibility': '#modal_timesheet', 'calendar': path('calendar'), 'create': path('timesheet_create')}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseTimesheet', 'download': 'onclick:return exportTimesheet()', 'visibility': '#modal_timesheet', 'calendar': path('calendar'), 'create': path('timesheet_create')}) }}{% endblock %}
{% block main_before %}
{{ toolbar.toolbar(toolbarForm, 'collapseTimesheet') }}
@@ -81,3 +81,17 @@
{{ tables.data_table_footer(entries, 'timesheet_paginated') }}
{% 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('timesheet_export') }}');
form.submit();
form.removeAttr('target').attr('action', prevAction);
return false;
}
</script>
{% endblock %}