mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Updates for templates to check for valid data prior to iterating
This commit is contained in:
parent
2837c008ab
commit
12775c1efe
@ -180,7 +180,9 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- If you are using this template for other entities such as quotes, you'll want to ensure that you change the variable from invoices => quotes here -->
|
||||
<ninja>
|
||||
{% if invoices is defined and invoices is not empty %}
|
||||
{% set invoice = invoices|first %}
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
<thead class="table-header">
|
||||
@ -204,6 +206,7 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</ninja>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
|
@ -170,7 +170,9 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- If you are using this template for other entities such as quotes, you'll want to ensure that you change the variable from invoices => quotes here -->
|
||||
<ninja>
|
||||
{% if invoices is defined and invoices is not empty %}
|
||||
{% set invoice = invoices|first %}
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
<thead class="table-header">
|
||||
@ -190,6 +192,7 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</ninja>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
|
@ -203,31 +203,36 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<!-- If you are using this template for other entities such as quotes, you'll want to ensure that you change the variable from invoices => quotes here -->
|
||||
<ninja>
|
||||
{% set invoice = invoices|first %}
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
<thead class="table-header">
|
||||
<tr class="table-header primary-color-highlight">
|
||||
<th class="">$item_label #</th>
|
||||
<th class="" width="50%">$description_label</th>
|
||||
<th class="centered">$quantity_label</th>
|
||||
<!-- <th class="totals-row-label centered">Delivered</th>
|
||||
<th class="totals-row-label centered">Backorder</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-body">
|
||||
{% for item in invoice.line_items|filter(item => item.type_id == 1) %}
|
||||
<tr class="item-row">
|
||||
<td class="">{{ item.product_key }}</td>
|
||||
<td class="">{{ item.notes }}</td>
|
||||
<td class="centered">{{ item.quantity }}</td>
|
||||
<!-- <td class="totals-row-label centered">{{ item.quantity }}</td>
|
||||
<td class="totals-row-label centered">{{ item.quantity - item.quantity }}</td> -->
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if invoices is defined and invoices is not empty %}
|
||||
|
||||
{% set invoice = invoices|first %}
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
<thead class="table-header">
|
||||
<tr class="table-header primary-color-highlight">
|
||||
<th class="">$item_label #</th>
|
||||
<th class="" width="50%">$description_label</th>
|
||||
<th class="centered">$quantity_label</th>
|
||||
<!-- <th class="totals-row-label centered">Delivered</th>
|
||||
<th class="totals-row-label centered">Backorder</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-body">
|
||||
{% for item in invoice.line_items|filter(item => item.type_id == 1) %}
|
||||
<tr class="item-row">
|
||||
<td class="">{{ item.product_key }}</td>
|
||||
<td class="">{{ item.notes }}</td>
|
||||
<td class="centered">{{ item.quantity }}</td>
|
||||
<!-- <td class="totals-row-label centered">{{ item.quantity }}</td>
|
||||
<td class="totals-row-label centered">{{ item.quantity - item.quantity }}</td> -->
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endif %}
|
||||
</ninja>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
|
@ -206,30 +206,35 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- If you are using this template for other entities such as quotes, you'll want to ensure that you change the variable from invoices => quotes here -->
|
||||
<ninja>
|
||||
{% set invoice = invoices|first %}
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
<thead class="table-header">
|
||||
<tr class="table-header primary-color-highlight">
|
||||
<th class="">$item_label #</th>
|
||||
<th class="" width="50%">$description_label</th>
|
||||
<th class="centered">$quantity_label</th>
|
||||
<!-- <th class="totals-row-label centered">Delivered</th>
|
||||
<th class="totals-row-label centered">Backorder</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-body">
|
||||
{% for item in invoice.line_items|filter(item => item.type_id == 1) %}
|
||||
<tr class="item-row">
|
||||
<td class="">{{ item.product_key }}</td>
|
||||
<td class="">{{ item.notes }}</td>
|
||||
<td class="centered">{{ item.quantity }}</td>
|
||||
<!-- <td class="totals-row-label centered">{{ item.quantity }}</td>
|
||||
<td class="totals-row-label centered">{{ item.quantity - item.quantity }}</td> -->
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if invoices is defined and invoices is not empty %}
|
||||
|
||||
{% set invoice = invoices|first %}
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
<thead class="table-header">
|
||||
<tr class="table-header primary-color-highlight">
|
||||
<th class="">$item_label #</th>
|
||||
<th class="" width="50%">$description_label</th>
|
||||
<th class="centered">$quantity_label</th>
|
||||
<!-- <th class="totals-row-label centered">Delivered</th>
|
||||
<th class="totals-row-label centered">Backorder</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-body">
|
||||
{% for item in invoice.line_items|filter(item => item.type_id == 1) %}
|
||||
<tr class="item-row">
|
||||
<td class="">{{ item.product_key }}</td>
|
||||
<td class="">{{ item.notes }}</td>
|
||||
<td class="centered">{{ item.quantity }}</td>
|
||||
<!-- <td class="totals-row-label centered">{{ item.quantity }}</td>
|
||||
<td class="totals-row-label centered">{{ item.quantity - item.quantity }}</td> -->
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endif %}
|
||||
</ninja>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
|
@ -208,9 +208,9 @@
|
||||
style="border:0;border-collapse:collapse;margin:0;padding:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;vertical-align:middle;color:#525f7f;font-size:15px;line-height:24px;white-space:nowrap">
|
||||
<span>
|
||||
<ninja>
|
||||
{% set payment = payments|first %}
|
||||
{% if payment %}
|
||||
{{ payment.method }}
|
||||
{% if payments is defined and payments is not empty %}
|
||||
{% set payment = payments|first %}
|
||||
{{ payment.method }}
|
||||
{% endif %}
|
||||
</ninja>
|
||||
</span>
|
||||
@ -303,9 +303,9 @@
|
||||
</tr>
|
||||
<ninja>
|
||||
{% set totalPrice = 0 %}
|
||||
{% for payment in payments %}
|
||||
{% for pivot in payment.paymentables|filter(pivot =>
|
||||
pivot.is_credit == '0') %}
|
||||
{% if payments is defined and payments is not empty %}
|
||||
{% for payment in payments %}
|
||||
{% for pivot in payment.paymentables|filter(pivot => pivot.is_credit == '0') %}
|
||||
<tr>
|
||||
<td
|
||||
style="border:0;border-collapse:collapse;margin:0;padding:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;vertical-align:middle;color:#8898aa;font-size:12px;line-height:16px;font-weight:bold;text-transform:uppercase">
|
||||
@ -375,7 +375,7 @@
|
||||
|
||||
{% set totalPrice = totalPrice + pivot.amount_raw %}
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
<tr>
|
||||
@ -396,6 +396,8 @@
|
||||
style="border:0;border-collapse:collapse;margin:0;padding:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;vertical-align:middle;color:#525f7f;font-size:15px;line-height:24px;font-weight:bold">
|
||||
${{ totalPrice|format_currency(currency_code) }}
|
||||
<td>
|
||||
|
||||
{% endif %}
|
||||
</ninja>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -108,9 +108,11 @@
|
||||
<h4 class="italic" style="margin-bottom:0.5rem;">$to_label</h3>
|
||||
<p style="margin-bottom:0.5rem;">$client.name</p>
|
||||
<ninja>
|
||||
{% set payment = payments|first %}
|
||||
{% if payment.client.vat_number %}
|
||||
<p>$vat_number_label: $vat_number</p>
|
||||
{% if payments is defined and payments is not empty %}
|
||||
{% set payment = payments|first %}
|
||||
{% if payment.client.vat_number %}
|
||||
<p>$vat_number_label: $vat_number</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ninja>
|
||||
</div>
|
||||
@ -129,23 +131,23 @@
|
||||
</div>
|
||||
|
||||
<ninja>
|
||||
{% if payments|e %}
|
||||
{% for payment in payments %}
|
||||
<div class="four-col-grid bottom-border" style="padding:2px;">
|
||||
<div>
|
||||
<p class="primary-color-highlight">#{{ payment.number }}</p>
|
||||
{% if payments is defined and payments is not empty %}
|
||||
{% for payment in payments %}
|
||||
<div class="four-col-grid bottom-border" style="padding:2px;">
|
||||
<div>
|
||||
<p class="primary-color-highlight">#{{ payment.number }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ payment.date }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ payment.method }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ payment.amount }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ payment.date }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ payment.method }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ payment.amount }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ninja>
|
||||
|
||||
|
@ -96,8 +96,9 @@
|
||||
<div class="two-col-grid" style="">
|
||||
<div class="pull-left">
|
||||
<ninja>
|
||||
<h1 class="primary-color-highlight" style="margin-top:0; margin-bottom:0rem;">$refund_label {% if
|
||||
payments|length == 1%}#$number {% endif %}</h2>
|
||||
{% if payments is defined and payments is not empty %}
|
||||
<h1 class="primary-color-highlight" style="margin-top:0; margin-bottom:0rem;">$refund_label {% if payments|length == 1%}#$number {% endif %}</h2>
|
||||
{% endif %}
|
||||
</ninja>
|
||||
</div>
|
||||
<div class="pull-right"><img src="$company.logo" class="company-logo"></div>
|
||||
@ -108,9 +109,11 @@
|
||||
<h4 class="italic" style="margin-bottom:0.5rem;">$to_label</h3>
|
||||
<p style="margin-bottom:0.5rem;">$client.name</p>
|
||||
<ninja>
|
||||
{% set payment = payments|first %}
|
||||
{% if payment.client.vat_number %}
|
||||
<p>$vat_number_label: $vat_number</p>
|
||||
{% if payments is defined and payments is not empty %}
|
||||
{% set payment = payments|first %}
|
||||
{% if payment.client.vat_number %}
|
||||
<p>$vat_number_label: $vat_number</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ninja>
|
||||
</div>
|
||||
@ -123,7 +126,7 @@
|
||||
<div class="" style="margin-top:20px;">
|
||||
|
||||
<ninja>
|
||||
{% if payments|e %}
|
||||
{% if payments is defined and payments is not empty %}
|
||||
{% set totalInvoices = 0 %}
|
||||
{% set totalRefunds = 0 %}
|
||||
{% for payment in payments %}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
<body>
|
||||
<ninja>
|
||||
{% if payments is defined and payments is not empty %}
|
||||
{%set payment = payments|first %}
|
||||
{%set pivot = payment.paymentables|filter(pivot => pivot.refunded_raw > 0)|first %}
|
||||
<table align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="600"
|
||||
@ -522,6 +523,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</ninja>
|
||||
</body>
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<ninja>
|
||||
{% if projects|e %}
|
||||
{% if projects is defined and projects is not empty %}
|
||||
{% for project in projects %}
|
||||
|
||||
<h1>{{ project.name }}</h1>
|
||||
|
@ -132,7 +132,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<ninja>
|
||||
{% if invoices|e %}
|
||||
{% if invoices is defined and invoices is not empty %}
|
||||
<div class="entity-container">
|
||||
<h2>Invoices<h2>
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
@ -162,7 +162,7 @@
|
||||
</ninja>
|
||||
|
||||
<ninja>
|
||||
{% if payments|e %}
|
||||
{% if payments is defined and payments is not empty %}
|
||||
<div class="entity-container">
|
||||
<h2>Payments<h2>
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
@ -194,7 +194,7 @@
|
||||
</ninja>
|
||||
|
||||
<ninja>
|
||||
{% if credits|e %}
|
||||
{% if credits is defined and credits is not empty %}
|
||||
<div class="entity-container">
|
||||
<h2>Credits<h2>
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
@ -222,7 +222,7 @@
|
||||
</ninja>
|
||||
|
||||
<ninja>
|
||||
{% if aging %}
|
||||
{% if aging is defined %}
|
||||
<div class="entity-container">
|
||||
<h2>Aging<h2>
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
|
@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<ninja>
|
||||
{% if invoices|e %}
|
||||
{% if invoices is defined and invoices is not empty %}
|
||||
<div id="entity-container">
|
||||
<h2>{{ t('invoices') }}<h2>
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
@ -189,7 +189,7 @@
|
||||
</ninja>
|
||||
|
||||
<ninja>
|
||||
{% if invoices|e and show_payments %}
|
||||
{% if invoices is defined and invoices is not empty and show_payments %}
|
||||
<div id="entity-container">
|
||||
<h2>{{ t('payments') }}<h2>
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
@ -270,7 +270,7 @@
|
||||
</ninja>
|
||||
|
||||
<ninja>
|
||||
{% if credits|e and show_credits %}
|
||||
{% if credits is defined and credits is not empty and show_credits %}
|
||||
<div id="entity-container">
|
||||
<h2>{{ t('credits') }}<h2>
|
||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
<body>
|
||||
<ninja>
|
||||
{% if tasks %}
|
||||
{% if tasks is defined and tasks is not empty %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
Loading…
Reference in New Issue
Block a user