mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
Merge branch 'develop' into BIG-403-labels-of-add-money-in-out-menu-do-not-work
This commit is contained in:
@@ -8,7 +8,9 @@ import * as R from 'ramda';
|
|||||||
|
|
||||||
import { MenuItemNestedText, FormattedMessage as T } from '@/components';
|
import { MenuItemNestedText, FormattedMessage as T } from '@/components';
|
||||||
import { nestedArrayToflatten, filterAccountsByQuery } from '@/utils';
|
import { nestedArrayToflatten, filterAccountsByQuery } from '@/utils';
|
||||||
|
|
||||||
import { CLASSES } from '@/constants/classes';
|
import { CLASSES } from '@/constants/classes';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
|
||||||
@@ -129,7 +131,7 @@ function AccountsSelectListRoot({
|
|||||||
setSelectedAccount({ ...account });
|
setSelectedAccount({ ...account });
|
||||||
onAccountSelected && onAccountSelected(account);
|
onAccountSelected && onAccountSelected(account);
|
||||||
} else {
|
} else {
|
||||||
openDialog('account-form');
|
openDialog(DialogsName.AccountForm);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[setSelectedAccount, onAccountSelected, openDialog],
|
[setSelectedAccount, onAccountSelected, openDialog],
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { MenuItem } from '@blueprintjs/core';
|
|||||||
import { Suggest } from '@blueprintjs/select';
|
import { Suggest } from '@blueprintjs/select';
|
||||||
|
|
||||||
import { CLASSES } from '@/constants/classes';
|
import { CLASSES } from '@/constants/classes';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
import { MenuItemNestedText, FormattedMessage as T } from '@/components';
|
import { MenuItemNestedText, FormattedMessage as T } from '@/components';
|
||||||
import { nestedArrayToflatten, filterAccountsByQuery } from '@/utils';
|
import { nestedArrayToflatten, filterAccountsByQuery } from '@/utils';
|
||||||
|
|
||||||
@@ -134,7 +136,7 @@ function AccountsSuggestFieldRoot({
|
|||||||
setSelectedAccount({ ...account });
|
setSelectedAccount({ ...account });
|
||||||
onAccountSelected && onAccountSelected(account);
|
onAccountSelected && onAccountSelected(account);
|
||||||
} else {
|
} else {
|
||||||
openDialog('account-form');
|
openDialog(DialogsName.AccountForm);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[setSelectedAccount, onAccountSelected, openDialog],
|
[setSelectedAccount, onAccountSelected, openDialog],
|
||||||
|
|||||||
@@ -24,8 +24,11 @@ import {
|
|||||||
} from '@/components';
|
} from '@/components';
|
||||||
|
|
||||||
import { AccountAction, AbilitySubject } from '@/constants/abilityOption';
|
import { AccountAction, AbilitySubject } from '@/constants/abilityOption';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
import { useRefreshAccounts } from '@/hooks/query/accounts';
|
import { useRefreshAccounts } from '@/hooks/query/accounts';
|
||||||
import { useAccountsChartContext } from './AccountsChartProvider';
|
import { useAccountsChartContext } from './AccountsChartProvider';
|
||||||
|
|
||||||
import withAccounts from './withAccounts';
|
import withAccounts from './withAccounts';
|
||||||
import withAccountsTableActions from './withAccountsTableActions';
|
import withAccountsTableActions from './withAccountsTableActions';
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
@@ -65,7 +68,7 @@ function AccountsActionsBar({
|
|||||||
const { resourceViews, fields } = useAccountsChartContext();
|
const { resourceViews, fields } = useAccountsChartContext();
|
||||||
|
|
||||||
const onClickNewAccount = () => {
|
const onClickNewAccount = () => {
|
||||||
openDialog('account-form', {});
|
openDialog(DialogsName.AccountForm, {});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Accounts refresh action.
|
// Accounts refresh action.
|
||||||
|
|||||||
@@ -8,13 +8,15 @@ import {
|
|||||||
TableSkeletonHeader,
|
TableSkeletonHeader,
|
||||||
TableVirtualizedListRows,
|
TableVirtualizedListRows,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { TABLES } from '@/constants/tables';
|
|
||||||
import { useAccountsTableColumns, rowClassNames } from './utils';
|
import { useAccountsTableColumns, rowClassNames } from './utils';
|
||||||
import { ActionsMenu } from './components';
|
import { ActionsMenu } from './components';
|
||||||
|
import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils';
|
||||||
|
|
||||||
import { useAccountsChartContext } from './AccountsChartProvider';
|
import { useAccountsChartContext } from './AccountsChartProvider';
|
||||||
import { useMemorizedColumnsWidths } from '@/hooks';
|
import { useMemorizedColumnsWidths } from '@/hooks';
|
||||||
import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils';
|
|
||||||
|
import { TABLES } from '@/constants/tables';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
import withSettings from '@/containers/Settings/withSettings';
|
import withSettings from '@/containers/Settings/withSettings';
|
||||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||||
@@ -61,9 +63,9 @@ function AccountsDataTable({
|
|||||||
|
|
||||||
// Handle edit account action.
|
// Handle edit account action.
|
||||||
const handleEditAccount = (account) => {
|
const handleEditAccount = (account) => {
|
||||||
openDialog('account-form', {
|
openDialog(DialogsName.AccountForm, {
|
||||||
action: AccountDialogAction.Edit,
|
action: AccountDialogAction.Edit,
|
||||||
id: account.id,
|
accountId: account.id,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -74,7 +76,7 @@ function AccountsDataTable({
|
|||||||
|
|
||||||
// Handle new child button click.
|
// Handle new child button click.
|
||||||
const handleNewChildAccount = (account) => {
|
const handleNewChildAccount = (account) => {
|
||||||
openDialog('account-form', {
|
openDialog(DialogsName.AccountForm, {
|
||||||
action: AccountDialogAction.NewChild,
|
action: AccountDialogAction.NewChild,
|
||||||
parentAccountId: account.id,
|
parentAccountId: account.id,
|
||||||
accountType: account.account_type,
|
accountType: account.account_type,
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ import withDialogActions from '@/containers/Dialog/withDialogActions';
|
|||||||
import withCashflowAccountsTableActions from '../AccountTransactions/withCashflowAccountsTableActions';
|
import withCashflowAccountsTableActions from '../AccountTransactions/withCashflowAccountsTableActions';
|
||||||
|
|
||||||
import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils';
|
import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils';
|
||||||
|
|
||||||
import { ACCOUNT_TYPE } from '@/constants';
|
import { ACCOUNT_TYPE } from '@/constants';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
import { compose } from '@/utils';
|
import { compose } from '@/utils';
|
||||||
|
|
||||||
@@ -43,14 +45,14 @@ function CashFlowAccountsActionsBar({
|
|||||||
};
|
};
|
||||||
// Handle add bank account.
|
// Handle add bank account.
|
||||||
const handleAddBankAccount = () => {
|
const handleAddBankAccount = () => {
|
||||||
openDialog('account-form', {
|
openDialog(DialogsName.AccountForm, {
|
||||||
action: AccountDialogAction.NewDefinedType,
|
action: AccountDialogAction.NewDefinedType,
|
||||||
accountType: ACCOUNT_TYPE.CASH,
|
accountType: ACCOUNT_TYPE.CASH,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// Handle add cash account.
|
// Handle add cash account.
|
||||||
const handleAddCashAccount = () => {
|
const handleAddCashAccount = () => {
|
||||||
openDialog('account-form', {
|
openDialog(DialogsName.AccountForm, {
|
||||||
action: AccountDialogAction.NewDefinedType,
|
action: AccountDialogAction.NewDefinedType,
|
||||||
accountType: ACCOUNT_TYPE.BANK,
|
accountType: ACCOUNT_TYPE.BANK,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,24 +8,26 @@ import { Link } from 'react-router-dom';
|
|||||||
import { ContextMenu2 } from '@blueprintjs/popover2';
|
import { ContextMenu2 } from '@blueprintjs/popover2';
|
||||||
import { Menu, MenuItem, MenuDivider, Intent } from '@blueprintjs/core';
|
import { Menu, MenuItem, MenuDivider, Intent } from '@blueprintjs/core';
|
||||||
|
|
||||||
import { BankAccountsList, BankAccount, If, Icon, T, Can } from '@/components';
|
|
||||||
import {
|
import {
|
||||||
AccountAction,
|
AccountAction,
|
||||||
CashflowAction,
|
CashflowAction,
|
||||||
AbilitySubject,
|
AbilitySubject,
|
||||||
} from '@/constants/abilityOption';
|
} from '@/constants/abilityOption';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
import {
|
||||||
|
getAddMoneyInOptions,
|
||||||
|
getAddMoneyOutOptions,
|
||||||
|
} from '@/constants/cashflowOptions';
|
||||||
|
|
||||||
|
import { BankAccountsList, BankAccount, If, Icon, T, Can } from '@/components';
|
||||||
import { useCashFlowAccountsContext } from './CashFlowAccountsProvider';
|
import { useCashFlowAccountsContext } from './CashFlowAccountsProvider';
|
||||||
|
|
||||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
|
||||||
|
import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils';
|
||||||
import { safeCallback } from '@/utils';
|
import { safeCallback } from '@/utils';
|
||||||
import {
|
|
||||||
getAddMoneyInOptions,
|
|
||||||
getAddMoneyOutOptions,
|
|
||||||
} from '@/constants/cashflowOptions';
|
|
||||||
|
|
||||||
const CASHFLOW_SKELETON_N = 4;
|
const CASHFLOW_SKELETON_N = 4;
|
||||||
|
|
||||||
@@ -77,7 +79,10 @@ function CashflowBankAccount({
|
|||||||
};
|
};
|
||||||
// Handle edit account action.
|
// Handle edit account action.
|
||||||
const handleEditAccount = () => {
|
const handleEditAccount = () => {
|
||||||
openDialog('account-form', { action: 'edit', id: account.id });
|
openDialog(DialogsName.AccountForm, {
|
||||||
|
action: AccountDialogAction.Edit,
|
||||||
|
id: account.id,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
// Handle money in menu item actions.
|
// Handle money in menu item actions.
|
||||||
const handleMoneyInClick = (transactionType) => {
|
const handleMoneyInClick = (transactionType) => {
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import {
|
|||||||
Can,
|
Can,
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
|
|
||||||
import { AccountAction, AbilitySubject } from '@/constants/abilityOption';
|
import { AccountAction, AbilitySubject } from '@/constants/abilityOption';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||||
@@ -37,7 +39,7 @@ function AccountDrawerActionBar({
|
|||||||
|
|
||||||
// Handle new child button click.
|
// Handle new child button click.
|
||||||
const onNewChildAccount = () => {
|
const onNewChildAccount = () => {
|
||||||
openDialog('account-form', {
|
openDialog(DialogsName.AccountForm, {
|
||||||
action: AccountDialogAction.NewChild,
|
action: AccountDialogAction.NewChild,
|
||||||
parentAccountId: account.id,
|
parentAccountId: account.id,
|
||||||
accountType: account.account_type,
|
accountType: account.account_type,
|
||||||
@@ -45,9 +47,9 @@ function AccountDrawerActionBar({
|
|||||||
};
|
};
|
||||||
// Handle edit account action.
|
// Handle edit account action.
|
||||||
const onEditAccount = () => {
|
const onEditAccount = () => {
|
||||||
openDialog('account-form', {
|
openDialog(DialogsName.AccountForm, {
|
||||||
action: AccountDialogAction.Edit,
|
action: AccountDialogAction.Edit,
|
||||||
id: account.id,
|
accountId: account.id,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// Handle delete action account.
|
// Handle delete action account.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { defaultTo } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
@@ -15,6 +15,7 @@ import { useAccountDrawerContext } from './AccountDrawerProvider';
|
|||||||
*/
|
*/
|
||||||
export default function AccountDrawerHeader() {
|
export default function AccountDrawerHeader() {
|
||||||
const { account } = useAccountDrawerContext();
|
const { account } = useAccountDrawerContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'account-drawer__content-header'}>
|
<div className={'account-drawer__content-header'}>
|
||||||
<DetailsMenu>
|
<DetailsMenu>
|
||||||
@@ -50,7 +51,7 @@ export default function AccountDrawerHeader() {
|
|||||||
|
|
||||||
<DetailsMenu direction={'horizantal'}>
|
<DetailsMenu direction={'horizantal'}>
|
||||||
<DetailItem name={'description'} label={<T id={'description'} />}>
|
<DetailItem name={'description'} label={<T id={'description'} />}>
|
||||||
{defaultTo(account.description, '--')}
|
{!isEmpty(account.description) ? account.description : '--'}
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import intl from 'react-intl-universal';
|
|||||||
import { MenuItem, Menu, Button, Position } from '@blueprintjs/core';
|
import { MenuItem, Menu, Button, Position } from '@blueprintjs/core';
|
||||||
import { Popover2 } from '@blueprintjs/popover2';
|
import { Popover2 } from '@blueprintjs/popover2';
|
||||||
|
|
||||||
import { Align, CellType } from '@/constants';
|
import { Align, CellType, Features } from '@/constants';
|
||||||
import { Hint, Icon, FormattedMessage as T } from '@/components';
|
import { Hint, Icon, FormattedMessage as T } from '@/components';
|
||||||
import { formattedAmount } from '@/utils';
|
import { formattedAmount } from '@/utils';
|
||||||
import {
|
import {
|
||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
CheckBoxFieldCell,
|
CheckBoxFieldCell,
|
||||||
ProjectBillableEntriesCell,
|
ProjectBillableEntriesCell,
|
||||||
} from '@/components/DataTableCells';
|
} from '@/components/DataTableCells';
|
||||||
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item header cell.
|
* Item header cell.
|
||||||
@@ -88,6 +89,9 @@ const LandedCostHeaderCell = () => {
|
|||||||
* Retrieve editable items entries columns.
|
* Retrieve editable items entries columns.
|
||||||
*/
|
*/
|
||||||
export function useEditableItemsEntriesColumns({ landedCost }) {
|
export function useEditableItemsEntriesColumns({ landedCost }) {
|
||||||
|
const { featureCan } = useFeatureCan();
|
||||||
|
const isProjectsFeatureEnabled = featureCan(Features.Projects);
|
||||||
|
|
||||||
return React.useMemo(
|
return React.useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
@@ -154,15 +158,19 @@ export function useEditableItemsEntriesColumns({ landedCost }) {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
{
|
...(isProjectsFeatureEnabled
|
||||||
Header: '',
|
? [
|
||||||
accessor: 'invoicing',
|
{
|
||||||
Cell: ProjectBillableEntriesCell,
|
Header: '',
|
||||||
disableSortBy: true,
|
accessor: 'invoicing',
|
||||||
disableResizing: true,
|
Cell: ProjectBillableEntriesCell,
|
||||||
width: 45,
|
disableSortBy: true,
|
||||||
align: Align.Center,
|
disableResizing: true,
|
||||||
},
|
width: 45,
|
||||||
|
align: Align.Center,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
Header: '',
|
Header: '',
|
||||||
accessor: 'action',
|
accessor: 'action',
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { FastField, ErrorMessage } from 'formik';
|
import { FastField, ErrorMessage } from 'formik';
|
||||||
import { HTMLSelect, FormGroup, Intent, Position } from '@blueprintjs/core';
|
import { HTMLSelect, FormGroup, Intent, Position } from '@blueprintjs/core';
|
||||||
|
import { DateInput } from '@blueprintjs/datetime';
|
||||||
|
|
||||||
import { Row, Col, Hint } from '@/components';
|
import { Row, Col, Hint } from '@/components';
|
||||||
import { momentFormatter, parseDateRangeQuery } from '@/utils';
|
import { momentFormatter, parseDateRangeQuery } from '@/utils';
|
||||||
import { DateInput } from '@blueprintjs/datetime';
|
|
||||||
import { dateRangeOptions } from './constants';
|
import { dateRangeOptions } from './constants';
|
||||||
|
|
||||||
|
const FINANCIAL_REPORT_MAX_DATE = moment().add(5, 'years').toDate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Financial statement - Date range select.
|
* Financial statement - Date range select.
|
||||||
@@ -19,10 +21,7 @@ export default function FinancialStatementDateRange() {
|
|||||||
<Row>
|
<Row>
|
||||||
<Col xs={4}>
|
<Col xs={4}>
|
||||||
<FastField name={'date_range'}>
|
<FastField name={'date_range'}>
|
||||||
{({
|
{({ form: { setFieldValue }, field: { value } }) => (
|
||||||
form: { setFieldValue },
|
|
||||||
field: { value },
|
|
||||||
}) => (
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={intl.get('report_date_range')}
|
label={intl.get('report_date_range')}
|
||||||
labelInfo={<Hint />}
|
labelInfo={<Hint />}
|
||||||
@@ -40,8 +39,14 @@ export default function FinancialStatementDateRange() {
|
|||||||
const dateRange = parseDateRangeQuery(newValue);
|
const dateRange = parseDateRangeQuery(newValue);
|
||||||
|
|
||||||
if (dateRange) {
|
if (dateRange) {
|
||||||
setFieldValue('fromDate', moment(dateRange.fromDate).toDate());
|
setFieldValue(
|
||||||
setFieldValue('toDate', moment(dateRange.toDate).toDate());
|
'fromDate',
|
||||||
|
moment(dateRange.fromDate).toDate(),
|
||||||
|
);
|
||||||
|
setFieldValue(
|
||||||
|
'toDate',
|
||||||
|
moment(dateRange.toDate).toDate(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setFieldValue('dateRange', newValue);
|
setFieldValue('dateRange', newValue);
|
||||||
@@ -78,6 +83,7 @@ export default function FinancialStatementDateRange() {
|
|||||||
canClearSelection={false}
|
canClearSelection={false}
|
||||||
minimal={true}
|
minimal={true}
|
||||||
fill={true}
|
fill={true}
|
||||||
|
maxDate={FINANCIAL_REPORT_MAX_DATE}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
@@ -109,6 +115,7 @@ export default function FinancialStatementDateRange() {
|
|||||||
fill={true}
|
fill={true}
|
||||||
minimal={true}
|
minimal={true}
|
||||||
intent={error && Intent.DANGER}
|
intent={error && Intent.DANGER}
|
||||||
|
maxDate={FINANCIAL_REPORT_MAX_DATE}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|||||||
import { FormGroup, InputGroup, Classes, Position } from '@blueprintjs/core';
|
import { FormGroup, InputGroup, Classes, Position } from '@blueprintjs/core';
|
||||||
import { FastField, ErrorMessage } from 'formik';
|
import { FastField, ErrorMessage } from 'formik';
|
||||||
import { DateInput } from '@blueprintjs/datetime';
|
import { DateInput } from '@blueprintjs/datetime';
|
||||||
import { FormattedMessage as T } from '@/components';
|
import { FeatureCan, FormattedMessage as T } from '@/components';
|
||||||
import { CLASSES } from '@/constants/classes';
|
import { CLASSES } from '@/constants/classes';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -31,6 +31,7 @@ import {
|
|||||||
handleDateChange,
|
handleDateChange,
|
||||||
inputIntent,
|
inputIntent,
|
||||||
} from '@/utils';
|
} from '@/utils';
|
||||||
|
import { Features } from '@/constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill form header.
|
* Fill form header.
|
||||||
@@ -170,19 +171,21 @@ function BillFormHeader() {
|
|||||||
</FastField>
|
</FastField>
|
||||||
|
|
||||||
{/*------------ Project name -----------*/}
|
{/*------------ Project name -----------*/}
|
||||||
<FFormGroup
|
<FeatureCan feature={Features.Projects}>
|
||||||
name={'project_id'}
|
<FFormGroup
|
||||||
label={<T id={'bill.project_name.label'} />}
|
|
||||||
inline={true}
|
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
|
||||||
>
|
|
||||||
<ProjectsSelect
|
|
||||||
name={'project_id'}
|
name={'project_id'}
|
||||||
projects={projects}
|
label={<T id={'bill.project_name.label'} />}
|
||||||
input={BillProjectSelectButton}
|
inline={true}
|
||||||
popoverFill={true}
|
className={classNames('form-group--select-list', Classes.FILL)}
|
||||||
/>
|
>
|
||||||
</FFormGroup>
|
<ProjectsSelect
|
||||||
|
name={'project_id'}
|
||||||
|
projects={projects}
|
||||||
|
input={BillProjectSelectButton}
|
||||||
|
popoverFill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
</FeatureCan>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
ControlGroup,
|
ControlGroup,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import { DateInput } from '@blueprintjs/datetime';
|
import { DateInput } from '@blueprintjs/datetime';
|
||||||
import { FFormGroup, FormattedMessage as T } from '@/components';
|
import { FeatureCan, FFormGroup, FormattedMessage as T } from '@/components';
|
||||||
import { FastField, Field, ErrorMessage } from 'formik';
|
import { FastField, Field, ErrorMessage } from 'formik';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
} from '@/utils';
|
} from '@/utils';
|
||||||
import { customersFieldShouldUpdate } from './utils';
|
import { customersFieldShouldUpdate } from './utils';
|
||||||
import { CLASSES } from '@/constants/classes';
|
import { CLASSES } from '@/constants/classes';
|
||||||
|
import { Features } from '@/constants';
|
||||||
import {
|
import {
|
||||||
CustomerSelectField,
|
CustomerSelectField,
|
||||||
FieldRequiredHint,
|
FieldRequiredHint,
|
||||||
@@ -58,7 +59,6 @@ function EstimateFormHeader({
|
|||||||
const handleEstimateNumberBtnClick = () => {
|
const handleEstimateNumberBtnClick = () => {
|
||||||
openDialog('estimate-number-form', {});
|
openDialog('estimate-number-form', {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEstimateNoBlur = (form, field) => (event) => {
|
const handleEstimateNoBlur = (form, field) => (event) => {
|
||||||
const newValue = event.target.value;
|
const newValue = event.target.value;
|
||||||
|
|
||||||
@@ -71,7 +71,6 @@ function EstimateFormHeader({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Syncs estimate number settings with the form.
|
// Syncs estimate number settings with the form.
|
||||||
useObserveEstimateNoSettings(estimateNumberPrefix, estimateNextNumber);
|
useObserveEstimateNoSettings(estimateNumberPrefix, estimateNextNumber);
|
||||||
|
|
||||||
@@ -228,19 +227,21 @@ function EstimateFormHeader({
|
|||||||
</FastField>
|
</FastField>
|
||||||
|
|
||||||
{/*------------ Project name -----------*/}
|
{/*------------ Project name -----------*/}
|
||||||
<FFormGroup
|
<FeatureCan feature={Features.Projects}>
|
||||||
name={'project_id'}
|
<FFormGroup
|
||||||
label={<T id={'estimate.project_name.label'} />}
|
|
||||||
inline={true}
|
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
|
||||||
>
|
|
||||||
<ProjectsSelect
|
|
||||||
name={'project_id'}
|
name={'project_id'}
|
||||||
projects={projects}
|
label={<T id={'estimate.project_name.label'} />}
|
||||||
input={EstimateProjectSelectButton}
|
inline={true}
|
||||||
popoverFill={true}
|
className={classNames('form-group--select-list', Classes.FILL)}
|
||||||
/>
|
>
|
||||||
</FFormGroup>
|
<ProjectsSelect
|
||||||
|
name={'project_id'}
|
||||||
|
projects={projects}
|
||||||
|
input={EstimateProjectSelectButton}
|
||||||
|
popoverFill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
</FeatureCan>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
FieldRequiredHint,
|
FieldRequiredHint,
|
||||||
Icon,
|
Icon,
|
||||||
InputPrependButton,
|
InputPrependButton,
|
||||||
|
FeatureCan,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { momentFormatter, compose, tansformDateValue } from '@/utils';
|
import { momentFormatter, compose, tansformDateValue } from '@/utils';
|
||||||
import { CLASSES } from '@/constants/classes';
|
import { CLASSES } from '@/constants/classes';
|
||||||
@@ -40,6 +41,7 @@ import {
|
|||||||
ProjectsSelect,
|
ProjectsSelect,
|
||||||
ProjectBillableEntriesLink,
|
ProjectBillableEntriesLink,
|
||||||
} from '@/containers/Projects/components';
|
} from '@/containers/Projects/components';
|
||||||
|
import { Features } from '@/constants';
|
||||||
|
|
||||||
import withSettings from '@/containers/Settings/withSettings';
|
import withSettings from '@/containers/Settings/withSettings';
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
@@ -238,24 +240,26 @@ function InvoiceFormHeaderFields({
|
|||||||
</FastField>
|
</FastField>
|
||||||
|
|
||||||
{/*------------ Project name -----------*/}
|
{/*------------ Project name -----------*/}
|
||||||
<FFormGroup
|
<FeatureCan feature={Features.Projects}>
|
||||||
name={'project_id'}
|
<FFormGroup
|
||||||
label={<T id={'invoice.project_name.label'} />}
|
|
||||||
inline={true}
|
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
|
||||||
>
|
|
||||||
<ProjectsSelect
|
|
||||||
name={'project_id'}
|
name={'project_id'}
|
||||||
projects={projects}
|
label={<T id={'invoice.project_name.label'} />}
|
||||||
input={InvoiceProjectSelectButton}
|
inline={true}
|
||||||
popoverFill={true}
|
className={classNames('form-group--select-list', Classes.FILL)}
|
||||||
/>
|
>
|
||||||
{values?.project_id && (
|
<ProjectsSelect
|
||||||
<ProjectBillableEntriesLink projectId={values?.project_id}>
|
name={'project_id'}
|
||||||
<T id={'add_billable_entries'} />
|
projects={projects}
|
||||||
</ProjectBillableEntriesLink>
|
input={InvoiceProjectSelectButton}
|
||||||
)}
|
popoverFill={true}
|
||||||
</FFormGroup>
|
/>
|
||||||
|
{values?.project_id && (
|
||||||
|
<ProjectBillableEntriesLink projectId={values?.project_id}>
|
||||||
|
<T id={'add_billable_entries'} />
|
||||||
|
</ProjectBillableEntriesLink>
|
||||||
|
)}
|
||||||
|
</FFormGroup>
|
||||||
|
</FeatureCan>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import { DateInput } from '@blueprintjs/datetime';
|
import { DateInput } from '@blueprintjs/datetime';
|
||||||
import { FormattedMessage as T } from '@/components';
|
import { toSafeInteger } from 'lodash';
|
||||||
|
import { FeatureCan, FormattedMessage as T } from '@/components';
|
||||||
import { FastField, Field, useFormikContext, ErrorMessage } from 'formik';
|
import { FastField, Field, useFormikContext, ErrorMessage } from 'formik';
|
||||||
|
|
||||||
import { useAutofocus } from '@/hooks';
|
import { useAutofocus } from '@/hooks';
|
||||||
@@ -56,8 +57,7 @@ import {
|
|||||||
customersFieldShouldUpdate,
|
customersFieldShouldUpdate,
|
||||||
accountsFieldShouldUpdate,
|
accountsFieldShouldUpdate,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
import { Features } from '@/constants';
|
||||||
import { toSafeInteger } from 'lodash';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment receive header fields.
|
* Payment receive header fields.
|
||||||
@@ -341,19 +341,21 @@ function PaymentReceiveHeaderFields({
|
|||||||
</FastField>
|
</FastField>
|
||||||
|
|
||||||
{/*------------ Project name -----------*/}
|
{/*------------ Project name -----------*/}
|
||||||
<FFormGroup
|
<FeatureCan feature={Features.Projects}>
|
||||||
name={'project_id'}
|
<FFormGroup
|
||||||
label={<T id={'payment_receive.project_name.label'} />}
|
|
||||||
inline={true}
|
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
|
||||||
>
|
|
||||||
<ProjectsSelect
|
|
||||||
name={'project_id'}
|
name={'project_id'}
|
||||||
projects={projects}
|
label={<T id={'payment_receive.project_name.label'} />}
|
||||||
input={PaymentReceiveProjectSelectButton}
|
inline={true}
|
||||||
popoverFill={true}
|
className={classNames('form-group--select-list', Classes.FILL)}
|
||||||
/>
|
>
|
||||||
</FFormGroup>
|
<ProjectsSelect
|
||||||
|
name={'project_id'}
|
||||||
|
projects={projects}
|
||||||
|
input={PaymentReceiveProjectSelectButton}
|
||||||
|
popoverFill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
</FeatureCan>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
InputPrependButton,
|
InputPrependButton,
|
||||||
CustomerDrawerLink,
|
CustomerDrawerLink,
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
|
FeatureCan,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import withSettings from '@/containers/Settings/withSettings';
|
import withSettings from '@/containers/Settings/withSettings';
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
@@ -44,6 +45,7 @@ import {
|
|||||||
ReceiptExchangeRateInputField,
|
ReceiptExchangeRateInputField,
|
||||||
ReceiptProjectSelectButton,
|
ReceiptProjectSelectButton,
|
||||||
} from './components';
|
} from './components';
|
||||||
|
import { Features } from '@/constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receipt form header fields.
|
* Receipt form header fields.
|
||||||
@@ -238,19 +240,21 @@ function ReceiptFormHeader({
|
|||||||
</FastField>
|
</FastField>
|
||||||
|
|
||||||
{/*------------ Project name -----------*/}
|
{/*------------ Project name -----------*/}
|
||||||
<FFormGroup
|
<FeatureCan feature={Features.Projects}>
|
||||||
name={'project_id'}
|
<FFormGroup
|
||||||
label={<T id={'receipt.project_name.label'} />}
|
|
||||||
inline={true}
|
|
||||||
className={classNames('form-group--select-list', Classes.FILL)}
|
|
||||||
>
|
|
||||||
<ProjectsSelect
|
|
||||||
name={'project_id'}
|
name={'project_id'}
|
||||||
projects={projects}
|
label={<T id={'receipt.project_name.label'} />}
|
||||||
input={ReceiptProjectSelectButton}
|
inline={true}
|
||||||
popoverFill={true}
|
className={classNames('form-group--select-list', Classes.FILL)}
|
||||||
/>
|
>
|
||||||
</FFormGroup>
|
<ProjectsSelect
|
||||||
|
name={'project_id'}
|
||||||
|
projects={projects}
|
||||||
|
input={ReceiptProjectSelectButton}
|
||||||
|
popoverFill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
</FeatureCan>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user