feat(Sales & Purchases ): add branch & warehouse.

This commit is contained in:
elforjani13
2022-02-20 13:54:31 +02:00
parent 3ed2393cf1
commit b46c3f4843
35 changed files with 1184 additions and 28 deletions

View File

@@ -5,6 +5,7 @@ import {
usePaymentReceiveEditPage,
useAccounts,
useCustomers,
useBranches,
useCreatePaymentReceive,
useEditPaymentReceive,
} from 'hooks/query';
@@ -42,9 +43,18 @@ function PaymentReceiveFormProvider({ paymentReceiveId, ...props }) {
isLoading: isCustomersLoading,
} = useCustomers({ page_size: 10000 });
// Fetches the branches list.
const {
data: branches,
isLoading: isBranchesLoading,
isSuccess: isBranchesSuccess,
} = useBranches();
// Detarmines whether the new mode.
const isNewMode = !paymentReceiveId;
const isFeatureLoading = isBranchesLoading;
// Create and edit payment receive mutations.
const { mutateAsync: editPaymentReceiveMutate } = useEditPaymentReceive();
const { mutateAsync: createPaymentReceiveMutate } = useCreatePaymentReceive();
@@ -56,11 +66,14 @@ function PaymentReceiveFormProvider({ paymentReceiveId, ...props }) {
paymentEntriesEditPage,
accounts,
customers,
branches,
isPaymentLoading,
isAccountsLoading,
isPaymentFetching,
isCustomersLoading,
isFeatureLoading,
isBranchesSuccess,
isNewMode,
submitPayload,