added amount due to email templates

This commit is contained in:
Denis Duliçi 2021-01-22 14:24:53 +03:00
parent ab0553bfb4
commit dbab1d93c3
5 changed files with 26 additions and 5 deletions

View File

@ -298,6 +298,18 @@ class Document extends Model
return round($paid, $precision);
}
/**
* Get the not paid amount.
*
* @return string
*/
public function getAmountDueAttribute()
{
$precision = config('money.' . $this->currency_code . '.precision');
return round($this->amount - $this->paid, $precision);
}
/**
* Get the status label.
*

View File

@ -66,6 +66,7 @@ class Bill extends Notification
return [
'{bill_number}',
'{bill_total}',
'{bill_amount_due}',
'{bill_due_date}',
'{bill_admin_link}',
'{vendor_name}',
@ -80,8 +81,9 @@ class Bill extends Notification
public function getTagsReplacement()
{
return [
$this->bill->bill_number,
$this->bill->document_number,
money($this->bill->amount, $this->bill->currency_code, true),
money($this->bill->amount_due, $this->bill->currency_code, true),
company_date($this->bill->due_at),
route('bills.show', $this->bill->id),
$this->bill->contact_name,

View File

@ -74,6 +74,7 @@ class Invoice extends Notification
return [
'{invoice_number}',
'{invoice_total}',
'{invoice_amount_due}',
'{invoice_due_date}',
'{invoice_guest_link}',
'{invoice_admin_link}',
@ -92,6 +93,7 @@ class Invoice extends Notification
return [
$this->invoice->document_number,
money($this->invoice->amount, $this->invoice->currency_code, true),
money($this->invoice->amount_due, $this->invoice->currency_code, true),
company_date($this->invoice->due_at),
URL::signedRoute('signed.invoices.show', [$this->invoice->id, 'company_id' => $this->invoice->company_id]),
route('invoices.show', $this->invoice->id),

View File

@ -41,7 +41,7 @@
<strong>
<span class="float-left">
@money($document->amount - $document->paid, $document->currency_code, true)
@money($document->amount_due, $document->currency_code, true)
</span>
</strong>
<br><br>

View File

@ -20,8 +20,13 @@
<div class="row">
@foreach($templates as $template)
@php $aria_expanded_status = in_array($card, [1, 2]) ? 'true' : 'false'; @endphp
@php $collapse_status = in_array($card, [1, 2]) ? 'show' : ''; @endphp
@php
if (!class_exists($template->class)) {
continue;
}
$aria_expanded_status = in_array($card, [1, 2]) ? 'true' : 'false';
$collapse_status = in_array($card, [1, 2]) ? 'show' : '';
@endphp
<div class="col-md-6">
<div class="accordion" id="accordion-{{ $card }}">