mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
Merge branch 'develop' into main
This commit is contained in:
@@ -4,7 +4,12 @@ import { Popover2 } from '@blueprintjs/popover2';
|
||||
import { useFormikContext } from 'formik';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
import { ExchangeRateInputGroup, Icon, Hint, FormattedMessage as T } from 'components';
|
||||
import {
|
||||
ExchangeRateInputGroup,
|
||||
Icon,
|
||||
Hint,
|
||||
FormattedMessage as T,
|
||||
} from 'components';
|
||||
import {
|
||||
AccountsListFieldCell,
|
||||
MoneyFieldCell,
|
||||
@@ -63,7 +68,10 @@ export const ActionsCellRenderer = ({
|
||||
};
|
||||
const exampleMenu = (
|
||||
<Menu>
|
||||
<MenuItem onClick={handleClickRemoveRole} text="Remove line" />
|
||||
<MenuItem
|
||||
onClick={handleClickRemoveRole}
|
||||
text={intl.get('make_journal.entries.remove_row')}
|
||||
/>
|
||||
</Menu>
|
||||
);
|
||||
return (
|
||||
|
||||
@@ -95,9 +95,9 @@ function BillDetailActionsBar({
|
||||
onClick={handleQuickBillPayment}
|
||||
/>
|
||||
</If>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={BillAction.Delete} a={AbilitySubject.Bill}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||
|
||||
@@ -131,17 +131,17 @@ function CustomerDetailsActionsBar({
|
||||
/>
|
||||
</Popover>
|
||||
|
||||
<NavbarDivider />
|
||||
<Can I={CustomerAction.Edit} a={AbilitySubject.Customer}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={intl.get('customer.drawer.action.edit')}
|
||||
onClick={handleEditContact}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={CustomerAction.Delete} a={AbilitySubject.Customer}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||
|
||||
@@ -96,9 +96,9 @@ function EstimateDetailActionsBar({
|
||||
intent={Intent.DANGER}
|
||||
onClick={handleDeleteEstimate}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={SaleEstimateAction.NotifyBySms} a={AbilitySubject.Estimate}>
|
||||
<NavbarDivider />
|
||||
<MoreMenuItems
|
||||
payload={{
|
||||
onNotifyViaSMS: handleNotifyViaSMS,
|
||||
|
||||
@@ -55,9 +55,9 @@ function ExpenseDrawerActionBar({
|
||||
text={<T id={'edit_expense'} />}
|
||||
onClick={handleEditExpense}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={ExpenseAction.Delete} a={AbilitySubject.Expense}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
Col,
|
||||
DetailItem,
|
||||
DetailsMenu,
|
||||
FormatDate,
|
||||
ExchangeRateDetailItem,
|
||||
FormattedMessage as T,
|
||||
} from 'components';
|
||||
@@ -64,10 +65,12 @@ export default function ExpenseDrawerHeader() {
|
||||
minLabelSize={'180px'}
|
||||
>
|
||||
<DetailItem label={<T id={'published_at'} />}>
|
||||
{moment(expense.published_at).format('YYYY MMM DD')}
|
||||
<FormatDate value={expense.published_at} />
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={<T id={'created_at'} />}>2021 Aug 24</DetailItem>
|
||||
<DetailItem label={<T id={'created_at'} />}>
|
||||
<FormatDate value={expense.created_at} />
|
||||
</DetailItem>
|
||||
</DetailsMenu>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { useExpense } from 'hooks/query';
|
||||
import { DrawerLoading } from 'components';
|
||||
import { DrawerHeaderContent, DrawerLoading } from 'components';
|
||||
import { Features } from 'common';
|
||||
import { useFeatureCan } from 'hooks/state';
|
||||
|
||||
const ExpenseDrawerDrawerContext = React.createContext();
|
||||
|
||||
@@ -8,6 +11,9 @@ const ExpenseDrawerDrawerContext = React.createContext();
|
||||
* Expense drawer provider.
|
||||
*/
|
||||
function ExpenseDrawerProvider({ expenseId, ...props }) {
|
||||
// Features guard.
|
||||
const { featureCan } = useFeatureCan();
|
||||
|
||||
// Fetch the expense details.
|
||||
const {
|
||||
data: expense,
|
||||
@@ -28,6 +34,17 @@ function ExpenseDrawerProvider({ expenseId, ...props }) {
|
||||
|
||||
return (
|
||||
<DrawerLoading loading={isExpenseLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="expense-drawer"
|
||||
title={intl.get('expense.drawer.title')}
|
||||
subTitle={
|
||||
featureCan(Features.Branches)
|
||||
? intl.get('expense.drawer.subtitle', {
|
||||
value: expense.branch?.name,
|
||||
})
|
||||
: null
|
||||
}
|
||||
/>
|
||||
<ExpenseDrawerDrawerContext.Provider value={provider} {...props} />
|
||||
</DrawerLoading>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import React, { lazy } from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
import { Drawer, DrawerSuspense } from 'components';
|
||||
import withDrawers from 'containers/Drawer/withDrawers';
|
||||
|
||||
@@ -22,7 +20,6 @@ function ExpenseDrawer({
|
||||
<Drawer
|
||||
isOpen={isOpen}
|
||||
name={name}
|
||||
title={intl.get('expense.drawer.title')}
|
||||
size={'65%'}
|
||||
style={{ minWidth: '700px', maxWidth: '900px' }}
|
||||
>
|
||||
|
||||
@@ -5,7 +5,7 @@ import intl from 'react-intl-universal';
|
||||
import { defaultTo } from 'lodash';
|
||||
import clsx from 'classnames';
|
||||
|
||||
import { DetailsMenu, DetailItem } from 'components';
|
||||
import { DetailsMenu, DetailItem, FormatDate } from 'components';
|
||||
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
|
||||
|
||||
import InventoryAdjustmentDrawerCls from 'style/components/Drawers/InventoryAdjustmentDrawer.module.scss';
|
||||
@@ -20,7 +20,7 @@ export default function InventoryAdjustmentDetailHeader() {
|
||||
<div className={clsx(InventoryAdjustmentDrawerCls.detail_panel_header)}>
|
||||
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
|
||||
<DetailItem label={intl.get('date')}>
|
||||
{moment(inventoryAdjustment.date).format('YYYY MMM DD')}
|
||||
<FormatDate value={inventoryAdjustment.date} />
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={intl.get('type')}>
|
||||
@@ -36,7 +36,7 @@ export default function InventoryAdjustmentDetailHeader() {
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={intl.get('published_at')}>
|
||||
{moment(inventoryAdjustment.published_at).format('YYYY MMM DD')}
|
||||
<FormatDate value={inventoryAdjustment.published_at} />
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={intl.get('reason')}>
|
||||
@@ -44,7 +44,7 @@ export default function InventoryAdjustmentDetailHeader() {
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={intl.get('created_at')}>
|
||||
{moment(inventoryAdjustment.created_at).format('YYYY MMM DD')}
|
||||
<FormatDate value={inventoryAdjustment.created_at} />
|
||||
</DetailItem>
|
||||
</DetailsMenu>
|
||||
</div>
|
||||
|
||||
@@ -55,10 +55,9 @@ function ItemDetailActionsBar({
|
||||
text={<T id={'edit_item'} />}
|
||||
onClick={handleEditItem}
|
||||
/>
|
||||
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={ItemAction.Delete} a={AbilitySubject.Item}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { DrawerHeaderContent, DrawerLoading } from 'components';
|
||||
import { useItem } from 'hooks/query';
|
||||
import { inactiveStatus } from './utlis';
|
||||
|
||||
const ItemDetailDrawerContext = React.createContext();
|
||||
|
||||
@@ -27,7 +28,10 @@ function ItemDetailDrawerProvider({ itemId, ...props }) {
|
||||
|
||||
return (
|
||||
<DrawerLoading loading={isItemLoading}>
|
||||
<DrawerHeaderContent name="item-detail-drawer" title={item?.name} />
|
||||
<DrawerHeaderContent
|
||||
name="item-detail-drawer"
|
||||
title={inactiveStatus(item)}
|
||||
/>
|
||||
<ItemDetailDrawerContext.Provider value={provider} {...props} />
|
||||
</DrawerLoading>
|
||||
);
|
||||
|
||||
27
src/containers/Drawers/ItemDetailDrawer/utlis.js
Normal file
27
src/containers/Drawers/ItemDetailDrawer/utlis.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { Intent, Tag } from '@blueprintjs/core';
|
||||
import { Choose, FormattedMessage as T } from '../../../components';
|
||||
|
||||
/**
|
||||
* items inactive status.
|
||||
* @returns {React.JSX}
|
||||
*/
|
||||
export function inactiveStatus(item) {
|
||||
return (
|
||||
<Choose>
|
||||
<Choose.When condition={!item.active}>
|
||||
{item.name}
|
||||
<StatusTag intent={Intent.NONE} minimal={true} round={true}>
|
||||
<T id={'item.details.inactive'} />
|
||||
</StatusTag>
|
||||
</Choose.When>
|
||||
<Choose.Otherwise>{item.name}</Choose.Otherwise>
|
||||
</Choose>
|
||||
);
|
||||
}
|
||||
|
||||
const StatusTag = styled(Tag)`
|
||||
font-size: 11px;
|
||||
margin-left: 10px;
|
||||
`;
|
||||
@@ -55,9 +55,9 @@ function ManualJournalDrawerActionBar({
|
||||
text={<T id={'edit_journal'} />}
|
||||
onClick={handleEditManualJournal}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={ManualJournalAction.Delete} a={AbilitySubject.ManualJournal}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
|
||||
@@ -3,6 +3,8 @@ import React from 'react';
|
||||
import { Tag, Intent, Classes, Tooltip, Position } from '@blueprintjs/core';
|
||||
|
||||
import { T, Choose, FormatNumberCell, If, Icon } from '../../../components';
|
||||
import { Features } from 'common';
|
||||
import { useFeatureCan } from 'hooks/state';
|
||||
|
||||
/**
|
||||
* Note column accessor.
|
||||
@@ -46,8 +48,9 @@ export function ManualJournalDetailsStatus({ manualJournal }) {
|
||||
/**
|
||||
* Retrieve read-only manual journal entries columns.
|
||||
*/
|
||||
export const useManualJournalEntriesColumns = () =>
|
||||
React.useMemo(
|
||||
export const useManualJournalEntriesColumns = () => {
|
||||
const { featureCan } = useFeatureCan();
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: intl.get('account_name'),
|
||||
@@ -70,6 +73,17 @@ export const useManualJournalEntriesColumns = () =>
|
||||
disableSortBy: true,
|
||||
className: 'note',
|
||||
},
|
||||
...(featureCan(Features.Branches)
|
||||
? [
|
||||
{
|
||||
Header: intl.get('branch'),
|
||||
width: 130,
|
||||
accessor: 'branch.name',
|
||||
disableSortBy: true,
|
||||
className: 'branch',
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
Header: intl.get('credit'),
|
||||
accessor: 'credit',
|
||||
@@ -93,5 +107,6 @@ export const useManualJournalEntriesColumns = () =>
|
||||
align: 'right',
|
||||
},
|
||||
],
|
||||
[],
|
||||
[featureCan],
|
||||
);
|
||||
};
|
||||
|
||||
@@ -58,9 +58,9 @@ function PaymentMadeDetailActionsBar({
|
||||
text={<T id={'edit_payment_made'} />}
|
||||
onClick={handleEditPaymentMade}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={PaymentMadeAction.Delete} a={AbilitySubject.PaymentMade}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||
|
||||
@@ -95,12 +95,12 @@ function PaymentReceiveActionsBar({
|
||||
intent={Intent.DANGER}
|
||||
onClick={handleDeletePaymentReceive}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can
|
||||
I={PaymentReceiveAction.NotifyBySms}
|
||||
a={AbilitySubject.PaymentReceive}
|
||||
>
|
||||
<NavbarDivider />
|
||||
<MoreMenuItems
|
||||
payload={{
|
||||
onNotifyViaSMS: handleNotifyViaSMS,
|
||||
|
||||
@@ -92,9 +92,9 @@ function ReceiptDetailActionBar({
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDeleteReceipt)}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={SaleReceiptAction.NotifyBySms} a={AbilitySubject.Receipt}>
|
||||
<NavbarDivider />
|
||||
<MoreMenuItems
|
||||
payload={{
|
||||
onNotifyViaSMS: handleNotifyViaSMS,
|
||||
|
||||
@@ -79,10 +79,10 @@ function VendorCreditDetailActionsBar({
|
||||
text={<T id={'refund'} />}
|
||||
onClick={handleRefundVendorCredit}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</If>
|
||||
</Can>
|
||||
<Can I={VendorCreditAction.Delete} a={AbilitySubject.VendorCredit}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||
|
||||
@@ -102,17 +102,17 @@ function VendorDetailsActionsBar({
|
||||
icon={<Icon icon={'plus'} />}
|
||||
/>
|
||||
</Popover>
|
||||
<NavbarDivider />
|
||||
<Can I={VendorAction.Edit} a={AbilitySubject.Vendor}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={<T id={'vendor.drawer.action.edit'} />}
|
||||
onClick={safeCallback(onEditContact)}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
</Can>
|
||||
<Can I={VendorAction.Delete} a={AbilitySubject.Vendor}>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||
|
||||
@@ -43,7 +43,7 @@ export function ActionsCellRenderer({
|
||||
|
||||
const exampleMenu = (
|
||||
<Menu>
|
||||
<MenuItem onClick={onRemoveRole} text="Remove line" />
|
||||
<MenuItem onClick={onRemoveRole} text={'item_entries.remove_row'} />
|
||||
</Menu>
|
||||
);
|
||||
|
||||
|
||||
@@ -48,7 +48,10 @@ const ActionsCellRenderer = ({
|
||||
};
|
||||
const exampleMenu = (
|
||||
<Menu>
|
||||
<MenuItem onClick={handleClickRemoveRole} text="Remove line" />
|
||||
<MenuItem
|
||||
onClick={handleClickRemoveRole}
|
||||
text={intl.get('expense.entries.remove_row')}
|
||||
/>
|
||||
</Menu>
|
||||
);
|
||||
return (
|
||||
@@ -163,4 +166,4 @@ export function ExpensesExchangeRateInputField({ ...props }) {
|
||||
/>
|
||||
);
|
||||
}
|
||||
ExpensesExchangeRateInputField.cellType = CellType.Field;
|
||||
ExpensesExchangeRateInputField.cellType = CellType.Field;
|
||||
|
||||
@@ -18,6 +18,7 @@ function APAgingSummaryHeaderDimensionsProvider({ query, ...props }) {
|
||||
// Fetches the branches list.
|
||||
const { isLoading: isBranchesLoading, data: branches } = useBranches(query, {
|
||||
enabled: isBranchFeatureCan,
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
// Provider
|
||||
|
||||
@@ -18,6 +18,7 @@ function ARAgingSummaryHeaderDimensionsProvider({ query, ...props }) {
|
||||
// Fetches the branches list.
|
||||
const { isLoading: isBranchesLoading, data: branches } = useBranches(query, {
|
||||
enabled: isBranchFeatureCan,
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
// Provider
|
||||
|
||||
@@ -19,6 +19,7 @@ function BalanceSheetHeaderDimensionsProvider({ query, ...props }) {
|
||||
// Fetches the branches list.
|
||||
const { isLoading: isBranchesLoading, data: branches } = useBranches(query, {
|
||||
enabled: isBranchFeatureCan,
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
// Provider
|
||||
|
||||
@@ -10,16 +10,16 @@ const CashFlowStatementDimensionsPanelContext = React.createContext();
|
||||
* cash flow statement dimensions panel provider.
|
||||
* @returns
|
||||
*/
|
||||
function CashFlowStatementDimensionsPanelProvider({ query,...props }) {
|
||||
function CashFlowStatementDimensionsPanelProvider({ query, ...props }) {
|
||||
// Features guard.
|
||||
const { featureCan } = useFeatureCan();
|
||||
const isBranchFeatureCan = featureCan(Features.Branches);
|
||||
|
||||
// Fetches the branches list.
|
||||
const { isLoading: isBranchesLoading, data: branches } = useBranches(
|
||||
query,
|
||||
{ enabled: isBranchFeatureCan },
|
||||
);
|
||||
const { isLoading: isBranchesLoading, data: branches } = useBranches(query, {
|
||||
enabled: isBranchFeatureCan,
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
// Provider
|
||||
const provider = {
|
||||
|
||||
@@ -26,9 +26,9 @@ export const useCashFlowStatementColumns = () => {
|
||||
* Cash flow statement loading bar.
|
||||
*/
|
||||
export function CashFlowStatementLoadingBar() {
|
||||
const { isCashFlowLoading } = useCashFlowStatementContext();
|
||||
const { isCashFlowFetching } = useCashFlowStatementContext();
|
||||
return (
|
||||
<If condition={isCashFlowLoading}>
|
||||
<If condition={isCashFlowFetching}>
|
||||
<FinancialLoadingBar />
|
||||
</If>
|
||||
);
|
||||
|
||||
@@ -19,6 +19,7 @@ function GeneralLedgerHeaderDimensionsPanelProvider({ query, ...props }) {
|
||||
// Fetches the branches list.
|
||||
const { isLoading: isBranchesLoading, data: branches } = useBranches(query, {
|
||||
enabled: isBranchFeatureCan,
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
// Provider
|
||||
|
||||
@@ -3,7 +3,8 @@ import { FormGroup, Classes } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { AccountsMultiSelect, Row, Col } from 'components';
|
||||
import { AccountMultiSelect, Row, Col } from 'components';
|
||||
import { FFormGroup } from '../../../components/Forms';
|
||||
|
||||
import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange';
|
||||
import RadiosAccountingBasis from '../RadiosAccountingBasis';
|
||||
@@ -44,12 +45,13 @@ function GLHeaderGeneralPaneContent() {
|
||||
</Row>
|
||||
<Row>
|
||||
<Col xs={4}>
|
||||
<FormGroup
|
||||
<FFormGroup
|
||||
label={<T id={'specific_accounts'} />}
|
||||
className={classNames('form-group--select-list', Classes.FILL)}
|
||||
name={'accounts'}
|
||||
className={Classes.FILL}
|
||||
>
|
||||
<AccountsMultiSelect items={accounts} />
|
||||
</FormGroup>
|
||||
<AccountMultiSelect name="accounts" accounts={accounts} />
|
||||
</FFormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ export const getDefaultGeneralLedgerQuery = () => {
|
||||
basis: 'accural',
|
||||
filterByOption: 'with-transactions',
|
||||
branchesIds: [],
|
||||
accounts: [],
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -24,12 +24,13 @@ function InventoryValuationHeaderDimensionsProvider({ ...props }) {
|
||||
// Fetches the warehouses list.
|
||||
const { data: warehouses, isLoading: isWarehouesLoading } = useWarehouses(
|
||||
null,
|
||||
{ enabled: isWarehouseFeatureCan },
|
||||
{ enabled: isWarehouseFeatureCan, keepPreviousData: true },
|
||||
);
|
||||
|
||||
// Fetches the branches list.
|
||||
const { data: branches, isLoading: isBranchLoading } = useBranches(null, {
|
||||
enabled: isBranchFeatureCan,
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
// Provider
|
||||
|
||||
@@ -15,9 +15,12 @@ function ProfitLossSheetProvider({ query, ...props }) {
|
||||
isFetching,
|
||||
isLoading,
|
||||
refetch,
|
||||
} = useProfitLossSheet({
|
||||
...transformFilterFormToQuery(query),
|
||||
});
|
||||
} = useProfitLossSheet(
|
||||
{
|
||||
...transformFilterFormToQuery(query),
|
||||
},
|
||||
{ keepPreviousData: true },
|
||||
);
|
||||
|
||||
const provider = {
|
||||
profitLossSheet,
|
||||
|
||||
@@ -19,6 +19,7 @@ function ProfitLossSheetHeaderDimensionsProvider({ query, ...props }) {
|
||||
// Fetches the branches list.
|
||||
const { isLoading: isBranchesLoading, data: branches } = useBranches(query, {
|
||||
enabled: isBranchFeatureCan,
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
// Provider
|
||||
|
||||
@@ -18,6 +18,7 @@ function TrialBLHeaderDimensionsPanelProvider({ query, ...props }) {
|
||||
// Fetches the branches list.
|
||||
const { isLoading: isBranchesLoading, data: branches } = useBranches(query, {
|
||||
enabled: isBranchFeatureCan,
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
// Provider
|
||||
|
||||
@@ -47,11 +47,6 @@ export default function ItemFormPrimarySection() {
|
||||
<div class="mb1">
|
||||
<FormattedHTMLMessage id={'products_you_buy_and_or_sell'} />
|
||||
</div>
|
||||
<div class="mb1">
|
||||
<FormattedHTMLMessage
|
||||
id={'products_you_buy_and_or_sell_but_don_t_need'}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -86,7 +81,6 @@ export default function ItemFormPrimarySection() {
|
||||
disabled={!isNewMode && item.type === 'inventory'}
|
||||
>
|
||||
<Radio label={<T id={'service'} />} value="service" />
|
||||
<Radio label={<T id={'non_inventory'} />} value="non-inventory" />
|
||||
<Radio label={<T id={'inventory'} />} value="inventory" />
|
||||
</RadioGroup>
|
||||
</FormGroup>
|
||||
@@ -126,7 +120,11 @@ export default function ItemFormPrimarySection() {
|
||||
helperText={<ErrorMessage name={'code'} />}
|
||||
inline={true}
|
||||
>
|
||||
<InputGroup medium={true} intent={inputIntent({ error, touched })} {...field} />
|
||||
<InputGroup
|
||||
medium={true}
|
||||
intent={inputIntent({ error, touched })}
|
||||
{...field}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
@@ -64,7 +64,6 @@ export const transitionItemTypeKeyToLabel = (itemTypeKey) => {
|
||||
const table = {
|
||||
service: intl.get('service'),
|
||||
inventory: intl.get('inventory'),
|
||||
'non-inventory': intl.get('non_inventory'),
|
||||
};
|
||||
return typeof table[itemTypeKey] === 'string' ? table[itemTypeKey] : '';
|
||||
};
|
||||
@@ -104,6 +103,14 @@ export const handleDeleteErrors = (errors) => {
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
if (
|
||||
errors.find((error) => error.type === 'ITEM_HAS_ASSOCIATED_TRANSACTIONS')
|
||||
) {
|
||||
AppToaster.show({
|
||||
message: intl.get('item.error.you_could_not_delete_item_has_associated'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ function ItemsCategoryTable({
|
||||
loading={isCategoriesLoading}
|
||||
headerLoading={isCategoriesLoading}
|
||||
progressBarLoading={isCategoriesFetching}
|
||||
expandable={true}
|
||||
expandable={false}
|
||||
sticky={true}
|
||||
selectionColumn={true}
|
||||
TableLoadingRenderer={TableSkeletonRows}
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import * as Yup from 'yup';
|
||||
import moment from 'moment';
|
||||
import intl from 'react-intl-universal';
|
||||
import { DATATYPES_LENGTH } from 'common/dataTypes';
|
||||
import { isBlank } from 'utils';
|
||||
|
||||
const BillFormSchema = Yup.object().shape({
|
||||
vendor_id: Yup.number()
|
||||
.required()
|
||||
.label(intl.get('vendor_name_')),
|
||||
bill_date: Yup.date()
|
||||
.required()
|
||||
.label(intl.get('bill_date_')),
|
||||
vendor_id: Yup.number().required().label(intl.get('vendor_name_')),
|
||||
bill_date: Yup.date().required().label(intl.get('bill_date_')),
|
||||
due_date: Yup.date()
|
||||
.min(Yup.ref('bill_date'), ({ path, min }) =>
|
||||
intl.get('bill.validation.due_date', {
|
||||
path,
|
||||
min: moment(min).format('YYYY/MM/DD'),
|
||||
}),
|
||||
)
|
||||
.required()
|
||||
.label(intl.get('due_date_')),
|
||||
bill_number: Yup.string()
|
||||
@@ -25,7 +28,7 @@ const BillFormSchema = Yup.object().shape({
|
||||
open: Yup.boolean(),
|
||||
branch_id: Yup.string(),
|
||||
warehouse_id: Yup.string(),
|
||||
exchange_rate:Yup.number(),
|
||||
exchange_rate: Yup.number(),
|
||||
entries: Yup.array().of(
|
||||
Yup.object().shape({
|
||||
quantity: Yup.number()
|
||||
|
||||
@@ -3,24 +3,28 @@ import intl from 'react-intl-universal';
|
||||
import styled from 'styled-components';
|
||||
import { FFormGroup, FEditableText, FormattedMessage as T } from 'components';
|
||||
|
||||
/**
|
||||
* Payment made form footer left-side.
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
export function PaymentMadeFormFooterLeft() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
{/* --------- Statement--------- */}
|
||||
<StatementFormGroup
|
||||
name={'statement'}
|
||||
label={<T id={'payment_made_form.label.statement'} />}
|
||||
hintText={'Will be displayed on the Payment'}
|
||||
{/* --------- Internal Note--------- */}
|
||||
<InternalNoteFormGroup
|
||||
name={'internal_note'}
|
||||
label={<T id={'payment_made.form.internal_note.label'} />}
|
||||
>
|
||||
<FEditableText
|
||||
name={'statement'}
|
||||
placeholder={intl.get('payment_made_form.statement.placeholder')}
|
||||
name={'internal_note'}
|
||||
placeholder={intl.get('payment_made.form.internal_note.placeholder')}
|
||||
/>
|
||||
</StatementFormGroup>
|
||||
</InternalNoteFormGroup>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
const StatementFormGroup = styled(FFormGroup)`
|
||||
|
||||
const InternalNoteFormGroup = styled(FFormGroup)`
|
||||
&.bp3-form-group {
|
||||
margin-bottom: 40px;
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ function PaymentMadeFormProvider({ query, paymentMadeId, ...props }) {
|
||||
<DashboardInsider
|
||||
loading={
|
||||
isVendorsLoading ||
|
||||
isItemsFetching ||
|
||||
isItemsLoading ||
|
||||
isAccountsLoading ||
|
||||
isPaymentLoading
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ export function CreditNoteFormFooterLeft() {
|
||||
<CreditNoteMsgFormGroup
|
||||
name={'note'}
|
||||
label={<T id={'credit_note.label_customer_note'} />}
|
||||
hintText={'Will be displayed on the invoice'}
|
||||
>
|
||||
<FEditableText
|
||||
name={'note'}
|
||||
@@ -24,9 +23,9 @@ export function CreditNoteFormFooterLeft() {
|
||||
>
|
||||
<FEditableText
|
||||
name={'terms_conditions'}
|
||||
placeholder={
|
||||
<T id={'credit_note.label_terms_and_conditions.placeholder'} />
|
||||
}
|
||||
placeholder={intl.get(
|
||||
'credit_note.label_terms_and_conditions.placeholder',
|
||||
)}
|
||||
/>
|
||||
</TermsConditsFormGroup>
|
||||
</React.Fragment>
|
||||
|
||||
@@ -2,16 +2,19 @@ import * as Yup from 'yup';
|
||||
import intl from 'react-intl-universal';
|
||||
import { DATATYPES_LENGTH } from 'common/dataTypes';
|
||||
import { isBlank } from 'utils';
|
||||
import moment from 'moment';
|
||||
|
||||
const Schema = Yup.object().shape({
|
||||
customer_id: Yup.number()
|
||||
.label(intl.get('customer_name_'))
|
||||
.required(),
|
||||
estimate_date: Yup.date()
|
||||
.required()
|
||||
.label(intl.get('estimate_date_')),
|
||||
customer_id: Yup.number().label(intl.get('customer_name_')).required(),
|
||||
estimate_date: Yup.date().required().label(intl.get('estimate_date_')),
|
||||
expiration_date: Yup.date()
|
||||
.required()
|
||||
.min(Yup.ref('estimate_date'), ({ path, min }) =>
|
||||
intl.get('estimate.validation.expiration_date', {
|
||||
path,
|
||||
min: moment(min).format('YYYY/MM/DD'),
|
||||
}),
|
||||
)
|
||||
.label(intl.get('expiration_date_')),
|
||||
estimate_number: Yup.string()
|
||||
.max(DATATYPES_LENGTH.STRING)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as Yup from 'yup';
|
||||
import moment from 'moment';
|
||||
import intl from 'react-intl-universal';
|
||||
import { DATATYPES_LENGTH } from 'common/dataTypes';
|
||||
import { isBlank } from 'utils';
|
||||
@@ -7,7 +8,15 @@ const getSchema = () =>
|
||||
Yup.object().shape({
|
||||
customer_id: Yup.string().label(intl.get('customer_name_')).required(),
|
||||
invoice_date: Yup.date().required().label(intl.get('invoice_date_')),
|
||||
due_date: Yup.date().required().label(intl.get('due_date_')),
|
||||
due_date: Yup.date()
|
||||
.min(Yup.ref('invoice_date'), ({ path, min }) =>
|
||||
intl.get('invoice.validation.due_date', {
|
||||
path,
|
||||
min: moment(min).format('YYYY/MM/DD'),
|
||||
}),
|
||||
)
|
||||
.required()
|
||||
.label(intl.get('due_date_')),
|
||||
invoice_no: Yup.string()
|
||||
.max(DATATYPES_LENGTH.STRING)
|
||||
.label(intl.get('invoice_no_')),
|
||||
|
||||
@@ -10,7 +10,6 @@ export function InvoiceFormFooterLeft() {
|
||||
<InvoiceMsgFormGroup
|
||||
name={'invoice_message'}
|
||||
label={<T id={'invoice_message'} />}
|
||||
hintText={'Will be displayed on the invoice'}
|
||||
>
|
||||
<FEditableText
|
||||
name={'invoice_message'}
|
||||
@@ -20,7 +19,7 @@ export function InvoiceFormFooterLeft() {
|
||||
|
||||
{/* --------- Terms and conditions --------- */}
|
||||
<TermsConditsFormGroup
|
||||
label={<T id={'invoice_form.label.invoice_message'} />}
|
||||
label={<T id={'invoice_form.label.terms_conditions'} />}
|
||||
name={'terms_conditions'}
|
||||
>
|
||||
<FEditableText
|
||||
|
||||
@@ -7,14 +7,24 @@ export function PaymentReceiveFormFootetLeft() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
{/* --------- Statement--------- */}
|
||||
<TermsConditsFormGroup
|
||||
name={'statement'}
|
||||
label={<T id={'payment_receive_form.label.statement'} />}
|
||||
hintText={'Will be displayed on the Payment'}
|
||||
<PaymentMsgFormGroup
|
||||
name={'message'}
|
||||
label={<T id={'payment_receive_form.message.label'} />}
|
||||
>
|
||||
<FEditableText
|
||||
name={'statement'}
|
||||
placeholder={intl.get('payment_receive_form.statement.placeholder')}
|
||||
name={'message'}
|
||||
placeholder={intl.get('payment_receive_form.message.placeholder')}
|
||||
/>
|
||||
</PaymentMsgFormGroup>
|
||||
|
||||
{/* --------- Internal Note--------- */}
|
||||
<TermsConditsFormGroup
|
||||
name={'internal_note'}
|
||||
label={<T id={'payment_receive_form.label.note'} />}
|
||||
>
|
||||
<FEditableText
|
||||
name={'internal_note'}
|
||||
placeholder={intl.get('payment_receive_form.internal_note.placeholder')}
|
||||
/>
|
||||
</TermsConditsFormGroup>
|
||||
</React.Fragment>
|
||||
@@ -32,3 +42,17 @@ const TermsConditsFormGroup = styled(FFormGroup)`
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const PaymentMsgFormGroup = styled(FFormGroup)`
|
||||
&.bp3-form-group {
|
||||
margin-bottom: 40px;
|
||||
|
||||
.bp3-label {
|
||||
font-size: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.bp3-form-content {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -18,16 +18,18 @@ export function ReceiptFormFooterLeft() {
|
||||
/>
|
||||
</ReceiptMsgFormGroup>
|
||||
|
||||
{/* --------- Statement--------- */}
|
||||
<StatementFormGroup
|
||||
label={<T id={'receipt_form.label.statement'} />}
|
||||
name={'statement'}
|
||||
{/* --------- Terms and conditions --------- */}
|
||||
<TermsConditsFormGroup
|
||||
label={<T id={'receipt_form.label.terms_conditions'} />}
|
||||
name={'terms_conditions'}
|
||||
>
|
||||
<FEditableText
|
||||
name={'statement'}
|
||||
placeholder={intl.get('receipt_form.statement.placeholder')}
|
||||
name={'terms_conditions'}
|
||||
placeholder={intl.get(
|
||||
'receipt_form.terms_and_conditions.placeholder',
|
||||
)}
|
||||
/>
|
||||
</StatementFormGroup>
|
||||
</TermsConditsFormGroup>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
@@ -46,7 +48,7 @@ const ReceiptMsgFormGroup = styled(FFormGroup)`
|
||||
}
|
||||
`;
|
||||
|
||||
const StatementFormGroup = styled(FFormGroup)`
|
||||
const TermsConditsFormGroup = styled(FFormGroup)`
|
||||
&.bp3-form-group {
|
||||
.bp3-label {
|
||||
font-size: 12px;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Formik, Form } from 'formik';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { isEmpty, sumBy } from 'lodash';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { CLASSES } from 'common/classes';
|
||||
@@ -20,7 +20,7 @@ import WarehouseTransferFormDialog from './WarehouseTransferFormDialog';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
import { AppToaster, } from 'components';
|
||||
import { AppToaster } from 'components';
|
||||
import { useWarehouseTransferFormContext } from './WarehouseTransferFormProvider';
|
||||
import { compose, orderingLinesIndexes, transactionNumber } from 'utils';
|
||||
import { WarehouseTransferObserveItemsCost } from './components';
|
||||
@@ -119,7 +119,7 @@ function WarehouseTransferForm({
|
||||
.catch(onError);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
@@ -141,7 +141,7 @@ function WarehouseTransferForm({
|
||||
<WarehouseTransferFormFooter />
|
||||
<WarehouseTransferFormDialog />
|
||||
<WarehouseTransferFloatingActions />
|
||||
<WarehouseTransferObserveItemsCost />
|
||||
<WarehouseTransferObserveItemsCost />
|
||||
</Form>
|
||||
</Formik>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@ const Schema = Yup.object().shape({
|
||||
Yup.object().shape({
|
||||
item_id: Yup.number().nullable(),
|
||||
description: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
|
||||
quantity: Yup.number().nullable().max(DATATYPES_LENGTH.INT_10),
|
||||
quantity: Yup.number().min(1).max(DATATYPES_LENGTH.INT_10),
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function WarehouseTransferFormEntriesTable({
|
||||
item_id: newRowMeta.itemId,
|
||||
warehouses: newRowMeta.warehouses,
|
||||
description: '',
|
||||
quantity: 0,
|
||||
quantity: '',
|
||||
};
|
||||
const newRows = mutateTableRow(newRowMeta.rowIndex, newRow, entries);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import intl from 'react-intl-universal';
|
||||
import { FFormGroup, FEditableText, FormattedMessage as T } from 'components';
|
||||
|
||||
export function WarehouseTransferFormFooterLeft() {
|
||||
@@ -7,14 +8,12 @@ export function WarehouseTransferFormFooterLeft() {
|
||||
<React.Fragment>
|
||||
{/* --------- Terms and conditions --------- */}
|
||||
<TermsConditsFormGroup
|
||||
label={<T id={'terms_conditions'} />}
|
||||
label={<T id={'warehouse_transfer.form.reason.label'} />}
|
||||
name={'reason'}
|
||||
>
|
||||
<FEditableText
|
||||
name={'reason'}
|
||||
placeholder={
|
||||
'Enter the terms and conditions of your business to be displayed in your transaction'
|
||||
}
|
||||
placeholder={intl.get('warehouse_transfer.form.reason.placeholder')}
|
||||
/>
|
||||
</TermsConditsFormGroup>
|
||||
</React.Fragment>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { useFormikContext } from 'formik';
|
||||
import intl from 'react-intl-universal';
|
||||
import { CLASSES } from 'common/classes';
|
||||
|
||||
import WarehouseTransferFormHeaderFields from './WarehouseTransferFormHeaderFields';
|
||||
|
||||
@@ -183,20 +183,6 @@ function WarehouseTransferFormHeaderFields({
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
{/*------------ reason -----------*/}
|
||||
<FastField name={'reason'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'reason'} />}
|
||||
className={'form-group--reason'}
|
||||
intent={inputIntent({ error, touched })}
|
||||
inline={true}
|
||||
helperText={<ErrorMessage name={'reason'} />}
|
||||
>
|
||||
<InputGroup minimal={true} {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,10 @@ export function ActionsCellRenderer({
|
||||
|
||||
const exampleMenu = (
|
||||
<Menu>
|
||||
<MenuItem onClick={onRemoveRole} text="Remove line" />
|
||||
<MenuItem
|
||||
onClick={onRemoveRole}
|
||||
text={intl.get('warehouse_transfer.entries.remove_row')}
|
||||
/>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user