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>
|
</tr>
|
||||||
</table>
|
</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>
|
<ninja>
|
||||||
|
{% if invoices is defined and invoices is not empty %}
|
||||||
{% set invoice = invoices|first %}
|
{% set invoice = invoices|first %}
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
<thead class="table-header">
|
<thead class="table-header">
|
||||||
|
|
@ -204,6 +206,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</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>
|
<ninja>
|
||||||
|
{% if invoices is defined and invoices is not empty %}
|
||||||
{% set invoice = invoices|first %}
|
{% set invoice = invoices|first %}
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
<thead class="table-header">
|
<thead class="table-header">
|
||||||
|
|
@ -190,6 +192,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
|
||||||
|
|
@ -203,31 +203,36 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</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>
|
<ninja>
|
||||||
{% set invoice = invoices|first %}
|
{% if invoices is defined and invoices is not empty %}
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
|
||||||
<thead class="table-header">
|
{% set invoice = invoices|first %}
|
||||||
<tr class="table-header primary-color-highlight">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
<th class="">$item_label #</th>
|
<thead class="table-header">
|
||||||
<th class="" width="50%">$description_label</th>
|
<tr class="table-header primary-color-highlight">
|
||||||
<th class="centered">$quantity_label</th>
|
<th class="">$item_label #</th>
|
||||||
<!-- <th class="totals-row-label centered">Delivered</th>
|
<th class="" width="50%">$description_label</th>
|
||||||
<th class="totals-row-label centered">Backorder</th> -->
|
<th class="centered">$quantity_label</th>
|
||||||
</tr>
|
<!-- <th class="totals-row-label centered">Delivered</th>
|
||||||
</thead>
|
<th class="totals-row-label centered">Backorder</th> -->
|
||||||
<tbody class="table-body">
|
</tr>
|
||||||
{% for item in invoice.line_items|filter(item => item.type_id == 1) %}
|
</thead>
|
||||||
<tr class="item-row">
|
<tbody class="table-body">
|
||||||
<td class="">{{ item.product_key }}</td>
|
{% for item in invoice.line_items|filter(item => item.type_id == 1) %}
|
||||||
<td class="">{{ item.notes }}</td>
|
<tr class="item-row">
|
||||||
<td class="centered">{{ item.quantity }}</td>
|
<td class="">{{ item.product_key }}</td>
|
||||||
<!-- <td class="totals-row-label centered">{{ item.quantity }}</td>
|
<td class="">{{ item.notes }}</td>
|
||||||
<td class="totals-row-label centered">{{ item.quantity - item.quantity }}</td> -->
|
<td class="centered">{{ item.quantity }}</td>
|
||||||
</tr>
|
<!-- <td class="totals-row-label centered">{{ item.quantity }}</td>
|
||||||
{% endfor %}
|
<td class="totals-row-label centered">{{ item.quantity - item.quantity }}</td> -->
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
|
||||||
|
|
@ -206,30 +206,35 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</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>
|
<ninja>
|
||||||
{% set invoice = invoices|first %}
|
{% if invoices is defined and invoices is not empty %}
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
|
||||||
<thead class="table-header">
|
{% set invoice = invoices|first %}
|
||||||
<tr class="table-header primary-color-highlight">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
<th class="">$item_label #</th>
|
<thead class="table-header">
|
||||||
<th class="" width="50%">$description_label</th>
|
<tr class="table-header primary-color-highlight">
|
||||||
<th class="centered">$quantity_label</th>
|
<th class="">$item_label #</th>
|
||||||
<!-- <th class="totals-row-label centered">Delivered</th>
|
<th class="" width="50%">$description_label</th>
|
||||||
<th class="totals-row-label centered">Backorder</th> -->
|
<th class="centered">$quantity_label</th>
|
||||||
</tr>
|
<!-- <th class="totals-row-label centered">Delivered</th>
|
||||||
</thead>
|
<th class="totals-row-label centered">Backorder</th> -->
|
||||||
<tbody class="table-body">
|
</tr>
|
||||||
{% for item in invoice.line_items|filter(item => item.type_id == 1) %}
|
</thead>
|
||||||
<tr class="item-row">
|
<tbody class="table-body">
|
||||||
<td class="">{{ item.product_key }}</td>
|
{% for item in invoice.line_items|filter(item => item.type_id == 1) %}
|
||||||
<td class="">{{ item.notes }}</td>
|
<tr class="item-row">
|
||||||
<td class="centered">{{ item.quantity }}</td>
|
<td class="">{{ item.product_key }}</td>
|
||||||
<!-- <td class="totals-row-label centered">{{ item.quantity }}</td>
|
<td class="">{{ item.notes }}</td>
|
||||||
<td class="totals-row-label centered">{{ item.quantity - item.quantity }}</td> -->
|
<td class="centered">{{ item.quantity }}</td>
|
||||||
</tr>
|
<!-- <td class="totals-row-label centered">{{ item.quantity }}</td>
|
||||||
{% endfor %}
|
<td class="totals-row-label centered">{{ item.quantity - item.quantity }}</td> -->
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<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">
|
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>
|
<span>
|
||||||
<ninja>
|
<ninja>
|
||||||
{% set payment = payments|first %}
|
{% if payments is defined and payments is not empty %}
|
||||||
{% if payment %}
|
{% set payment = payments|first %}
|
||||||
{{ payment.method }}
|
{{ payment.method }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -303,9 +303,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
<ninja>
|
<ninja>
|
||||||
{% set totalPrice = 0 %}
|
{% set totalPrice = 0 %}
|
||||||
{% for payment in payments %}
|
{% if payments is defined and payments is not empty %}
|
||||||
{% for pivot in payment.paymentables|filter(pivot =>
|
{% for payment in payments %}
|
||||||
pivot.is_credit == '0') %}
|
{% for pivot in payment.paymentables|filter(pivot => pivot.is_credit == '0') %}
|
||||||
<tr>
|
<tr>
|
||||||
<td
|
<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">
|
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 %}
|
{% set totalPrice = totalPrice + pivot.amount_raw %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<tr>
|
<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">
|
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) }}
|
${{ totalPrice|format_currency(currency_code) }}
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
|
|
@ -108,9 +108,11 @@
|
||||||
<h4 class="italic" style="margin-bottom:0.5rem;">$to_label</h3>
|
<h4 class="italic" style="margin-bottom:0.5rem;">$to_label</h3>
|
||||||
<p style="margin-bottom:0.5rem;">$client.name</p>
|
<p style="margin-bottom:0.5rem;">$client.name</p>
|
||||||
<ninja>
|
<ninja>
|
||||||
{% set payment = payments|first %}
|
{% if payments is defined and payments is not empty %}
|
||||||
{% if payment.client.vat_number %}
|
{% set payment = payments|first %}
|
||||||
<p>$vat_number_label: $vat_number</p>
|
{% if payment.client.vat_number %}
|
||||||
|
<p>$vat_number_label: $vat_number</p>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -129,23 +131,23 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if payments|e %}
|
{% if payments is defined and payments is not empty %}
|
||||||
{% for payment in payments %}
|
{% for payment in payments %}
|
||||||
<div class="four-col-grid bottom-border" style="padding:2px;">
|
<div class="four-col-grid bottom-border" style="padding:2px;">
|
||||||
<div>
|
<div>
|
||||||
<p class="primary-color-highlight">#{{ payment.number }}</p>
|
<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>
|
||||||
<div>
|
{% endfor %}
|
||||||
<p>{{ payment.date }}</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p>{{ payment.method }}</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p>{{ payment.amount }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,9 @@
|
||||||
<div class="two-col-grid" style="">
|
<div class="two-col-grid" style="">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<ninja>
|
<ninja>
|
||||||
<h1 class="primary-color-highlight" style="margin-top:0; margin-bottom:0rem;">$refund_label {% if
|
{% if payments is defined and payments is not empty %}
|
||||||
payments|length == 1%}#$number {% endif %}</h2>
|
<h1 class="primary-color-highlight" style="margin-top:0; margin-bottom:0rem;">$refund_label {% if payments|length == 1%}#$number {% endif %}</h2>
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right"><img src="$company.logo" class="company-logo"></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>
|
<h4 class="italic" style="margin-bottom:0.5rem;">$to_label</h3>
|
||||||
<p style="margin-bottom:0.5rem;">$client.name</p>
|
<p style="margin-bottom:0.5rem;">$client.name</p>
|
||||||
<ninja>
|
<ninja>
|
||||||
{% set payment = payments|first %}
|
{% if payments is defined and payments is not empty %}
|
||||||
{% if payment.client.vat_number %}
|
{% set payment = payments|first %}
|
||||||
<p>$vat_number_label: $vat_number</p>
|
{% if payment.client.vat_number %}
|
||||||
|
<p>$vat_number_label: $vat_number</p>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -123,7 +126,7 @@
|
||||||
<div class="" style="margin-top:20px;">
|
<div class="" style="margin-top:20px;">
|
||||||
|
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if payments|e %}
|
{% if payments is defined and payments is not empty %}
|
||||||
{% set totalInvoices = 0 %}
|
{% set totalInvoices = 0 %}
|
||||||
{% set totalRefunds = 0 %}
|
{% set totalRefunds = 0 %}
|
||||||
{% for payment in payments %}
|
{% for payment in payments %}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<ninja>
|
<ninja>
|
||||||
|
{% if payments is defined and payments is not empty %}
|
||||||
{%set payment = payments|first %}
|
{%set payment = payments|first %}
|
||||||
{%set pivot = payment.paymentables|filter(pivot => pivot.refunded_raw > 0)|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"
|
<table align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="600"
|
||||||
|
|
@ -522,6 +523,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if projects|e %}
|
{% if projects is defined and projects is not empty %}
|
||||||
{% for project in projects %}
|
{% for project in projects %}
|
||||||
|
|
||||||
<h1>{{ project.name }}</h1>
|
<h1>{{ project.name }}</h1>
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if invoices|e %}
|
{% if invoices is defined and invoices is not empty %}
|
||||||
<div class="entity-container">
|
<div class="entity-container">
|
||||||
<h2>Invoices<h2>
|
<h2>Invoices<h2>
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
@ -162,7 +162,7 @@
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if payments|e %}
|
{% if payments is defined and payments is not empty %}
|
||||||
<div class="entity-container">
|
<div class="entity-container">
|
||||||
<h2>Payments<h2>
|
<h2>Payments<h2>
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
@ -194,7 +194,7 @@
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if credits|e %}
|
{% if credits is defined and credits is not empty %}
|
||||||
<div class="entity-container">
|
<div class="entity-container">
|
||||||
<h2>Credits<h2>
|
<h2>Credits<h2>
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
@ -222,7 +222,7 @@
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if aging %}
|
{% if aging is defined %}
|
||||||
<div class="entity-container">
|
<div class="entity-container">
|
||||||
<h2>Aging<h2>
|
<h2>Aging<h2>
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if invoices|e %}
|
{% if invoices is defined and invoices is not empty %}
|
||||||
<div id="entity-container">
|
<div id="entity-container">
|
||||||
<h2>{{ t('invoices') }}<h2>
|
<h2>{{ t('invoices') }}<h2>
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
@ -189,7 +189,7 @@
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if invoices|e and show_payments %}
|
{% if invoices is defined and invoices is not empty and show_payments %}
|
||||||
<div id="entity-container">
|
<div id="entity-container">
|
||||||
<h2>{{ t('payments') }}<h2>
|
<h2>{{ t('payments') }}<h2>
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
@ -270,7 +270,7 @@
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if credits|e and show_credits %}
|
{% if credits is defined and credits is not empty and show_credits %}
|
||||||
<div id="entity-container">
|
<div id="entity-container">
|
||||||
<h2>{{ t('credits') }}<h2>
|
<h2>{{ t('credits') }}<h2>
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
<table width="100%" cellspacing="0" cellpadding="0" class="">
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<ninja>
|
<ninja>
|
||||||
{% if tasks %}
|
{% if tasks is defined and tasks is not empty %}
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue