Additing validation at payment Request schema.

This commit is contained in:
Kartik Sharma 2025-11-11 14:40:31 +05:30
parent ba0036b1fa
commit 96abc8d42c
2 changed files with 23 additions and 19 deletions

View File

@ -403,7 +403,7 @@ const ActionPaymentRequest = ({ requestId }) => {
</small>
)}
</div>
<div className="col-12 col-md-6 text-start mb-1">
<div className="col-12 col-md-6 text-start mb-2">
<Label className="form-label">TDS %</Label>
<input
type="number"
@ -417,15 +417,15 @@ const ActionPaymentRequest = ({ requestId }) => {
)}
</div>
<div className="col-12 col-md-6 d-flex align-items-center gap-4 mb-1 mt-3">
<div className="col-12 d-flex align-items-center gap-4 mb-2 mt-1">
<div>
<span className="fw-semibold">TDS Amount: </span>
<span className="badge bg-label-success">{tdsAmount.toFixed(2)}</span>
<span className="badge bg-label-secondary">{tdsAmount.toFixed(2)}</span>
</div>
<div>
<span className="fw-semibold">Net Payable: </span>
<span className="badge bg-label-primary">{netPayable.toFixed(2)}</span>
<span className="badge bg-label-secondary">{netPayable.toFixed(2)}</span>
</div>
</div>
</div>

View File

@ -98,23 +98,27 @@ export const PaymentRequestActionScheam = (
paidAt: z.string().nullable().optional(),
paidById: z.string().nullable().optional(),
tdsPercentage: z
.number({ invalid_type_error: "TDS must be a number" })
.min(0, { message: "TDS must be zero or greater" })
.or(z.nan())
.or(z.null())
.optional(),
.number({ invalid_type_error: "TDS must be a number" })
.min(0, { message: "TDS cannot be less than 0" })
.max(100, { message: "TDS cannot be greater than 100" })
.or(z.nan())
.or(z.null())
.optional(),
baseAmount: z
.number({ invalid_type_error: "TDS must be a number" })
.min(0, { message: "TDS must be zero or greater" })
.or(z.nan())
.or(z.null())
.optional(),
.number({ invalid_type_error: "Base Amount must be a number" })
.min(0, { message: "Base Amount cannot be negative" })
.or(z.nan())
.or(z.null())
.optional(),
taxAmount: z
.number({ invalid_type_error: "Tax amount must be a number" })
.min(0, { message: "Tax amount must be zero or greater" })
.or(z.nan())
.or(z.null())
.optional(),
.number({ invalid_type_error: "Tax amount must be a number" })
.min(0, { message: "Tax amount cannot be negative" })
.or(z.nan())
.or(z.null())
.optional(),
// after Payment Processed
paymentModeId: z.string().nullable().optional(),
location: z.string().nullable().optional(),