invoices: choose language and duration format (#1438)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<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">
|
||||
<title>{% block title %}{{ model.template.title }}{% endblock %}</title>
|
||||
<title>{% block title %}{{ model.numberGenerator.invoiceNumber }}-{{ model.customer.company|default(model.customer.name)|u.snake }}{% endblock %}</title>
|
||||
{{ encore_entry_link_tags('app') }}
|
||||
{{ encore_entry_script_tags('app') }}
|
||||
</head>
|
||||
|
||||
@@ -1,46 +1,47 @@
|
||||
{% 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 }}</span>
|
||||
<small class="pull-right">{{ 'label.date'|trans }}: {{ model.invoiceDate|date_short }}</small>
|
||||
<small class="pull-right">{{ 'label.date'|trans({}, 'messages', language) }}: {{ model.invoiceDate|date_short }}</small>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-5">
|
||||
{{ 'invoice.from'|trans }}
|
||||
{{ 'invoice.from'|trans({}, 'messages', language) }}
|
||||
<address contenteditable="true">
|
||||
<strong>{{ model.template.company }}</strong><br>
|
||||
{{ model.template.address|trim|nl2br }}
|
||||
{% if model.template.vatId is not empty %}
|
||||
<br>
|
||||
{{ 'label.vat_id'|trans }}:
|
||||
{{ 'label.vat_id'|trans({}, 'messages', language) }}:
|
||||
{{ model.template.vatId }}
|
||||
{% endif %}
|
||||
</address>
|
||||
</div>
|
||||
<div class="col-sm-2"></div>
|
||||
<div class="col-sm-5">
|
||||
{% set customerPhone = model.customer.phone|default(model.customer.mobile) %}
|
||||
{{ 'invoice.to'|trans }}
|
||||
{{ 'invoice.to'|trans({}, 'messages', language) }}
|
||||
<address contenteditable="true">
|
||||
<strong>{{ model.customer.company|default(model.customer.name) }}</strong><br>
|
||||
{{ model.customer.address|nl2br }}
|
||||
{% if model.customer.vatId is not empty %}
|
||||
<br>
|
||||
{{ 'label.vat_id'|trans }}: {{ model.customer.vatId }}
|
||||
{{ 'label.vat_id'|trans({}, 'messages', language) }}: {{ model.customer.vatId }}
|
||||
{% endif %}
|
||||
{% if model.customer.number is not empty %}
|
||||
<br>
|
||||
{{ 'label.number'|trans }}: {{ model.customer.number }}
|
||||
{{ 'label.number'|trans({}, 'messages', language) }}: {{ model.customer.number }}
|
||||
{% endif %}
|
||||
{% if model.query.project is not empty and model.query.project.orderNumber is not empty %}
|
||||
<br>
|
||||
{{ 'label.orderNumber'|trans }}: {{ model.query.project.orderNumber }}
|
||||
{{ 'label.orderNumber'|trans({}, 'messages', language) }}: {{ model.query.project.orderNumber }}
|
||||
{% endif %}
|
||||
</address>
|
||||
</div>
|
||||
@@ -49,11 +50,11 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-5">
|
||||
<p contenteditable="true">
|
||||
<strong>{{ 'invoice.number'|trans }}:</strong>
|
||||
<strong>{{ 'invoice.number'|trans({}, 'messages', language) }}:</strong>
|
||||
{{ model.numberGenerator.invoiceNumber }}
|
||||
|
||||
<br>
|
||||
<strong>{{ 'invoice.due_days'|trans }}:</strong>
|
||||
<strong>{{ 'invoice.due_days'|trans({}, 'messages', language) }}:</strong>
|
||||
{{ model.dueDate|date_short }}
|
||||
</p>
|
||||
</div>
|
||||
@@ -65,16 +66,16 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ 'label.date'|trans }}</th>
|
||||
<th>{{ 'label.description'|trans }}</th>
|
||||
<th class="text-right">{{ 'label.unit_price'|trans }}</th>
|
||||
<th class="text-right">{{ 'label.amount'|trans }}</th>
|
||||
<th class="text-right">{{ 'label.total_rate'|trans }}</th>
|
||||
<th>{{ 'label.date'|trans({}, 'messages', language) }}</th>
|
||||
<th>{{ 'label.description'|trans({}, 'messages', language) }}</th>
|
||||
<th class="text-right">{{ 'label.unit_price'|trans({}, 'messages', language) }}</th>
|
||||
<th class="text-right">{{ 'label.amount'|trans({}, 'messages', language) }}</th>
|
||||
<th class="text-right">{{ 'label.total_rate'|trans({}, 'messages', language) }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entry in model.calculator.entries %}
|
||||
{% set duration = entry.duration|duration_decimal %}
|
||||
{% set duration = entry.duration|duration(isDecimal) %}
|
||||
{% if entry.fixedRate %}
|
||||
{% set rate = entry.fixedRate %}
|
||||
{% set duration = entry.amount|amount %}
|
||||
@@ -99,19 +100,19 @@
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4" class="text-right">
|
||||
{{ 'invoice.subtotal'|trans }}
|
||||
{{ 'invoice.subtotal'|trans({}, 'messages', language) }}
|
||||
</td>
|
||||
<td class="text-right">{{ model.calculator.subtotal|money(model.calculator.currency) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="text-right">
|
||||
{{ 'invoice.tax'|trans }} ({{ model.calculator.vat }}%)
|
||||
{{ 'invoice.tax'|trans({}, 'messages', language) }} ({{ model.calculator.vat }}%)
|
||||
</td>
|
||||
<td class="text-right">{{ model.calculator.tax|money(model.calculator.currency) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="text-right text-nowrap">
|
||||
<strong>{{ 'invoice.total'|trans }}</strong>
|
||||
<strong>{{ 'invoice.total'|trans({}, 'messages', language) }}</strong>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<strong>{{ model.calculator.total|money(model.calculator.currency) }}</strong>
|
||||
@@ -134,11 +135,11 @@
|
||||
|
||||
<footer class="footer">
|
||||
<p>
|
||||
<strong>{{ 'label.address'|trans }}</strong>: {{ model.template.company }} – {{ model.template.address|replace({"\n": ' – ', "\r\n": ' – ', "\r": ' – '})|raw }}
|
||||
<strong>{{ 'label.address'|trans({}, 'messages', language) }}</strong>: {{ model.template.company }} – {{ model.template.address|replace({"\n": ' – ', "\r\n": ' – ', "\r": ' – '})|raw }}
|
||||
<br>
|
||||
<strong>{{ 'label.invoice_bank_account'|trans }}</strong>: {{ model.template.paymentDetails|replace({"\n": ' – ', "\r\n": ' – ', "\r": ' – '})|raw }}
|
||||
<strong>{{ 'label.invoice_bank_account'|trans({}, 'messages', language) }}</strong>: {{ model.template.paymentDetails|replace({"\n": ' – ', "\r\n": ' – ', "\r": ' – '})|raw }}
|
||||
<br>
|
||||
<strong>{{ 'label.contact'|trans }}</strong>: {{ model.template.contact|replace({"\n": ' – ', "\r\n": ' – ', "\r": ' – '})|raw }}
|
||||
<strong>{{ 'label.contact'|trans({}, 'messages', language) }}</strong>: {{ model.template.contact|replace({"\n": ' – ', "\r\n": ' – ', "\r": ' – '})|raw }}
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{% 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" id="freelancer-invoice">
|
||||
<div class="col-xs-12">
|
||||
<header>
|
||||
@@ -12,33 +12,33 @@
|
||||
</address>
|
||||
</header>
|
||||
<article class="address">
|
||||
<h1>{{ 'invoice.to'|trans }}</h1>
|
||||
<h1>{{ 'invoice.to'|trans({}, 'messages', language) }}</h1>
|
||||
<address>
|
||||
<p>
|
||||
<strong>{{ model.customer.company|default(model.customer.name) }}</strong><br>
|
||||
{{ model.customer.address|nl2br }}
|
||||
{% if model.customer.vatId is not empty %}
|
||||
<br>
|
||||
{{ 'label.vat_id'|trans }}: {{ model.customer.vatId }}
|
||||
{{ 'label.vat_id'|trans({}, 'messages', language) }}: {{ model.customer.vatId }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</address>
|
||||
<table class="meta">
|
||||
<tr>
|
||||
<th>{{ 'label.date'|trans }}:</th>
|
||||
<th>{{ 'label.date'|trans({}, 'messages', language) }}:</th>
|
||||
<td contenteditable="true">{{ model.invoiceDate|date_short }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ 'invoice.service_date'|trans }}:</th>
|
||||
<td><span contenteditable="true">{{ model.query.end|month_name|trans }} {{ model.query.end|date('Y') }}</td>
|
||||
<th>{{ 'invoice.service_date'|trans({}, 'messages', language) }}:</th>
|
||||
<td><span contenteditable="true">{{ model.query.end|month_name|trans({}, 'messages', language) }} {{ model.query.end|date('Y') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ 'invoice.number'|trans }}:</th>
|
||||
<th>{{ 'invoice.number'|trans({}, 'messages', language) }}:</th>
|
||||
<td><span contenteditable="true">{{ model.numberGenerator.invoiceNumber }}</td>
|
||||
</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>
|
||||
@@ -46,7 +46,7 @@
|
||||
{% endif %}
|
||||
{% if model.template.vatId is not empty %}
|
||||
<tr>
|
||||
<th>{{ 'label.vat_id'|trans }}:</th>
|
||||
<th>{{ 'label.vat_id'|trans({}, 'messages', language) }}:</th>
|
||||
<td>
|
||||
{{ model.template.vatId }}
|
||||
</td>
|
||||
@@ -55,22 +55,19 @@
|
||||
</table>
|
||||
</article>
|
||||
<article class="invoice-items">
|
||||
<h2>{{ model.template.title|default('timesheet'|trans({}, 'invoice-renderer')) }}</h2>
|
||||
<p contenteditable="true">
|
||||
{{ 'label.invoice_salutation'|trans|nl2br }}
|
||||
</p>
|
||||
<h2>{{ model.template.title }}</h2>
|
||||
<table class="inventory">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ 'label.description'|trans }}</th>
|
||||
<th class="text-right">{{ 'label.unit_price'|trans }}</th>
|
||||
<th class="text-right">{{ 'label.amount'|trans }}</th>
|
||||
<th class="text-right">{{ 'label.total_rate'|trans }}</th>
|
||||
<th>{{ 'label.description'|trans({}, 'messages', language) }}</th>
|
||||
<th class="text-right">{{ 'label.unit_price'|trans({}, 'messages', language) }}</th>
|
||||
<th class="text-right">{{ 'label.amount'|trans({}, 'messages', language) }}</th>
|
||||
<th class="text-right">{{ 'label.total_rate'|trans({}, 'messages', language) }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entry in model.calculator.entries %}
|
||||
{% set duration = entry.duration|duration %}
|
||||
{% set duration = entry.duration|duration(isDecimal) %}
|
||||
{% if entry.fixedRate is not null %}
|
||||
{% set rate = entry.fixedRate %}
|
||||
{% set duration = entry.amount|amount %}
|
||||
@@ -95,15 +92,15 @@
|
||||
</table>
|
||||
<table class="balance">
|
||||
<tr>
|
||||
<th>{{ 'invoice.subtotal'|trans }}</th>
|
||||
<th>{{ 'invoice.subtotal'|trans({}, 'messages', language) }}</th>
|
||||
<td>{{ model.calculator.subtotal|money(model.calculator.currency) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ 'invoice.tax'|trans }} ({{ model.calculator.vat }}%)</th>
|
||||
<th>{{ 'invoice.tax'|trans({}, 'messages', language) }} ({{ model.calculator.vat }}%)</th>
|
||||
<td>{{ model.calculator.tax|money(model.calculator.currency) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="total">{{ 'invoice.total'|trans }}</th>
|
||||
<th class="total">{{ 'invoice.total'|trans({}, 'messages', language) }}</th>
|
||||
<td class="total">{{ model.calculator.total|money(model.calculator.currency) }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -119,7 +116,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-4" contenteditable="true">
|
||||
<p>
|
||||
<strong>{{ 'label.address'|trans }}</strong>
|
||||
<strong>{{ 'label.address'|trans({}, 'messages', language) }}</strong>
|
||||
</p>
|
||||
<p>
|
||||
{{ model.template.company }}<br>
|
||||
@@ -128,7 +125,7 @@
|
||||
</div>
|
||||
<div class="col-sm-4 text-center" contenteditable="true">
|
||||
<p>
|
||||
<strong>{{ 'label.invoice_bank_account'|trans }}</strong>
|
||||
<strong>{{ 'label.invoice_bank_account'|trans({}, 'messages', language) }}</strong>
|
||||
</p>
|
||||
<p>
|
||||
{{ model.template.paymentDetails|nl2br }}
|
||||
@@ -136,7 +133,7 @@
|
||||
</div>
|
||||
<div class="col-sm-4 text-right" contenteditable="true">
|
||||
<p>
|
||||
<strong>{{ 'label.contact'|trans }}</strong>
|
||||
<strong>{{ 'label.contact'|trans({}, 'messages', language) }}</strong>
|
||||
</p>
|
||||
<p>
|
||||
{{ model.template.contact|nl2br }}
|
||||
@@ -146,5 +143,4 @@
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -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>
|
||||
|
||||
@@ -46,10 +46,22 @@
|
||||
{{ form_row(form.vat) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_row(form.renderer) }}
|
||||
{{ form_row(form.calculator) }}
|
||||
{{ form_row(form.numberGenerator) }}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ form_row(form.renderer) }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{{ form_row(form.language) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ form_row(form.calculator) }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{{ form_row(form.numberGenerator) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_widget(form) }}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
Reference in New Issue
Block a user