feat: advanced payments

This commit is contained in:
Ahmed Bouhuolia
2024-07-22 20:40:15 +02:00
parent fe214b1b2d
commit 8cd3a6c48d
17 changed files with 548 additions and 162 deletions

View File

@@ -102,17 +102,6 @@ function PaymentReceiveForm({
) => {
setSubmitting(true);
// Calculates the total payment amount of entries.
const totalPaymentAmount = sumBy(values.entries, 'payment_amount');
if (totalPaymentAmount <= 0) {
AppToaster.show({
message: intl.get('you_cannot_make_payment_with_zero_total_amount'),
intent: Intent.DANGER,
});
setSubmitting(false);
return;
}
// Transformes the form values to request body.
const form = transformFormToRequest(values);

View File

@@ -124,7 +124,7 @@ export default function PaymentReceiveHeaderFields() {
</FastField>
{/* ------------ Full amount ------------ */}
<Field name={'full_amount'}>
<Field name={'amount'}>
{({
form: {
setFieldValue,
@@ -146,7 +146,7 @@ export default function PaymentReceiveHeaderFields() {
<MoneyInputGroup
value={value}
onChange={(value) => {
setFieldValue('full_amount', value);
setFieldValue('amount', value);
}}
onBlurValue={onFullAmountBlur}
/>

View File

@@ -42,7 +42,7 @@ export const defaultPaymentReceive = {
// Holds the payment number that entered manually only.
payment_receive_no_manually: '',
statement: '',
full_amount: '',
amount: '',
currency_code: '',
branch_id: '',
exchange_rate: 1,