improvements for validation of over/under payments

This commit is contained in:
David Bomba 2024-07-02 18:32:14 +10:00 committed by Benjamin Beganović
parent 0605154d73
commit 78f79a341e
4 changed files with 7 additions and 7 deletions

View File

@ -83,4 +83,4 @@ class ProcessPayment extends Component
return render($this->payment_view, $this->payment_data_payload);
}
}
}

View File

@ -75,4 +75,4 @@ class UnderOverPayment extends Component
{
return render('flow2.under-over-payments');
}
}
}

View File

@ -150,7 +150,8 @@ class InvoicePay extends Component
$client = $invite->contact->client;
$settings = $client->getMergedSettings();
$this->context['settings'] = $settings;
$this->context['db'] = $this->db;
$invoices = Invoice::find($this->transformKeys($this->invoices));
$invoices = $invoices->filter(function ($i){
@ -166,7 +167,6 @@ class InvoicePay extends Component
//under-over / payment
//required fields
$this->terms_accepted = !$settings->show_accept_invoice_terms;
$this->signature_accepted = !$settings->require_invoice_signature;
$this->under_over_payment = $settings->client_portal_allow_over_payment || $settings->client_portal_allow_under_payment;

View File

@ -1,6 +1,6 @@
<div x-data="{ payableInvoices: @entangle('payableInvoices'), errors: @entangle('errors') }" class="px-4 py-5 bg-white sm:gap-4 sm:px-6">
<dt class="text-sm font-medium leading-5 text-gray-500">
<dt class="text-sm font-medium leading-5 text-gray-500 mb-3">
{{ ctrans('texts.payment_amount') }}
</dt>
<dd class="text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2 flex flex-col">
@ -8,10 +8,10 @@
<template x-for="(invoice, index) in payableInvoices" :key="index">
<div class="flex items-center">
<div class="flex items-center mb-2">
<label>
<span x-text="'{{ ctrans('texts.invoice') }} ' + invoice.number" class="mt-2"></span>
<span>{{ $currency->code }} ({{ $currency->symbol }})</span>
<span class="pr-2">{{ $currency->code }} ({{ $currency->symbol }})</span>
<input
type="text"
class="input mt-0 mr-4 relative"