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="">
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,10 @@
|
||||||
</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">
|
||||||
|
|
@ -228,6 +231,8 @@
|
||||||
{% 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="">
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,10 @@
|
||||||
</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">
|
||||||
|
|
@ -230,6 +233,8 @@
|
||||||
{% 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="">
|
||||||
|
|
|
||||||
|
|
@ -208,8 +208,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;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>
|
||||||
|
{% if payments is defined and payments is not empty %}
|
||||||
{% set payment = payments|first %}
|
{% set payment = payments|first %}
|
||||||
{% if payment %}
|
|
||||||
{{ payment.method }}
|
{{ payment.method }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
|
|
@ -303,9 +303,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
<ninja>
|
<ninja>
|
||||||
{% set totalPrice = 0 %}
|
{% set totalPrice = 0 %}
|
||||||
|
{% if payments is defined and payments is not empty %}
|
||||||
{% for payment in payments %}
|
{% for payment in payments %}
|
||||||
{% for pivot in payment.paymentables|filter(pivot =>
|
{% for pivot in payment.paymentables|filter(pivot => pivot.is_credit == '0') %}
|
||||||
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">
|
||||||
|
|
@ -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,10 +108,12 @@
|
||||||
<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>
|
||||||
|
{% if payments is defined and payments is not empty %}
|
||||||
{% set payment = payments|first %}
|
{% set payment = payments|first %}
|
||||||
{% if payment.client.vat_number %}
|
{% if payment.client.vat_number %}
|
||||||
<p>$vat_number_label: $vat_number</p>
|
<p>$vat_number_label: $vat_number</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
|
|
@ -129,7 +131,7 @@
|
||||||
</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>
|
||||||
|
|
|
||||||
|
|
@ -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,10 +109,12 @@
|
||||||
<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>
|
||||||
|
{% if payments is defined and payments is not empty %}
|
||||||
{% set payment = payments|first %}
|
{% set payment = payments|first %}
|
||||||
{% if payment.client.vat_number %}
|
{% if payment.client.vat_number %}
|
||||||
<p>$vat_number_label: $vat_number</p>
|
<p>$vat_number_label: $vat_number</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</ninja>
|
</ninja>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
|
|
@ -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