feat: add project select to sales & purchases

This commit is contained in:
elforjani13
2022-08-11 11:20:52 +02:00
parent 95137f4fcd
commit 69c4519647
18 changed files with 228 additions and 23 deletions

View File

@@ -1,8 +1,8 @@
import React, { createContext, useContext } from 'react';
import { isEqual, isUndefined } from 'lodash';
import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state';
import { DashboardInsider } from '@/components';
import { useProjects } from '@/containers/Projects/hooks';
import {
useSettingsPaymentReceives,
usePaymentReceiveEditPage,
@@ -57,6 +57,12 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
isSuccess: isBranchesSuccess,
} = useBranches(query, { enabled: isBranchFeatureCan });
// Fetches the projects list.
const {
data: { projects },
isLoading: isProjectsLoading,
} = useProjects();
// Detarmines whether the new mode.
const isNewMode = !paymentReceiveId;
@@ -74,7 +80,8 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
accounts,
customers,
branches,
projects,
isPaymentLoading,
isAccountsLoading,
isPaymentFetching,