Compare commits

..

3 Commits

30 changed files with 364 additions and 224 deletions

View File

@@ -2,95 +2,78 @@
All notable changes to Bigcapital server-side will be in this file. All notable changes to Bigcapital server-side will be in this file.
## [1.7.6-rc.2] - 23-04-2022 ## [1.7.4-rc.2] - 20-04-2022
### Fixed ### Fixed
- `BIG-374` Refactoring sidebar men with ability permissions and feature control on each item.
- `BIG-374` Refactoring sidebar men with ability permissions and feature control on each item.
## [v1.7.5-rc.2] - 20-04-2022
### Fixed.
- `BIG-378` Reports drawers columns css conflict.
## [1.7.3-rc.2] - 15-04-2022 ## [1.7.3-rc.2] - 15-04-2022
### Fixed ### Fixed
- `BIG-372` Activate branches and warehouses dialog reloading once activating.
- `BIG-372` Activate branches and warehouses dialog reloading once activating. - `BIG-373` Issue general ledger report select specific account.
- `BIG-373` Issue general ledger report select specific account. - `BIG-377` Make readonly details entries as oneline with tooltip for more details.
- `BIG-377` Make readonly details entries as oneline with tooltip for more details.
## [1.7.2-rc.2] - 04-04-2022 ## [1.7.2-rc.2] - 04-04-2022
### Fixed ### Fixed
- Add the missing Arabic localization.
- Add the missing Arabic localization. - Subscription plans modifications.
- Subscription plans modifications.
## [1.7.1-rc.2] - 30-03-2022 ## [1.7.1-rc.2] - 30-03-2022
## Added ## Added
- `BIG-141` Add inactive status to item drawer details.
- `BIG-141` Add inactive status to item drawer details. - `BIG-278` Add created at date on expense details.
- `BIG-278` Add created at date on expense details. - `BIG-350` Add empty status content of warehouse transfers service.
- `BIG-350` Add empty status content of warehouse transfers service. - `BIG-344` Add branch details to manual journal and expense details.
- `BIG-344` Add branch details to manual journal and expense details.
## Fixed ## Fixed
- `BIG-221` Remove Non-inventory radio choice on item form.
- `BIG-221` Remove Non-inventory radio choice on item form. - `BIG-236` Validate estimate expiration date should be equal or bigger than estimate date.
- `BIG-236` Validate estimate expiration date should be equal or bigger than estimate date. - `BIG-237` Validate invoice due date should be equal or bigger than invoice date.
- `BIG-237` Validate invoice due date should be equal or bigger than invoice date. - `BIG-238` Validate bill due date should be equal or bigger than bill date.
- `BIG-238` Validate bill due date should be equal or bigger than bill date. - `BIG-280` Optimize style of multi-select accounts menu.
- `BIG-280` Optimize style of multi-select accounts menu. - `BIG-284` Cashflow statement loading bar.
- `BIG-284` Cashflow statement loading bar. - `BIG-296` Creating a new child account from accounts list.
- `BIG-296` Creating a new child account from accounts list. - `BIG-301` Navigation bar divider on actions bar hide with permissions control.
- `BIG-301` Navigation bar divider on actions bar hide with permissions control. - `BIG-304` Adding cash or bank account from cash flow service.
- `BIG-304` Adding cash or bank account from cash flow service. - `BIG-351` Invalid date in the inventory adjustment detail.
- `BIG-351` Invalid date in the inventory adjustment detail. - `BIG-352` Fix terms and notes fields on footer of all services.
- `BIG-352` Fix terms and notes fields on footer of all services. - `BIG-354` Validate the warehouse transfer quantity should be above zero.
- `BIG-354` Validate the warehouse transfer quantity should be above zero.
## [1.7.0-rc.1] - 24-03-2022 ## [1.7.0-rc.1] - 24-03-2022
## Added ## Added
- Multiply currencies with foreign currencies.
- Multiply currencies with foreign currencies. - Multiply warehouses to track inventory items.
- Multiply warehouses to track inventory items. - Multiply branches to track organization transactions.
- Multiply branches to track organization transactions. - Transfer orders between warehouses.
- Transfer orders between warehouses. - Integrate financial reports with multiply branches.
- Integrate financial reports with multiply branches. - Integrate inventory reports with multiply warehouses.
- Integrate inventory reports with multiply warehouses.
## Changes ## Changes
- Optimize style of sale invoice form.
- Optimize style of sale invoice form. - Optimize style of sale receipt form.
- Optimize style of sale receipt form. - Optimize style of credit note form.
- Optimize style of credit note form. - Optimize style of payment receive form.
- Optimize style of payment receive form. - Optimize style of bill form.
- Optimize style of bill form. - Optimize style of payment made form.
- Optimize style of payment made form. - Optimize style of manual journal form.
- Optimize style of manual journal form. - Optimize style of expense form.
- Optimize style of expense form.
## [1.6.3] - 21-02-2022 ## [1.6.3] - 21-02-2022
### Fixed ### Fixed
- `BIG-337` Display billing page once the organization subscription is inactive.
- `BIG-337` Display billing page once the organization subscription is inactive.
## [1.6.2] - 19-02-2022 ## [1.6.2] - 19-02-2022
### Fixed ### Fixed
- fix syled components dependency with imported as default components.
- fix syled components dependency with imported as default components.
## [1.6.0] - 18-02-2022 ## [1.6.0] - 18-02-2022
### Added ### Added
- Balance sheet comparison of previous period (PP). - Balance sheet comparison of previous period (PP).
- Balance sheet comparison of previous year (PY). - Balance sheet comparison of previous year (PY).
- Balance sheet percentage analysis columns and rows basis. - Balance sheet percentage analysis columns and rows basis.
@@ -101,12 +84,10 @@ All notable changes to Bigcapital server-side will be in this file.
## [1.5.8] - 13-01-2022 ## [1.5.8] - 13-01-2022
### Added ### Added
- Add payment receive PDF print. - Add payment receive PDF print.
- Add credit note PDF print. - Add credit note PDF print.
### Fixed ### Fixed
- fix: Payment receive initial loading state depends on request loading state instead fetching. - fix: Payment receive initial loading state depends on request loading state instead fetching.
- fix: Balance sheet report alert positioning. - fix: Balance sheet report alert positioning.
- fix: Separate customer and vendor inactivate and activate alerts. - fix: Separate customer and vendor inactivate and activate alerts.

