mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Improve payments page for client portal and fix invoice status after payment made
This commit is contained in:
parent
4b00d3a82a
commit
624f8db661
@ -206,6 +206,9 @@ class InvoiceService
|
||||
if($this->invoice->balance == 0)
|
||||
$this->setStatus(Invoice::STATUS_PAID);
|
||||
|
||||
if($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount)
|
||||
$this->setStatus(Invoice::STATUS_PARTIAL);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,8 @@ class UpdateInvoicePayment
|
||||
$pivot_invoice->pivot->amount = $paid_amount;
|
||||
$pivot_invoice->pivot->save();
|
||||
|
||||
$this->payment->applied += $paid_amount;
|
||||
|
||||
$invoice->service() //caution what if we amount paid was less than partial - we wipe it!
|
||||
->clearPartial()
|
||||
->updateBalance($paid_amount * -1)
|
||||
@ -82,6 +84,8 @@ class UpdateInvoicePayment
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
|
||||
|
||||
});
|
||||
|
||||
$this->payment->save();
|
||||
|
||||
return $this->payment;
|
||||
}
|
||||
|
@ -31,6 +31,28 @@
|
||||
</div>
|
||||
<div>
|
||||
<dl>
|
||||
|
||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.subtotal') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['invoice_totals'], $client) }}
|
||||
</dd>
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.gateway_fees') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['fee_total'], $client) }}
|
||||
</dd>
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||
{{ ctrans('texts.total') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ App\Utils\Number::formatMoney($total['amount_with_fee'], $client) }}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@if($token)
|
||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
|
||||
<dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
|
||||
|
Loading…
x
Reference in New Issue
Block a user