+
+
+ {/* ------------- Vendor name ------------- */}
+
+ {({ from, field, meta: { error, touched } }) => (
+ }
+ className={classNames('form-group--select-list', CLASSES.FILL)}
+ labelInfo={}
+ intent={inputIntent({ error, touched })}
+ helperText={}
+ >
+
+
+ )}
+
+
+
+ {/* ------------ Payment number. ------------ */}
+
+ {({ form, field, meta: { error, touched } }) => (
+ }
+ className={('form-group--payment_number', CLASSES.FILL)}
+ intent={inputIntent({ error, touched })}
+ helperText={}
+ >
+
+
+ )}
+
+
+
+ {/*------------ Amount Received -----------*/}
+
+ {({
+ form: { values, setFieldValue },
+ field: { value },
+ meta: { error, touched },
+ }) => (
+ }
+ labelInfo={}
+ className={classNames('form-group--payment_amount', CLASSES.FILL)}
+ intent={inputIntent({ error, touched })}
+ helperText={}
+ >
+
+
+
+ {
+ setFieldValue('payment_amount', amount);
+ }}
+ intent={inputIntent({ error, touched })}
+ inputRef={(ref) => (paymentMadeFieldRef.current = ref)}
+ />
+
+
+ )}
+
+
+
+ {/* ------------- Payment date ------------- */}
+
+ {({ form, field: { value }, meta: { error, touched } }) => (
+ }
+ labelInfo={}
+ className={classNames('form-group--select-list', CLASSES.FILL)}
+ intent={inputIntent({ error, touched })}
+ helperText={}
+ >
+ {
+ form.setFieldValue('payment_date', formattedDate);
+ })}
+ popoverProps={{ position: Position.BOTTOM, minimal: true }}
+ inputProps={{
+ leftIcon: ,
+ }}
+ />
+
+ )}
+
+
+
+ {/* ------------ payment account ------------ */}
+
+ {({ form, field: { value }, meta: { error, touched } }) => (
+ }
+ className={classNames(
+ 'form-group--payment_account_id',
+ 'form-group--select-list',
+ CLASSES.FILL,
+ )}
+ labelInfo={}
+ intent={inputIntent({ error, touched })}
+ helperText={}
+ >
+ }
+ onAccountSelected={(account) => {
+ form.setFieldValue('payment_account_id', account.id);
+ }}
+ selectedAccountId={value}
+ />
+
+ )}
+
+
+
+ {/* ------------ Reference No. ------------ */}
+
+ {({ form, field, meta: { error, touched } }) => (
+ }
+ className={classNames('form-group--reference', CLASSES.FILL)}
+ intent={inputIntent({ error, touched })}
+ helperText={}
+ >
+
+
+ )}
+
+ {/* --------- Statement --------- */}
+
+ {({ form, field, meta: { error, touched } }) => (
+ }
+ className={'form-group--statement'}
+ >
+
+
+ )}
+
+
+ );
+}
diff --git a/client/src/containers/Dialogs/QuickPaymentMadeFormDialog/QuickPaymentMadeFormProvider.js b/client/src/containers/Dialogs/QuickPaymentMadeFormDialog/QuickPaymentMadeFormProvider.js
new file mode 100644
index 000000000..0a5d59fbc
--- /dev/null
+++ b/client/src/containers/Dialogs/QuickPaymentMadeFormDialog/QuickPaymentMadeFormProvider.js
@@ -0,0 +1,46 @@
+import React from 'react';
+import { DialogContent } from 'components';
+import { useBill, useAccounts, useCreatePaymentMade } from 'hooks/query';
+
+import { pick } from 'lodash';
+
+const QuickPaymentMadeContext = React.createContext();
+
+/**
+ * Quick payment made dialog provider.
+ */
+function QuickPaymentMadeFormProvider({ billId, dialogName, ...props }) {
+ // Handle fetch bill details.
+ const { isLoading: isBillLoading, data: bill } = useBill(billId, {
+ enabled: !!billId,
+ });
+
+ // Handle fetch accounts data.
+ const { data: accounts, isLoading: isAccountsLoading } = useAccounts();
+
+ // Create payment made mutations.
+ const { mutateAsync: createPaymentMadeMutate } = useCreatePaymentMade();
+
+ // State provider.
+ const provider = {
+ bill: {
+ ...pick(bill, ['id', 'due_amount', 'vendor', 'currency_code']),
+ vendor_id: bill?.vendor?.display_name,
+ payment_amount: bill?.due_amount,
+ },
+ accounts,
+ dialogName,
+ createPaymentMadeMutate,
+ };
+
+ return (
+