{% extends 'base.html.twig' %} {% import "macros/widgets.html.twig" as widgets %} {% import "macros/toolbar.html.twig" as toolbar %} {% import "macros/datatables.html.twig" as tables %} {% block page_title %}{{ 'invoice.title'|trans }}{% endblock %} {% block page_subtitle %}{{ 'invoice.subtitle'|trans }}{% endblock %} {% block page_actions %} {% set actions = {'filter': '#collapseInvoice'} %} {% if is_granted('create_invoice_template') %} {% set actions = actions|merge({'create': path('admin_invoice_template_create')}) %} {% endif %} {% if is_granted('view_invoice_template') %} {% set actions = actions|merge({'list': path('admin_invoice_template')}) %} {% endif %} {{ widgets.page_actions(actions) }} {% endblock %} {% block main_before %} {{ toolbar.toolbar(form, 'collapseInvoice', true) }} {% endblock %} {% block main_after %}
{% endblock %} {% block main %} {% set entries = {} %} {% if model.calculator is not empty and model.calculator.entries is not empty %} {% set entries = model.calculator.entries %} {% endif %} {% if entries is empty %} {{ widgets.callout('warning', 'error.no_entries_found') }} {% else %} {{ widgets.callout('success', 'invoice.preview') }} {% set columns = { 'date': '', 'user': 'hidden-xs hidden-sm', 'activity': 'hidden-xs hidden-sm', 'unit_price': 'text-center', 'amount': 'text-center', 'total_rate': 'text-right', } %} {% set tableName = 'invoice' %} {{ tables.data_table_header(tableName, columns) }} {% for entry in 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 = entry.user.preferenceValue('hourly_rate') %} {% endif %}