1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

add helper for Invoice payable amount

This commit is contained in:
David Bomba 2022-02-28 10:15:36 +11:00
parent 4b3e09faf8
commit f7ff5d34df
2 changed files with 15 additions and 1 deletions

View File

@ -498,6 +498,20 @@ class Invoice extends BaseModel
return $this->calc()->getTotal();
}
public function getPayableAmount()
{
if($this->partial > 0)
return $this->partial;
if($this->balance > 0)
return $this->balance;
if($this->status_id = 1)
return $this->amount;
return 0;
}
public function entityEmailEvent($invitation, $reminder_template, $template)
{
switch ($reminder_template) {

View File

@ -59,7 +59,7 @@
@if($settings->client_portal_allow_under_payment || $settings->client_portal_allow_over_payment)
<button class="button button-primary bg-primary">{{ ctrans('texts.pay_now') }}</button>
@else
@livewire('pay-now-dropdown', ['total' => $invoice->partial > 0 ? $invoice->partial : $invoice->balance, 'company' => $company])
@livewire('pay-now-dropdown', ['total' => $invoice->getPayableAmount(), 'company' => $company])
@endif
</div>
</div>