invoices: choose language and duration format (#1438)

This commit is contained in:
Kevin Papst
2020-02-04 20:27:36 +01:00
committed by GitHub
parent 75dcae6fbe
commit 986d922855
64 changed files with 1559 additions and 541 deletions

View File

@@ -1,11 +1,13 @@
{% import "macros/widgets.html.twig" as widgets %}
{% extends 'invoice/layout.html.twig' %}
{% set language = model.template.language|default(app.request.locale) %}
{% set isDecimal = model.template.decimalDuration|default(false) %}
{% block invoice %}
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
<span contenteditable="true">{{ model.template.title|default('timesheet'|trans({}, 'invoice-renderer')) }}</span>
<span contenteditable="true">{{ model.template.title }}</span>
</h2>
</div>
</div>
@@ -14,7 +16,7 @@
<div class="col-xs-12">
<table class="table no-border table-condensed">
<tr>
<th>{{ 'invoice.from'|trans }}</th>
<th>{{ 'invoice.from'|trans({}, 'messages', language) }}</th>
<td contenteditable="true">
{% if model.query.user is not empty %}
{{ widgets.username(model.query.user) }}
@@ -24,17 +26,17 @@
</td>
</tr>
<tr>
<th>{{ 'label.date'|trans }}</th>
<th>{{ 'label.date'|trans({}, 'messages', language) }}</th>
<td contenteditable="true">
{% if model.query.begin|date('m') != model.query.end|date('m') or model.query.begin|date('Y') != model.query.end|date('Y') %}
{{ model.query.begin|date_short }} - {{ model.query.end|date_short }}
{% else %}
{{ model.query.end|month_name|trans }} {{ model.query.end|date('Y') }}
{{ model.query.end|month_name|trans({}, 'messages', language) }} {{ model.query.end|date('Y') }}
{% endif %}
</td>
</tr>
<tr>
<th>{{ 'label.customer'|trans }}</th>
<th>{{ 'label.customer'|trans({}, 'messages', language) }}</th>
<td contenteditable="true">
{% if model.customer.number is not empty %}[{{ model.customer.number }}]{% endif %}
{{ model.customer.name }}{% if model.customer.contact is not empty %} / {{ model.customer.contact }}{% endif %}
@@ -42,7 +44,7 @@
</tr>
{% if model.query.project is not empty and model.query.project.orderNumber is not empty %}
<tr>
<th>{{ 'label.orderNumber'|trans }}</th>
<th>{{ 'label.orderNumber'|trans({}, 'messages', language) }}</th>
<td contenteditable="true">
{{ model.query.project.orderNumber }}
</td>
@@ -57,12 +59,12 @@
<table class="table table-striped">
<thead>
<tr>
<th>{{ 'label.date'|trans }}</th>
<th>{{ 'label.date'|trans({}, 'messages', language) }}</th>
{% if model.query.user is empty %}
<th>{{ 'label.user'|trans }}</th>
<th>{{ 'label.user'|trans({}, 'messages', language) }}</th>
{% endif %}
<th>{{ 'label.activity'|trans }}</th>
<th>{{ 'label.hours'|trans }}</th>
<th>{{ 'label.activity'|trans({}, 'messages', language) }}</th>
<th>{{ 'label.hours'|trans({}, 'messages', language) }}</th>
</tr>
</thead>
<tbody>
@@ -79,7 +81,7 @@
{% if entry.activity is not null %}{{ entry.activity.name }} / {% endif %}{{ entry.project.name }}
{% endif %}
</td>
<td>{{ entry.duration|duration }}</td>
<td>{{ entry.duration|duration(isDecimal) }}</td>
</tr>
{% endfor %}
</tbody>
@@ -89,8 +91,8 @@
{% if model.query.user is empty %}
<th></th>
{% endif %}
<th>{{ 'invoice.total_working_time'|trans }}</th>
<th>{{ model.calculator.timeWorked|duration }}</th>
<th>{{ 'invoice.total_working_time'|trans({}, 'messages', language) }}</th>
<th>{{ model.calculator.timeWorked|duration(isDecimal) }}</th>
</tr>
</tfoot>
</table>
@@ -100,7 +102,7 @@
<div class="row">
<div class="col-xs-12">
{% if model.template.paymentTerms is not empty %}
<p class="lead">{{ 'label.payment_terms'|trans }}</p>
<p class="lead">{{ 'label.payment_terms'|trans({}, 'messages', language) }}</p>
<p class="text-muted well well-sm no-shadow" contenteditable="true" style="margin-bottom: 100px">
{{ model.template.paymentTerms|trim|nl2br }}
@@ -111,10 +113,10 @@
<table class="table">
<tbody>
<tr>
<th style="padding-bottom: 60px">{{ 'invoice.signature_user'|trans }}</th>
<th style="padding-bottom: 60px">{{ 'invoice.signature_user'|trans({}, 'messages', language) }}</th>
</tr>
<tr>
<th>{{ 'invoice.signature_customer'|trans }}</th>
<th>{{ 'invoice.signature_customer'|trans({}, 'messages', language) }}</th>
</tr>
</tbody>
</table>