Files
kimai2/templates/invoice/preview.html.twig
Kevin Papst 53f82a808b improved invoices with new renderer (#306)
* added docx renderer and demo template
* added csv renderer and demo template
* added xlsx renderer and demo template
* added ods renderer and demo template
* added user calculator
* added invoice documentation
2018-09-21 01:27:56 +02:00

53 lines
2.4 KiB
Twig

{% import "macros/widgets.html.twig" as widgets %}
{{ widgets.callout('success', 'invoice.preview') }}
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ 'label.date'|trans }}</th>
<th class="hidden-xs hidden-sm">{{ 'label.user'|trans }}</th>
<th class="hidden-xs hidden-sm">{{ 'label.activity'|trans }}</th>
<th class="text-center">{{ 'invoice.unit_price'|trans }}</th>
<th class="text-center">{{ 'invoice.amount'|trans }}</th>
<th class="text-right">{{ 'invoice.total_rate'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entry in model.calculator.entries %}
{% set duration = entry.duration|duration() %}
{% if entry.fixedRate is not null %}
{% set rate = entry.fixedRate %}
{% set duration = 1 %}
{% elseif entry.hourlyRate is not null %}
{% set rate = entry.hourlyRate %}
{% else %}
{% set rate = app.user.getPreferenceValue('hourly_rate') %}
{% endif %}
<tr>
<td>{{ entry.begin|date_short }}</td>
<td class="hidden-xs hidden-sm">{{ widgets.username(entry.user) }}</td>
<td class="hidden-xs hidden-sm timesheet-description">
{% if entry.description is not empty %}
{{ entry.description|desc2html }}
{% else %}
{{ entry.activity.name }} / {{ entry.activity.project.name }}
{% endif %}
</td>
<td class="text-center" contenteditable="true">
{{ rate|money(model.calculator.currency) }}
</td>
<td class="text-center">
{{ duration }}
</td>
<td class="text-right">{{ entry.rate|money(model.calculator.currency) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>