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

@ -150,6 +150,7 @@ class InvoicePay extends Component
$client = $invite->contact->client; $client = $invite->contact->client;
$settings = $client->getMergedSettings(); $settings = $client->getMergedSettings();
$this->context['settings'] = $settings; $this->context['settings'] = $settings;
$this->context['db'] = $this->db;
$invoices = Invoice::find($this->transformKeys($this->invoices)); $invoices = Invoice::find($this->transformKeys($this->invoices));
$invoices = $invoices->filter(function ($i){ $invoices = $invoices->filter(function ($i){
@ -166,7 +167,6 @@ class InvoicePay extends Component
//under-over / payment //under-over / payment
//required fields //required fields
$this->terms_accepted = !$settings->show_accept_invoice_terms; $this->terms_accepted = !$settings->show_accept_invoice_terms;
$this->signature_accepted = !$settings->require_invoice_signature; $this->signature_accepted = !$settings->require_invoice_signature;
$this->under_over_payment = $settings->client_portal_allow_over_payment || $settings->client_portal_allow_under_payment; $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"> <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') }} {{ ctrans('texts.payment_amount') }}
</dt> </dt>
<dd class="text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2 flex flex-col"> <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"> <template x-for="(invoice, index) in payableInvoices" :key="index">
<div class="flex items-center"> <div class="flex items-center mb-2">
<label> <label>
<span x-text="'{{ ctrans('texts.invoice') }} ' + invoice.number" class="mt-2"></span> <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 <input
type="text" type="text"
class="input mt-0 mr-4 relative" class="input mt-0 mr-4 relative"