View File

@@ -24,6 +24,7 @@ function MakeJournalProvider({ journalId, query, ...props }) {
// Features guard. // Features guard.
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isBranchFeatureCan = featureCan(Features.Branches); const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectFeatureCan = featureCan(Features.Projects);
// Load the accounts list. // Load the accounts list.
const { data: accounts, isLoading: isAccountsLoading } = useAccounts(); const { data: accounts, isLoading: isAccountsLoading } = useAccounts();
@@ -60,7 +61,7 @@ function MakeJournalProvider({ journalId, query, ...props }) {
const { const {
data: { projects }, data: { projects },
isLoading: isProjectsLoading, isLoading: isProjectsLoading,
} = useProjects(); } = useProjects({}, { enabled: !!isProjectFeatureCan });
// Submit form payload. // Submit form payload.
const [submitPayload, setSubmitPayload] = useState({}); const [submitPayload, setSubmitPayload] = useState({});

View File

@@ -71,7 +71,6 @@ function CashFlowAccountsActionsBar({
text={<T id={'cash_flow.label.add_cash_account'} />} text={<T id={'cash_flow.label.add_cash_account'} />}
onClick={handleAddBankAccount} onClick={handleAddBankAccount}
/> />
<Button <Button
className={Classes.MINIMAL} className={Classes.MINIMAL}
icon={<Icon icon={'plus-24'} iconSize={20} />} icon={<Icon icon={'plus-24'} iconSize={20} />}

View File

@@ -23,6 +23,7 @@ function ExpenseFormPageProvider({ query, expenseId, ...props }) {
// Features guard. // Features guard.
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isBranchFeatureCan = featureCan(Features.Branches); const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectsFeatureCan = featureCan(Features.Projects);
const { data: currencies, isLoading: isCurrenciesLoading } = useCurrencies(); const { data: currencies, isLoading: isCurrenciesLoading } = useCurrencies();
@@ -51,7 +52,7 @@ function ExpenseFormPageProvider({ query, expenseId, ...props }) {
const { const {
data: { projects }, data: { projects },
isLoading: isProjectsLoading, isLoading: isProjectsLoading,
} = useProjects(); } = useProjects({}, { enabled: !!isProjectsFeatureCan });
// Create and edit expense mutate. // Create and edit expense mutate.
const { mutateAsync: createExpenseMutate } = useCreateExpense(); const { mutateAsync: createExpenseMutate } = useCreateExpense();
@@ -75,7 +76,7 @@ function ExpenseFormPageProvider({ query, expenseId, ...props }) {
accounts, accounts,
branches, branches,
projects, projects,
isCurrenciesLoading, isCurrenciesLoading,
isExpenseLoading, isExpenseLoading,
isCustomersLoading, isCustomersLoading,

View File

@@ -15,6 +15,8 @@ import withAPAgingSummary from './withAPAgingSummary';
import withAPAgingSummaryActions from './withAPAgingSummaryActions'; import withAPAgingSummaryActions from './withAPAgingSummaryActions';
import { transformToForm, compose } from '@/utils'; import { transformToForm, compose } from '@/utils';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* AP Aging Summary Report - Drawer Header. * AP Aging Summary Report - Drawer Header.
@@ -68,11 +70,14 @@ function APAgingSummaryHeader({
const handleCancelClick = () => { const handleCancelClick = () => {
toggleFilterDrawerDisplay(false); toggleFilterDrawerDisplay(false);
}; };
// Handle the drawer closing. // Handle the drawer closing.
const handleDrawerClose = () => { const handleDrawerClose = () => {
toggleFilterDrawerDisplay(false); toggleFilterDrawerDisplay(false);
}; };
// Detarmines the feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<APAgingDrawerHeader <APAgingDrawerHeader
@@ -91,11 +96,13 @@ function APAgingSummaryHeader({
title={<T id={'general'} />} title={<T id={'general'} />}
panel={<APAgingSummaryHeaderGeneral />} panel={<APAgingSummaryHeaderGeneral />}
/> />
<Tab {isBranchesFeatureCan && (
id="dimensions" <Tab
title={<T id={'dimensions'} />} id="dimensions"
panel={<APAgingSummaryHeaderDimensions />} title={<T id={'dimensions'} />}
/> panel={<APAgingSummaryHeaderDimensions />}
/>
)}
</Tabs> </Tabs>
<div className={'financial-header-drawer__footer'}> <div className={'financial-header-drawer__footer'}>
<Button className={'mr1'} intent={Intent.PRIMARY} type={'submit'}> <Button className={'mr1'} intent={Intent.PRIMARY} type={'submit'}>

View File

@@ -7,6 +7,8 @@ import {
APAgingSummaryHeaderDimensionsProvider, APAgingSummaryHeaderDimensionsProvider,
useAPAgingSummaryHeaderDimensonsContext, useAPAgingSummaryHeaderDimensonsContext,
} from './APAgingSummaryHeaderDimensionsProvider'; } from './APAgingSummaryHeaderDimensionsProvider';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* APAging summary header dimensions. * APAging summary header dimensions.
@@ -27,15 +29,22 @@ export default function APAgingSummaryHeaderDimensions() {
function APAgingSummaryHeaderDimensionsContent() { function APAgingSummaryHeaderDimensionsContent() {
const { branches } = useAPAgingSummaryHeaderDimensonsContext(); const { branches } = useAPAgingSummaryHeaderDimensonsContext();
// Detarmines the feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -15,6 +15,8 @@ import withARAgingSummary from './withARAgingSummary';
import withARAgingSummaryActions from './withARAgingSummaryActions'; import withARAgingSummaryActions from './withARAgingSummaryActions';
import { compose, transformToForm } from '@/utils'; import { compose, transformToForm } from '@/utils';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* AR Aging Summary Report - Drawer Header. * AR Aging Summary Report - Drawer Header.
@@ -76,6 +78,10 @@ function ARAgingSummaryHeader({
const handleDrawerClose = () => { const handleDrawerClose = () => {
toggleFilterDrawerDisplay(false); toggleFilterDrawerDisplay(false);
}; };
// Detarmines the feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<ARAgingDrawerHeader <ARAgingDrawerHeader
@@ -94,11 +100,13 @@ function ARAgingSummaryHeader({
title={<T id={'general'} />} title={<T id={'general'} />}
panel={<ARAgingSummaryHeaderGeneral />} panel={<ARAgingSummaryHeaderGeneral />}
/> />
<Tab {isBranchesFeatureCan && (
id="dimensions" <Tab
title={<T id={'dimensions'} />} id="dimensions"
panel={<ARAgingSummaryHeaderDimensions />} title={<T id={'dimensions'} />}
/> panel={<ARAgingSummaryHeaderDimensions />}
/>
)}
</Tabs> </Tabs>
<div class="financial-header-drawer__footer"> <div class="financial-header-drawer__footer">

View File

@@ -10,7 +10,7 @@ import {
/** /**
* ARAging summary header dimensions. * ARAging summary header dimensions.
* @returns * @returns {JSX.Element}
*/ */
export default function ARAgingSummaryHeaderDimensions() { export default function ARAgingSummaryHeaderDimensions() {
return ( return (
@@ -22,20 +22,27 @@ export default function ARAgingSummaryHeaderDimensions() {
/** /**
* ARAging summary header dimensions content. * ARAging summary header dimensions content.
* @returns * @returns {JSX.Element}
*/ */
function ARAgingSummaryHeaderDimensionsContent() { function ARAgingSummaryHeaderDimensionsContent() {
const { branches } = useARAgingSummaryHeaderDimensonsContext(); const { branches } = useARAgingSummaryHeaderDimensonsContext();
// Detarmines the feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -6,6 +6,8 @@ import { Tabs, Tab, Button, Intent } from '@blueprintjs/core';
import { Formik, Form } from 'formik'; import { Formik, Form } from 'formik';
import { FormattedMessage as T } from '@/components'; import { FormattedMessage as T } from '@/components';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
import withBalanceSheet from './withBalanceSheet'; import withBalanceSheet from './withBalanceSheet';
import withBalanceSheetActions from './withBalanceSheetActions'; import withBalanceSheetActions from './withBalanceSheetActions';
@@ -56,16 +58,18 @@ function BalanceSheetHeader({
toggleFilterDrawer(false); toggleFilterDrawer(false);
actions.setSubmitting(false); actions.setSubmitting(false);
}; };
// Handle cancel button click. // Handle cancel button click.
const handleCancelClick = () => { const handleCancelClick = () => {
toggleFilterDrawer(false); toggleFilterDrawer(false);
}; };
// Handle drawer close action. // Handle drawer close action.
const handleDrawerClose = () => { const handleDrawerClose = () => {
toggleFilterDrawer(false); toggleFilterDrawer(false);
}; };
// Detarmines the given feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<BalanceSheetFinancialHeader <BalanceSheetFinancialHeader
@@ -91,11 +95,13 @@ function BalanceSheetHeader({
title={<T id={'balance_sheet.comparisons'} />} title={<T id={'balance_sheet.comparisons'} />}
panel={<BalanceSheetHeaderComparisonPanal />} panel={<BalanceSheetHeaderComparisonPanal />}
/> />
<Tab {isBranchesFeatureCan && (
id="dimensions" <Tab
title={<T id={'balance_sheet.dimensions'} />} id="dimensions"
panel={<BalanceSheetHeaderDimensionsPanel />} title={<T id={'balance_sheet.dimensions'} />}
/> panel={<BalanceSheetHeaderDimensionsPanel />}
/>
)}
</Tabs> </Tabs>
<div class="financial-header-drawer__footer"> <div class="financial-header-drawer__footer">

View File

@@ -7,6 +7,8 @@ import {
BalanceSheetHeaderDimensionsProvider, BalanceSheetHeaderDimensionsProvider,
useBalanceSheetHeaderDimensionsPanelContext, useBalanceSheetHeaderDimensionsPanelContext,
} from './BalanceSheetHeaderDimensionsProvider'; } from './BalanceSheetHeaderDimensionsProvider';
import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state';
/** /**
* Balance sheet header dismension panel. * Balance sheet header dismension panel.
@@ -26,16 +28,21 @@ export default function BalanceSheetHeaderDimensionsPanel() {
*/ */
function BalanceSheetHeaderDimensionsPanelContent() { function BalanceSheetHeaderDimensionsPanelContent() {
const { branches } = useBalanceSheetHeaderDimensionsPanelContext(); const { branches } = useBalanceSheetHeaderDimensionsPanelContext();
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -7,6 +7,8 @@ import {
CashFlowStatementDimensionsPanelProvider, CashFlowStatementDimensionsPanelProvider,
useCashFlowStatementDimensionsPanelContext, useCashFlowStatementDimensionsPanelContext,
} from './CashFlowStatementDimensionsPanelProvider'; } from './CashFlowStatementDimensionsPanelProvider';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Cash flow statement dismension panel. * Cash flow statement dismension panel.
@@ -28,15 +30,21 @@ function CashFlowStatementDimensionsPanelContent() {
// Fetches the branches list. // Fetches the branches list.
const { branches } = useCashFlowStatementDimensionsPanelContext(); const { branches } = useCashFlowStatementDimensionsPanelContext();
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -16,6 +16,8 @@ import withCashFlowStatementActions from './withCashFlowStatementActions';
import { getDefaultCashFlowSheetQuery } from './utils'; import { getDefaultCashFlowSheetQuery } from './utils';
import { compose, transformToForm } from '@/utils'; import { compose, transformToForm } from '@/utils';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Cash flow statement header. * Cash flow statement header.
@@ -43,7 +45,6 @@ function CashFlowStatementHeader({
}, },
defaultValues, defaultValues,
); );
// Validation schema. // Validation schema.
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
dateRange: Yup.string().optional(), dateRange: Yup.string().optional(),
@@ -67,6 +68,10 @@ function CashFlowStatementHeader({
toggleCashFlowStatementFilterDrawer(false); toggleCashFlowStatementFilterDrawer(false);
}; };
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<FinancialStatementHeader <FinancialStatementHeader
isOpen={isFilterDrawerOpen} isOpen={isFilterDrawerOpen}
@@ -84,11 +89,13 @@ function CashFlowStatementHeader({
title={<T id={'general'} />} title={<T id={'general'} />}
panel={<CashFlowStatementGeneralPanel />} panel={<CashFlowStatementGeneralPanel />}
/> />
<Tab {isBranchesFeatureCan && (
id="dimensions" <Tab
title={<T id={'dimensions'} />} id="dimensions"
panel={<CashFlowStatementDimensionsPanel />} title={<T id={'dimensions'} />}
/> panel={<CashFlowStatementDimensionsPanel />}
/>
)}
</Tabs> </Tabs>
<div class="financial-header-drawer__footer"> <div class="financial-header-drawer__footer">

View File

@@ -13,16 +13,18 @@ import { ListSelect, MODIFIER, FormattedMessage as T } from '@/components';
import { CLASSES } from '@/constants/classes'; import { CLASSES } from '@/constants/classes';
import { filterAccountsOptions } from './constants'; import { filterAccountsOptions } from './constants';
const SUBMENU_POPOVER_MODIFIERS = {
flip: { boundariesElement: 'viewport', padding: 20 },
offset: { offset: '0, 10' },
preventOverflow: { boundariesElement: 'viewport', padding: 40 },
};
export default function FinancialStatementsFilter({ export default function FinancialStatementsFilter({
items = filterAccountsOptions, items = filterAccountsOptions,
label = <T id={'filter_accounts'} />, label = <T id={'filter_accounts'} />,
...restProps ...restProps
}) { }) {
const SUBMENU_POPOVER_MODIFIERS = {
flip: { boundariesElement: 'viewport', padding: 20 },
offset: { offset: '0, 10' },
preventOverflow: { boundariesElement: 'viewport', padding: 40 },
};
const filterRenderer = (item, { handleClick, modifiers, query }) => { const filterRenderer = (item, { handleClick, modifiers, query }) => {
return ( return (

View File

@@ -16,6 +16,8 @@ import GeneralLedgerHeaderDimensionsPanel from './GeneralLedgerHeaderDimensionsP
import withGeneralLedger from './withGeneralLedger'; import withGeneralLedger from './withGeneralLedger';
import withGeneralLedgerActions from './withGeneralLedgerActions'; import withGeneralLedgerActions from './withGeneralLedgerActions';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Geenral Ledger (GL) - Header. * Geenral Ledger (GL) - Header.
@@ -63,6 +65,10 @@ function GeneralLedgerHeader({
const handleDrawerClose = () => { const handleDrawerClose = () => {
toggleDisplayFilterDrawer(false); toggleDisplayFilterDrawer(false);
}; };
// Detarmines the feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<GeneralLedgerDrawerHeader <GeneralLedgerDrawerHeader
@@ -81,11 +87,13 @@ function GeneralLedgerHeader({
title={<T id={'general'} />} title={<T id={'general'} />}
panel={<GeneralLedgerHeaderGeneralPane />} panel={<GeneralLedgerHeaderGeneralPane />}
/> />
<Tab {isBranchesFeatureCan && (
id="dimensions" <Tab
title={<T id={'dimensions'} />} id="dimensions"
panel={<GeneralLedgerHeaderDimensionsPanel />} title={<T id={'dimensions'} />}
/> panel={<GeneralLedgerHeaderDimensionsPanel />}
/>
)}
</Tabs> </Tabs>
<div class="financial-header-drawer__footer"> <div class="financial-header-drawer__footer">

View File

@@ -7,6 +7,8 @@ import {
GeneralLedgerHeaderDimensionsPanelProvider, GeneralLedgerHeaderDimensionsPanelProvider,
useGeneralLedgerHeaderDimensionsContext, useGeneralLedgerHeaderDimensionsContext,
} from './GeneralLedgerHeaderDimensionsPanelProvider'; } from './GeneralLedgerHeaderDimensionsPanelProvider';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Gereral ledger sheet header dismension panel. * Gereral ledger sheet header dismension panel.
@@ -27,15 +29,22 @@ export default function GeneralLedgerHeaderDimensionsPanel() {
function GeneralLedgerHeaderDimensionsPanelContent() { function GeneralLedgerHeaderDimensionsPanelContent() {
const { branches } = useGeneralLedgerHeaderDimensionsContext(); const { branches } = useGeneralLedgerHeaderDimensionsContext();
// Detarmines the feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -18,6 +18,8 @@ import withInventoryItemDetailsActions from './withInventoryItemDetailsActions';
import { getInventoryItemDetailsDefaultQuery } from './utils2'; import { getInventoryItemDetailsDefaultQuery } from './utils2';
import { compose, transformToForm } from '@/utils'; import { compose, transformToForm } from '@/utils';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Inventory item details header. * Inventory item details header.
@@ -58,11 +60,15 @@ function InventoryItemDetailsHeader({
toggleFilterDrawer(false); toggleFilterDrawer(false);
setSubmitting(false); setSubmitting(false);
}; };
// Handle drawer close action. // Handle drawer close action.
const handleDrawerClose = () => { const handleDrawerClose = () => {
toggleFilterDrawer(false); toggleFilterDrawer(false);
}; };
// Detarmines the given feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
const isWarehousesFeatureCan = featureCan(Features.Warehouses);
return ( return (
<InventoryItemDetailsDrawerHeader <InventoryItemDetailsDrawerHeader
@@ -81,11 +87,13 @@ function InventoryItemDetailsHeader({
title={<T id={'general'} />} title={<T id={'general'} />}
panel={<InventoryItemDetailsHeaderGeneralPanel />} panel={<InventoryItemDetailsHeaderGeneralPanel />}
/> />
<Tab {(isBranchesFeatureCan || isWarehousesFeatureCan) && (
id="dimensions" <Tab
title={<T id={'dimensions'} />} id="dimensions"
panel={<InventoryItemDetailsHeaderDimensionsPanel />} title={<T id={'dimensions'} />}
/> panel={<InventoryItemDetailsHeaderDimensionsPanel />}
/>
)}
</Tabs> </Tabs>
<div class="financial-header-drawer__footer"> <div class="financial-header-drawer__footer">
<Button className={'mr1'} intent={Intent.PRIMARY} type={'submit'}> <Button className={'mr1'} intent={Intent.PRIMARY} type={'submit'}>

View File

@@ -2,7 +2,12 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { FormGroup, Classes } from '@blueprintjs/core'; import { FormGroup, Classes } from '@blueprintjs/core';
import { BranchMultiSelect, WarehouseMultiSelect, Row, Col } from '@/components'; import {
BranchMultiSelect,
WarehouseMultiSelect,
Row,
Col,
} from '@/components';
import { import {
InventoryItemDetailsHeaderDimensionsProvider, InventoryItemDetailsHeaderDimensionsProvider,
useInventoryItemDetailsHeaderDimensionsPanelContext, useInventoryItemDetailsHeaderDimensionsPanelContext,
@@ -10,7 +15,7 @@ import {
/** /**
* Inventory Item deatil header dismension panel. * Inventory Item deatil header dismension panel.
* @returns * @returns {JSX.Element}
*/ */
export default function InventoryItemDetailsHeaderDimensionsPanel() { export default function InventoryItemDetailsHeaderDimensionsPanel() {
return ( return (
@@ -22,31 +27,40 @@ export default function InventoryItemDetailsHeaderDimensionsPanel() {
/** /**
* Inventory Valuation header dismension panel content. * Inventory Valuation header dismension panel content.
* @returns * @returns {JSX.Element}
*/ */
function InventoryItemDetailsHeaderDimensionsPanelContent() { function InventoryItemDetailsHeaderDimensionsPanelContent() {
const { warehouses, branches } = const { warehouses, branches } =
useInventoryItemDetailsHeaderDimensionsPanelContext(); useInventoryItemDetailsHeaderDimensionsPanelContext();
// Detarmines the given feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
const isWarehousesFeatureCan = featureCan(Features.warehouses);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
<FormGroup )}
label={intl.get('warehouses_multi_select.label')} {isWarehousesFeatureCan && (
className={Classes.FILL} <FormGroup
> label={intl.get('warehouses_multi_select.label')}
<WarehouseMultiSelect className={Classes.FILL}
name={'warehousesIds'} >
warehouses={warehouses} <WarehouseMultiSelect
/> name={'warehousesIds'}
</FormGroup> warehouses={warehouses}
/>
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -15,6 +15,8 @@ import withInventoryValuation from './withInventoryValuation';
import withInventoryValuationActions from './withInventoryValuationActions'; import withInventoryValuationActions from './withInventoryValuationActions';
import { compose, transformToForm } from '@/utils'; import { compose, transformToForm } from '@/utils';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* inventory valuation header. * inventory valuation header.
@@ -58,16 +60,19 @@ function InventoryValuationHeader({
toggleInventoryValuationFilterDrawer(false); toggleInventoryValuationFilterDrawer(false);
setSubmitting(false); setSubmitting(false);
}; };
// Handle drawer close action. // Handle drawer close action.
const handleDrawerClose = () => { const handleDrawerClose = () => {
toggleInventoryValuationFilterDrawer(false); toggleInventoryValuationFilterDrawer(false);
}; };
// Handle cancel button click. // Handle cancel button click.
const handleCancelClick = () => { const handleCancelClick = () => {
toggleInventoryValuationFilterDrawer(false); toggleInventoryValuationFilterDrawer(false);
}; };
// Detarmines the given feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
const isWarehousesFeatureCan = featureCan(Features.Warehouses);
return ( return (
<InventoryValuationDrawerHeader <InventoryValuationDrawerHeader
@@ -86,11 +91,13 @@ function InventoryValuationHeader({
title={<T id={'general'} />} title={<T id={'general'} />}
panel={<InventoryValuationHeaderGeneralPanel />} panel={<InventoryValuationHeaderGeneralPanel />}
/> />
<Tab {(isBranchesFeatureCan || isWarehousesFeatureCan) && (
id="dimensions" <Tab
title={<T id={'dimensions'} />} id="dimensions"
panel={<InventoryValuationHeaderDimensionsPanel />} title={<T id={'dimensions'} />}
/> panel={<InventoryValuationHeaderDimensionsPanel />}
/>
)}
</Tabs> </Tabs>
<div class="financial-header-drawer__footer"> <div class="financial-header-drawer__footer">
<Button className={'mr1'} intent={Intent.PRIMARY} type={'submit'}> <Button className={'mr1'} intent={Intent.PRIMARY} type={'submit'}>

View File

@@ -2,11 +2,18 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { FormGroup, Classes } from '@blueprintjs/core'; import { FormGroup, Classes } from '@blueprintjs/core';
import { BranchMultiSelect, WarehouseMultiSelect, Row, Col } from '@/components'; import {
BranchMultiSelect,
WarehouseMultiSelect,
Row,
Col,
} from '@/components';
import { import {
InventoryValuationHeaderDimensionsProvider, InventoryValuationHeaderDimensionsProvider,
useInventoryValuationHeaderDimensionsPanelContext, useInventoryValuationHeaderDimensionsPanelContext,
} from './InventoryValuationHeaderDimensionsPanelProvider'; } from './InventoryValuationHeaderDimensionsPanelProvider';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Inventory Valuation header dismension panel. * Inventory Valuation header dismension panel.
@@ -28,25 +35,34 @@ function InventoryValuationHeaderDimensionsPanelContent() {
const { warehouses, branches } = const { warehouses, branches } =
useInventoryValuationHeaderDimensionsPanelContext(); useInventoryValuationHeaderDimensionsPanelContext();
// Detarmines the given feature whether is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
const isWarehousesFeatureCan = featureCan(Features.Warehouses);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
<FormGroup )}
label={intl.get('warehouses_multi_select.label')} {isWarehousesFeatureCan && (
className={Classes.FILL} <FormGroup
> label={intl.get('warehouses_multi_select.label')}
<WarehouseMultiSelect className={Classes.FILL}
name={'warehousesIds'} >
warehouses={warehouses} <WarehouseMultiSelect
/> name={'warehousesIds'}
</FormGroup> warehouses={warehouses}
/>
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -16,6 +16,8 @@ import withProfitLoss from './withProfitLoss';
import withProfitLossActions from './withProfitLossActions'; import withProfitLossActions from './withProfitLossActions';
import { useProfitLossHeaderValidationSchema } from './utils'; import { useProfitLossHeaderValidationSchema } from './utils';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Profit/loss header. * Profit/loss header.
@@ -55,6 +57,10 @@ function ProfitLossHeader({
toggleFilterDrawer(false); toggleFilterDrawer(false);
}; };
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<ProfitLossSheetHeader <ProfitLossSheetHeader
isOpen={profitLossDrawerFilter} isOpen={profitLossDrawerFilter}
@@ -77,11 +83,13 @@ function ProfitLossHeader({
title={<T id={'profit_loss_sheet.comparisons'} />} title={<T id={'profit_loss_sheet.comparisons'} />}
panel={<ProfitLossSheetHeaderComparisonPanel />} panel={<ProfitLossSheetHeaderComparisonPanel />}
/> />
<Tab {isBranchesFeatureCan && (
id="dimensions" <Tab
title={<T id={'profit_loss_sheet.dimensions'} />} id="dimensions"
panel={<ProfitLossSheetHeaderDimensionsPanel />} title={<T id={'profit_loss_sheet.dimensions'} />}
/> panel={<ProfitLossSheetHeaderDimensionsPanel />}
/>
)}
</Tabs> </Tabs>
<div class="financial-header-drawer__footer"> <div class="financial-header-drawer__footer">

View File

@@ -7,10 +7,12 @@ import {
ProfitLossSheetHeaderDimensionsProvider, ProfitLossSheetHeaderDimensionsProvider,
useProfitLossSheetPanelContext, useProfitLossSheetPanelContext,
} from './ProfitLossSheetHeaderDimensionsProvider'; } from './ProfitLossSheetHeaderDimensionsProvider';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* profit loss Sheet Header dimensions panel. * profit loss Sheet Header dimensions panel.
* @returns * @returns {JSX.Element}
*/ */
export default function ProfitLossSheetHeaderDimensionsPanel() { export default function ProfitLossSheetHeaderDimensionsPanel() {
return ( return (
@@ -21,21 +23,26 @@ export default function ProfitLossSheetHeaderDimensionsPanel() {
} }
/** /**
* profit loss Sheet Header dimensions panel content. * Profit/Loss Sheet Header dimensions panel content.
* @returns * @returns {JSX.Element}
*/ */
function ProfitLossSheetHeaderDimensionsPanelContent() { function ProfitLossSheetHeaderDimensionsPanelContent() {
const { branches } = useProfitLossSheetPanelContext(); const { branches } = useProfitLossSheetPanelContext();
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -17,6 +17,8 @@ import withTrialBalance from './withTrialBalance';
import withTrialBalanceActions from './withTrialBalanceActions'; import withTrialBalanceActions from './withTrialBalanceActions';
import { compose, transformToForm } from '@/utils'; import { compose, transformToForm } from '@/utils';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Trial balance sheet header. * Trial balance sheet header.
@@ -40,6 +42,10 @@ function TrialBalanceSheetHeader({
.required() .required()
.label(intl.get('to_date')), .label(intl.get('to_date')),
}); });
// Detarmines whether the feature is enabled.
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
// Default values. // Default values.
const defaultValues = { const defaultValues = {
@@ -90,11 +96,13 @@ function TrialBalanceSheetHeader({
title={<T id={'general'} />} title={<T id={'general'} />}
panel={<TrialBalanceSheetHeaderGeneralPanel />} panel={<TrialBalanceSheetHeaderGeneralPanel />}
/> />
<Tab {isBranchesFeatureCan && (
id="dimensions" <Tab
title={<T id={'dimensions'} />} id="dimensions"
panel={<TrialBalanceSheetHeaderDimensionsPanel />} title={<T id={'dimensions'} />}
/> panel={<TrialBalanceSheetHeaderDimensionsPanel />}
/>
)}
</Tabs> </Tabs>
<div class="financial-header-drawer__footer"> <div class="financial-header-drawer__footer">

View File

@@ -7,10 +7,12 @@ import {
TrialBLHeaderDimensionsPanelProvider, TrialBLHeaderDimensionsPanelProvider,
useTrialBalanceSheetPanelContext, useTrialBalanceSheetPanelContext,
} from './TrialBalanceSheetHeaderDimensionsPanelProvider'; } from './TrialBalanceSheetHeaderDimensionsPanelProvider';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
/** /**
* Trial balance sheet header dismension panel. * Trial balance sheet header dismension panel.
* @returns * @returns {JSX.Element}
*/ */
export default function TrialBalanceSheetHeaderDimensionsPanel() { export default function TrialBalanceSheetHeaderDimensionsPanel() {
return ( return (
@@ -21,21 +23,26 @@ export default function TrialBalanceSheetHeaderDimensionsPanel() {
} }
/** /**
* trial balance sheet header dismension panel content. * Trial balance sheet header dismension panel content.
* @returns * @returns {JSX.Element}
*/ */
function TrialBLSheetHeaderDimensionsPanelContent() { function TrialBLSheetHeaderDimensionsPanelContent() {
const { branches } = useTrialBalanceSheetPanelContext(); const { branches } = useTrialBalanceSheetPanelContext();
const { featureCan } = useFeatureCan();
const isBranchesFeatureCan = featureCan(Features.Branches);
return ( return (
<Row> <Row>
<Col xs={4}> <Col xs={4}>
<FormGroup {isBranchesFeatureCan && (
label={intl.get('branches_multi_select.label')} <FormGroup
className={Classes.FILL} label={intl.get('branches_multi_select.label')}
> className={Classes.FILL}
<BranchMultiSelect name={'branchesIds'} branches={branches} /> >
</FormGroup> <BranchMultiSelect name={'branchesIds'} branches={branches} />
</FormGroup>
)}
</Col> </Col>
</Row> </Row>
); );

View File

@@ -44,6 +44,7 @@ function BillFormProvider({ billId, ...props }) {
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isWarehouseFeatureCan = featureCan(Features.Warehouses);
const isBranchFeatureCan = featureCan(Features.Branches); const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectsFeatureCan = featureCan(Features.Projects);
// Handle fetch accounts. // Handle fetch accounts.
const { data: accounts, isLoading: isAccountsLoading } = useAccounts(); const { data: accounts, isLoading: isAccountsLoading } = useAccounts();
@@ -86,7 +87,7 @@ function BillFormProvider({ billId, ...props }) {
const { const {
data: { projects }, data: { projects },
isLoading: isProjectsLoading, isLoading: isProjectsLoading,
} = useProjects(); } = useProjects({}, { enabled: !!isProjectsFeatureCan });
// Handle fetching bill settings. // Handle fetching bill settings.
const { isFetching: isSettingLoading } = useSettings(); const { isFetching: isSettingLoading } = useSettings();
@@ -101,7 +102,8 @@ function BillFormProvider({ billId, ...props }) {
const isNewMode = !billId; const isNewMode = !billId;
// Determines whether the warehouse and branches are loading. // Determines whether the warehouse and branches are loading.
const isFeatureLoading = isWarehouesLoading || isBranchesLoading; const isFeatureLoading =
isWarehouesLoading || isBranchesLoading || isProjectsLoading;
const provider = { const provider = {
accounts, accounts,

View File

@@ -27,6 +27,7 @@ function EstimateFormProvider({ query, estimateId, ...props }) {
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isWarehouseFeatureCan = featureCan(Features.Warehouses);
const isBranchFeatureCan = featureCan(Features.Branches); const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectsFeatureCan = featureCan(Features.Projects);
const { const {
data: estimate, data: estimate,
@@ -68,7 +69,7 @@ function EstimateFormProvider({ query, estimateId, ...props }) {
const { const {
data: { projects }, data: { projects },
isLoading: isProjectsLoading, isLoading: isProjectsLoading,
} = useProjects(); } = useProjects({}, { enabled: !!isProjectsFeatureCan });
// Handle fetch settings. // Handle fetch settings.
useSettingsEstimates(); useSettingsEstimates();
@@ -83,7 +84,8 @@ function EstimateFormProvider({ query, estimateId, ...props }) {
const isNewMode = !estimateId; const isNewMode = !estimateId;
// Determines whether the warehouse and branches are loading. // Determines whether the warehouse and branches are loading.
const isFeatureLoading = isWarehouesLoading || isBranchesLoading; const isFeatureLoading =
isWarehouesLoading || isBranchesLoading || isProjectsLoading;
// Provider payload. // Provider payload.
const provider = { const provider = {

View File

@@ -32,6 +32,7 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) {
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isWarehouseFeatureCan = featureCan(Features.Warehouses);
const isBranchFeatureCan = featureCan(Features.Branches); const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectsFeatureCan = featureCan(Features.Projects);
const { data: invoice, isLoading: isInvoiceLoading } = useInvoice(invoiceId, { const { data: invoice, isLoading: isInvoiceLoading } = useInvoice(invoiceId, {
enabled: !!invoiceId, enabled: !!invoiceId,
@@ -41,7 +42,7 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) {
const { const {
data: { projects }, data: { projects },
isLoading: isProjectsLoading, isLoading: isProjectsLoading,
} = useProjects(); } = useProjects({}, { enabled: !!isProjectsFeatureCan });
// Fetches the estimate by the given id. // Fetches the estimate by the given id.
const { data: estimate, isLoading: isEstimateLoading } = useEstimate( const { data: estimate, isLoading: isEstimateLoading } = useEstimate(
@@ -98,7 +99,8 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) {
const isNewMode = !invoiceId; const isNewMode = !invoiceId;
// Determines whether the warehouse and branches are loading. // Determines whether the warehouse and branches are loading.
const isFeatureLoading = isWarehouesLoading || isBranchesLoading; const isFeatureLoading =
isWarehouesLoading || isBranchesLoading || isProjectsLoading;
const provider = { const provider = {
invoice, invoice,

View File

@@ -27,6 +27,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
// Features guard. // Features guard.
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isBranchFeatureCan = featureCan(Features.Branches); const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectsFeatureCan = featureCan(Features.Projects);
// Fetches payment recevie details. // Fetches payment recevie details.
const { const {
@@ -62,7 +63,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
const { const {
data: { projects }, data: { projects },
isLoading: isProjectsLoading, isLoading: isProjectsLoading,
} = useProjects(); } = useProjects({}, { enabled: !!isProjectsFeatureCan });
// Detarmines whether the new mode. // Detarmines whether the new mode.
const isNewMode = !paymentReceiveId; const isNewMode = !paymentReceiveId;
@@ -82,7 +83,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
customers, customers,
branches, branches,
projects, projects,
isPaymentLoading, isPaymentLoading,
isAccountsLoading, isAccountsLoading,
isPaymentFetching, isPaymentFetching,

View File

@@ -26,6 +26,7 @@ function ReceiptFormProvider({ receiptId, ...props }) {
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isWarehouseFeatureCan = featureCan(Features.Warehouses);
const isBranchFeatureCan = featureCan(Features.Branches); const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectsFeatureCan = featureCan(Features.Projects);
// Fetch sale receipt details. // Fetch sale receipt details.
const { data: receipt, isLoading: isReceiptLoading } = useReceipt(receiptId, { const { data: receipt, isLoading: isReceiptLoading } = useReceipt(receiptId, {
@@ -89,7 +90,7 @@ function ReceiptFormProvider({ receiptId, ...props }) {
const { const {
data: { projects }, data: { projects },
isLoading: isProjectsLoading, isLoading: isProjectsLoading,
} = useProjects(); } = useProjects({}, { enabled: !!isProjectsFeatureCan });
// Fetch receipt settings. // Fetch receipt settings.
const { isLoading: isSettingLoading } = useSettingsReceipts(); const { isLoading: isSettingLoading } = useSettingsReceipts();

View File

@@ -14,10 +14,7 @@ import { store, persistor } from '@/store/createStore';
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
const whyDidYouRender = require('@welldone-software/why-did-you-render'); const whyDidYouRender = require('@welldone-software/why-did-you-render');
whyDidYouRender(React, { trackAllPureComponents: false });
whyDidYouRender(React, {
trackAllPureComponents: false,
});
} }
if (process.env.NODE_ENV !== 'development') { if (process.env.NODE_ENV !== 'development') {

View File

@@ -18,11 +18,11 @@
overflow: hidden; overflow: hidden;
.th { .th {
padding: 0.7rem 0.5rem; padding: 0.68rem 0.5rem;
background: #f5f5f5; background: #f5f5f5;
font-size: 14px; font-size: 14px;
color: #3b495d; color: #4E5B6F;
font-weight: 600; font-weight: 400;
border-bottom: 1px solid #d2dde2; border-bottom: 1px solid #d2dde2;
>div { >div {
@@ -389,7 +389,7 @@
.thead .th { .thead .th {
background: #fff; background: #fff;
color: #222222; color: #000;
border-bottom: 1px solid #000000; border-bottom: 1px solid #000000;
padding: 0.5rem; padding: 0.5rem;
} }