mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 07:40:32 +00:00
feat(qucikpayment):add exchange rate muted.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import React from 'react';
|
||||
import { DialogContent } from 'components';
|
||||
import { useBill, useAccounts, useCreatePaymentMade } from 'hooks/query';
|
||||
import {
|
||||
useBill,
|
||||
useAccounts,
|
||||
useBranches,
|
||||
useCreatePaymentMade,
|
||||
} from 'hooks/query';
|
||||
|
||||
import { pick } from 'lodash';
|
||||
|
||||
@@ -9,7 +14,12 @@ const QuickPaymentMadeContext = React.createContext();
|
||||
/**
|
||||
* Quick payment made dialog provider.
|
||||
*/
|
||||
function QuickPaymentMadeFormProvider({ billId, dialogName, ...props }) {
|
||||
function QuickPaymentMadeFormProvider({
|
||||
billId,
|
||||
baseCurrency,
|
||||
dialogName,
|
||||
...props
|
||||
}) {
|
||||
// Handle fetch bill details.
|
||||
const { isLoading: isBillLoading, data: bill } = useBill(billId, {
|
||||
enabled: !!billId,
|
||||
@@ -21,6 +31,13 @@ function QuickPaymentMadeFormProvider({ billId, dialogName, ...props }) {
|
||||
// Create payment made mutations.
|
||||
const { mutateAsync: createPaymentMadeMutate } = useCreatePaymentMade();
|
||||
|
||||
// Fetches the branches list.
|
||||
const {
|
||||
data: branches,
|
||||
isLoading: isBranchesLoading,
|
||||
isSuccess: isBranchesSuccess,
|
||||
} = useBranches();
|
||||
|
||||
// State provider.
|
||||
const provider = {
|
||||
bill: {
|
||||
@@ -29,12 +46,17 @@ function QuickPaymentMadeFormProvider({ billId, dialogName, ...props }) {
|
||||
payment_amount: bill?.due_amount,
|
||||
},
|
||||
accounts,
|
||||
branches,
|
||||
dialogName,
|
||||
baseCurrency,
|
||||
createPaymentMadeMutate,
|
||||
isBranchesSuccess,
|
||||
};
|
||||
|
||||
return (
|
||||
<DialogContent isLoading={isAccountsLoading || isBillLoading}>
|
||||
<DialogContent
|
||||
isLoading={isAccountsLoading || isBillLoading || isBranchesLoading}
|
||||
>
|
||||
<QuickPaymentMadeContext.Provider value={provider} {...props} />
|
||||
</DialogContent>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user