mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat: add ability credit & vendor & item transactions.
This commit is contained in:
@@ -1,8 +1,51 @@
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
import {
|
||||||
|
AbilitySubject,
|
||||||
|
SaleEstimateAction,
|
||||||
|
SaleReceiptAction,
|
||||||
|
SaleInvoiceAction,
|
||||||
|
BillAction,
|
||||||
|
} from '../common/abilityOption';
|
||||||
|
import { useAbilitiesFilter } from '../hooks';
|
||||||
|
|
||||||
export default [
|
export const getItemPaymentTransactions = () => [
|
||||||
{ name: 'invoices', label: intl.get('invoices') },
|
{
|
||||||
{ name: 'estimates', label: intl.get('estimates') },
|
name: 'invoices',
|
||||||
{ name: 'receipts', label: intl.get('receipts') },
|
label: intl.get('invoices'),
|
||||||
{ name: 'bills', label: intl.get('bills') },
|
permission: {
|
||||||
|
subject: AbilitySubject.Invoice,
|
||||||
|
ability: SaleInvoiceAction.View,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'estimates',
|
||||||
|
label: intl.get('estimates'),
|
||||||
|
permission: {
|
||||||
|
subject: AbilitySubject.Estimate,
|
||||||
|
ability: SaleEstimateAction.View,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'receipts',
|
||||||
|
label: intl.get('receipts'),
|
||||||
|
permission: {
|
||||||
|
subject: AbilitySubject.Receipt,
|
||||||
|
ability: SaleReceiptAction.View,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bills',
|
||||||
|
label: intl.get('bills'),
|
||||||
|
permission: {
|
||||||
|
subject: AbilitySubject.Bill,
|
||||||
|
ability: BillAction.View,
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const useGetItemPaymentTransactionsMenu = () => {
|
||||||
|
const itemTransactionMenu = getItemPaymentTransactions();
|
||||||
|
const abilitiesFilter = useAbilitiesFilter();
|
||||||
|
|
||||||
|
return abilitiesFilter(itemTransactionMenu);
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ import { Tab } from '@blueprintjs/core';
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { DrawerMainTabs } from 'components';
|
import { Can, DrawerMainTabs } from 'components';
|
||||||
|
import {
|
||||||
|
PaymentMadeAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../common/abilityOption';
|
||||||
import BillDetailTab from './BillDetailTab';
|
import BillDetailTab from './BillDetailTab';
|
||||||
import LocatedLandedCostTable from './LocatedLandedCostTable';
|
import LocatedLandedCostTable from './LocatedLandedCostTable';
|
||||||
import BillGLEntriesTable from './BillGLEntriesTable';
|
import BillGLEntriesTable from './BillGLEntriesTable';
|
||||||
@@ -30,12 +33,13 @@ function BillDetailsTabs() {
|
|||||||
id={'journal_entries'}
|
id={'journal_entries'}
|
||||||
panel={<BillGLEntriesTable />}
|
panel={<BillGLEntriesTable />}
|
||||||
/>
|
/>
|
||||||
|
{/* <Can I={PaymentMadeAction.View} a={AbilitySubject.PaymentMade}> */}
|
||||||
<Tab
|
<Tab
|
||||||
title={intl.get('payment_transactions')}
|
title={intl.get('payment_transactions')}
|
||||||
id={'payment_transactions'}
|
id={'payment_transactions'}
|
||||||
panel={<BillPaymentTransactionTable />}
|
panel={<BillPaymentTransactionTable />}
|
||||||
/>
|
/>
|
||||||
|
{/* </Can> */}
|
||||||
<Tab
|
<Tab
|
||||||
title={intl.get('located_landed_cost')}
|
title={intl.get('located_landed_cost')}
|
||||||
id={'landed_cost'}
|
id={'landed_cost'}
|
||||||
|
|||||||
@@ -3,8 +3,12 @@ import intl from 'react-intl-universal';
|
|||||||
import { Intent, Menu, MenuItem } from '@blueprintjs/core';
|
import { Intent, Menu, MenuItem } from '@blueprintjs/core';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
import { CLASSES } from '../../../../common/classes';
|
import { CLASSES } from '../../../../common/classes';
|
||||||
import { FormatDateCell, Icon } from '../../../../components';
|
import { Can, FormatDateCell, Icon } from '../../../../components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
PaymentMadeAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table actions menu.
|
* Table actions menu.
|
||||||
@@ -15,17 +19,21 @@ export function ActionsMenu({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={PaymentMadeAction.Edit} a={AbilitySubject.PaymentMade}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
text={intl.get('invoice_transactions.action.edit_transaction')}
|
text={intl.get('invoice_transactions.action.edit_transaction')}
|
||||||
onClick={safeCallback(onEdit, original)}
|
onClick={safeCallback(onEdit, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
|
<Can I={PaymentMadeAction.Delete} a={AbilitySubject.PaymentMade}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('invoice_transactions.action.delete_transaction')}
|
text={intl.get('invoice_transactions.action.delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ import intl from 'react-intl-universal';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
import { Icon } from 'components';
|
import { Can, Icon } from 'components';
|
||||||
|
import { BillAction, AbilitySubject } from '../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions menu.
|
* Actions menu.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,12 +3,16 @@ import { Tab } from '@blueprintjs/core';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
import { DrawerMainTabs } from 'components';
|
import { Can, DrawerMainTabs } from 'components';
|
||||||
import CreditNoteDetailActionsBar from './CreditNoteDetailActionsBar';
|
import CreditNoteDetailActionsBar from './CreditNoteDetailActionsBar';
|
||||||
import CreditNoteDetailPanel from './CreditNoteDetailPanel';
|
import CreditNoteDetailPanel from './CreditNoteDetailPanel';
|
||||||
import RefundCreditNoteTransactionsTable from './RefundCreditNoteTransactions/RefundCreditNoteTransactionsTable';
|
import RefundCreditNoteTransactionsTable from './RefundCreditNoteTransactions/RefundCreditNoteTransactionsTable';
|
||||||
import ReconcileCreditNoteTransactionsTable from './ReconcileCreditNoteTransactions/ReconcileCreditNoteTransactionsTable';
|
import ReconcileCreditNoteTransactionsTable from './ReconcileCreditNoteTransactions/ReconcileCreditNoteTransactionsTable';
|
||||||
import { CreditNoteGLEntriesTable } from './JournalEntriesTransactions/JournalEntriesTransactionsTable';
|
import { CreditNoteGLEntriesTable } from './JournalEntriesTransactions/JournalEntriesTransactionsTable';
|
||||||
|
import {
|
||||||
|
CreditNoteAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credit Note view detail.
|
* Credit Note view detail.
|
||||||
@@ -40,6 +44,7 @@ function CreditNoteDetailsTabs() {
|
|||||||
id={'journal_entries'}
|
id={'journal_entries'}
|
||||||
panel={<CreditNoteGLEntriesTable />}
|
panel={<CreditNoteGLEntriesTable />}
|
||||||
/>
|
/>
|
||||||
|
{/* <Can I={CreditNoteAction.View} a={AbilitySubject.CreditNote}> */}
|
||||||
<Tab
|
<Tab
|
||||||
title={intl.get('credit_note.drawer.label_refund_transactions')}
|
title={intl.get('credit_note.drawer.label_refund_transactions')}
|
||||||
id={'refund_transactions'}
|
id={'refund_transactions'}
|
||||||
@@ -50,6 +55,7 @@ function CreditNoteDetailsTabs() {
|
|||||||
id={'reconcile_transactions'}
|
id={'reconcile_transactions'}
|
||||||
panel={<ReconcileCreditNoteTransactionsTable />}
|
panel={<ReconcileCreditNoteTransactionsTable />}
|
||||||
/>
|
/>
|
||||||
|
{/* </Can> */}
|
||||||
</DrawerMainTabs>
|
</DrawerMainTabs>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,17 @@ import withDialogActions from 'containers/Dialog/withDialogActions';
|
|||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import { DrawerActionsBar, Icon, FormattedMessage as T, If } from 'components';
|
import {
|
||||||
|
DrawerActionsBar,
|
||||||
|
Can,
|
||||||
|
Icon,
|
||||||
|
FormattedMessage as T,
|
||||||
|
If,
|
||||||
|
} from 'components';
|
||||||
|
import {
|
||||||
|
CreditNoteAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../common/abilityOption';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
import { CreditNoteMenuItem } from './utils';
|
import { CreditNoteMenuItem } from './utils';
|
||||||
@@ -58,6 +68,7 @@ function CreditNoteDetailActionsBar({
|
|||||||
return (
|
return (
|
||||||
<DrawerActionsBar>
|
<DrawerActionsBar>
|
||||||
<NavbarGroup>
|
<NavbarGroup>
|
||||||
|
<Can I={CreditNoteAction.Edit} a={AbilitySubject.CreditNote}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
@@ -65,6 +76,8 @@ function CreditNoteDetailActionsBar({
|
|||||||
onClick={handleEditCreditNote}
|
onClick={handleEditCreditNote}
|
||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
|
</Can>
|
||||||
|
<Can I={CreditNoteAction.Refund} a={AbilitySubject.CreditNote}>
|
||||||
<If condition={!creditNote.is_closed && !creditNote.is_draft}>
|
<If condition={!creditNote.is_closed && !creditNote.is_draft}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
@@ -74,6 +87,8 @@ function CreditNoteDetailActionsBar({
|
|||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
</If>
|
</If>
|
||||||
|
</Can>
|
||||||
|
<Can I={CreditNoteAction.Delete} a={AbilitySubject.CreditNote}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||||
@@ -81,6 +96,8 @@ function CreditNoteDetailActionsBar({
|
|||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={handleDeleteCreditNote}
|
onClick={handleDeleteCreditNote}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
|
<Can I={CreditNoteAction.Edit} a={AbilitySubject.CreditNote}>
|
||||||
<If condition={creditNote.is_published && !creditNote.is_closed}>
|
<If condition={creditNote.is_published && !creditNote.is_closed}>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
<CreditNoteMenuItem
|
<CreditNoteMenuItem
|
||||||
@@ -89,6 +106,7 @@ function CreditNoteDetailActionsBar({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
|
</Can>
|
||||||
</NavbarGroup>
|
</NavbarGroup>
|
||||||
</DrawerActionsBar>
|
</DrawerActionsBar>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { FormatDateCell, Icon } from 'components';
|
import { Can, FormatDateCell, Icon } from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
CreditNoteAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions menu.
|
* Actions menu.
|
||||||
@@ -10,12 +14,14 @@ import { safeCallback } from 'utils';
|
|||||||
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
|
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={CreditNoteAction.Delete} a={AbilitySubject.CreditNote}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
text={intl.get('delete_transaction')}
|
text={intl.get('delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { FormatDateCell, Icon } from 'components';
|
import { Can, FormatDateCell, Icon } from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
CreditNoteAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions menu.
|
* Actions menu.
|
||||||
@@ -10,12 +14,14 @@ import { safeCallback } from 'utils';
|
|||||||
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
|
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={CreditNoteAction.Delete} a={AbilitySubject.CreditNote}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
text={intl.get('delete_transaction')}
|
text={intl.get('delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -39,7 +45,9 @@ export function useRefundCreditTransactionsTableColumns() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'from_account',
|
id: 'from_account',
|
||||||
Header: intl.get('refund_credit_transactions.column.withdrawal_account'),
|
Header: intl.get(
|
||||||
|
'refund_credit_transactions.column.withdrawal_account',
|
||||||
|
),
|
||||||
accessor: ({ from_account }) => from_account.name,
|
accessor: ({ from_account }) => from_account.name,
|
||||||
width: 100,
|
width: 100,
|
||||||
className: 'from_account',
|
className: 'from_account',
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Tab } from '@blueprintjs/core';
|
import { Tab } from '@blueprintjs/core';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
import { DrawerMainTabs } from 'components';
|
import { Can, DrawerMainTabs } from 'components';
|
||||||
|
import {
|
||||||
|
PaymentReceiveAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../common/abilityOption';
|
||||||
import InvoiceDetailActionsBar from './InvoiceDetailActionsBar';
|
import InvoiceDetailActionsBar from './InvoiceDetailActionsBar';
|
||||||
import InvoiceGLEntriesTable from './InvoiceGLEntriesTable';
|
import InvoiceGLEntriesTable from './InvoiceGLEntriesTable';
|
||||||
import InvoicePaymentTransactionsTable from './InvoicePaymentTransactions/InvoicePaymentTransactionsTable';
|
import InvoicePaymentTransactionsTable from './InvoicePaymentTransactions/InvoicePaymentTransactionsTable';
|
||||||
@@ -19,17 +23,23 @@ function InvoiceDetailsTabs() {
|
|||||||
renderActiveTabPanelOnly={true}
|
renderActiveTabPanelOnly={true}
|
||||||
defaultSelectedTabId="details"
|
defaultSelectedTabId="details"
|
||||||
>
|
>
|
||||||
<Tab title={'Overview'} id={'details'} panel={<InvoiceDetailTab />} />
|
|
||||||
<Tab
|
<Tab
|
||||||
title={'Journal Entries'}
|
title={intl.get('overview')}
|
||||||
|
id={'details'}
|
||||||
|
panel={<InvoiceDetailTab />}
|
||||||
|
/>
|
||||||
|
<Tab
|
||||||
|
title={intl.get('journal_entries')}
|
||||||
id={'journal_entries'}
|
id={'journal_entries'}
|
||||||
panel={<InvoiceGLEntriesTable />}
|
panel={<InvoiceGLEntriesTable />}
|
||||||
/>
|
/>
|
||||||
|
{/* <Can I={PaymentReceiveAction.View} a={AbilitySubject.PaymentReceive}> */}
|
||||||
<Tab
|
<Tab
|
||||||
title={'Payment Transactions'}
|
title={intl.get('payment_transactions')}
|
||||||
id={'payment_transactions'}
|
id={'payment_transactions'}
|
||||||
panel={<InvoicePaymentTransactionsTable />}
|
panel={<InvoicePaymentTransactionsTable />}
|
||||||
/>
|
/>
|
||||||
|
{/* </Can> */}
|
||||||
</DrawerMainTabs>
|
</DrawerMainTabs>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,12 @@ import intl from 'react-intl-universal';
|
|||||||
import { Intent, Menu, MenuItem } from '@blueprintjs/core';
|
import { Intent, Menu, MenuItem } from '@blueprintjs/core';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
import { CLASSES } from '../../../../common/classes';
|
import { CLASSES } from '../../../../common/classes';
|
||||||
import { FormatDateCell, Icon } from '../../../../components';
|
import { FormatDateCell, Icon, Can } from '../../../../components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
PaymentReceiveAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table actions menu.
|
* Table actions menu.
|
||||||
@@ -15,17 +19,21 @@ export function ActionsMenu({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={PaymentReceiveAction.Edit} a={AbilitySubject.PaymentReceive}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
text={intl.get('invoice_transactions.action.edit_transaction')}
|
text={intl.get('invoice_transactions.action.edit_transaction')}
|
||||||
onClick={safeCallback(onEdit, original)}
|
onClick={safeCallback(onEdit, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
|
<Can I={PaymentReceiveAction.Delete} a={AbilitySubject.PaymentReceive}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('invoice_transactions.action.delete_transaction')}
|
text={intl.get('invoice_transactions.action.delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import { Intent, Menu, MenuItem } from '@blueprintjs/core';
|
|||||||
|
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
import { CLASSES } from '../../../../../common/classes';
|
import { CLASSES } from '../../../../../common/classes';
|
||||||
import { FormatDateCell, Icon } from '../../../../../components';
|
import { Can, FormatDateCell, Icon } from '../../../../../components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
BillAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table actions menu.
|
* Table actions menu.
|
||||||
@@ -16,17 +20,21 @@ export function ActionsMenu({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={BillAction.Edit} a={AbilitySubject.Bill}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
text={intl.get('invoice_transactions.action.edit_transaction')}
|
text={intl.get('invoice_transactions.action.edit_transaction')}
|
||||||
onClick={safeCallback(onEdit, original)}
|
onClick={safeCallback(onEdit, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
|
<Can I={BillAction.Delete} a={AbilitySubject.Bill}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('invoice_transactions.action.delete_transaction')}
|
text={intl.get('invoice_transactions.action.delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import { Intent, Menu, MenuItem } from '@blueprintjs/core';
|
|||||||
|
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
import { CLASSES } from '../../../../../common/classes';
|
import { CLASSES } from '../../../../../common/classes';
|
||||||
import { FormatDateCell, Icon } from '../../../../../components';
|
import { Can, FormatDateCell, Icon } from '../../../../../components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
SaleEstimateAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table actions menu.
|
* Table actions menu.
|
||||||
@@ -16,17 +20,21 @@ export function ActionsMenu({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={SaleEstimateAction.Edit} a={AbilitySubject.Estimate}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
text={intl.get('invoice_transactions.action.edit_transaction')}
|
text={intl.get('invoice_transactions.action.edit_transaction')}
|
||||||
onClick={safeCallback(onEdit, original)}
|
onClick={safeCallback(onEdit, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
|
<Can I={SaleEstimateAction.Delete} a={AbilitySubject.Estimate}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('invoice_transactions.action.delete_transaction')}
|
text={intl.get('invoice_transactions.action.delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import { Intent, Menu, MenuItem } from '@blueprintjs/core';
|
|||||||
|
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
import { CLASSES } from '../../../../../common/classes';
|
import { CLASSES } from '../../../../../common/classes';
|
||||||
import { FormatDateCell ,Icon} from '../../../../../components';
|
import { Can, FormatDateCell, Icon } from '../../../../../components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
SaleInvoiceAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table actions menu.
|
* Table actions menu.
|
||||||
@@ -17,17 +20,21 @@ export function ActionsMenu({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={SaleInvoiceAction.Edit} a={AbilitySubject.Invoice}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
text={intl.get('invoice_transactions.action.edit_transaction')}
|
text={intl.get('invoice_transactions.action.edit_transaction')}
|
||||||
onClick={safeCallback(onEdit, original)}
|
onClick={safeCallback(onEdit, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
|
<Can I={SaleInvoiceAction.Delete} a={AbilitySubject.Invoice}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('invoice_transactions.action.delete_transaction')}
|
text={intl.get('invoice_transactions.action.delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import { Intent, Menu, MenuItem } from '@blueprintjs/core';
|
|||||||
|
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
import { CLASSES } from '../../../../../common/classes';
|
import { CLASSES } from '../../../../../common/classes';
|
||||||
import { FormatDateCell, Icon } from '../../../../../components';
|
import { Can, FormatDateCell, Icon } from '../../../../../components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
SaleReceiptAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table actions menu.
|
* Table actions menu.
|
||||||
@@ -16,17 +20,21 @@ export function ActionsMenu({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={SaleReceiptAction.Edit} a={AbilitySubject.Receipt}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
text={intl.get('invoice_transactions.action.edit_transaction')}
|
text={intl.get('invoice_transactions.action.edit_transaction')}
|
||||||
onClick={safeCallback(onEdit, original)}
|
onClick={safeCallback(onEdit, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
|
<Can I={SaleReceiptAction.Edit} a={AbilitySubject.Receipt}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('invoice_transactions.action.delete_transaction')}
|
text={intl.get('invoice_transactions.action.delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,16 +10,21 @@ import {
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { FormattedMessage as T } from 'components';
|
import { FormattedMessage as T } from 'components';
|
||||||
import { useItemDetailDrawerContext } from '../ItemDetailDrawerProvider';
|
import { useItemDetailDrawerContext } from '../ItemDetailDrawerProvider';
|
||||||
import transactions from '../../../../common/itemPaymentTranactionsOption';
|
import { useGetItemPaymentTransactionsMenu } from '../../../../common/itemPaymentTranactionsOption';
|
||||||
|
|
||||||
export const ItemManuTransaction = ({ onChange }) => {
|
export const ItemManuTransaction = ({ onChange }) => {
|
||||||
const { value, setValue } = useItemDetailDrawerContext();
|
const { value, setValue } = useItemDetailDrawerContext();
|
||||||
|
const itemTransactionMenu = useGetItemPaymentTransactionsMenu();
|
||||||
|
|
||||||
|
if (itemTransactionMenu.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const handleClickItem = (item) => {
|
const handleClickItem = (item) => {
|
||||||
onChange && onChange(item);
|
onChange && onChange(item);
|
||||||
};
|
};
|
||||||
|
|
||||||
const content = transactions.map(({ name, label }) => (
|
const content = itemTransactionMenu.map(({ name, label }) => (
|
||||||
<MenuItem onClick={() => handleClickItem(name)} text={label} />
|
<MenuItem onClick={() => handleClickItem(name)} text={label} />
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { FormatDateCell, Icon } from 'components';
|
import { Can, FormatDateCell, Icon } from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
VendorCreditAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions menu.
|
* Actions menu.
|
||||||
@@ -10,12 +14,14 @@ import { safeCallback } from 'utils';
|
|||||||
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
|
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={VendorCreditAction.Delete} a={AbilitySubject.VendorCredit}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
text={intl.get('delete_transaction')}
|
text={intl.get('delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
|
||||||
import { FormatDateCell, Icon } from 'components';
|
import { Can, FormatDateCell, Icon } from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
VendorCreditAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions menu.
|
* Actions menu.
|
||||||
@@ -10,12 +14,14 @@ import { safeCallback } from 'utils';
|
|||||||
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
|
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
<Can I={VendorCreditAction.Delete} a={AbilitySubject.VendorCredit}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
text={intl.get('delete_transaction')}
|
text={intl.get('delete_transaction')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,16 @@ import { Tab } from '@blueprintjs/core';
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { DrawerMainTabs } from 'components';
|
import { Can, DrawerMainTabs } from 'components';
|
||||||
import VendorCreditDetailActionsBar from './VendorCreditDetailActionsBar';
|
import VendorCreditDetailActionsBar from './VendorCreditDetailActionsBar';
|
||||||
import VendorCreditDetailPanel from './VendorCreditDetailPanel';
|
import VendorCreditDetailPanel from './VendorCreditDetailPanel';
|
||||||
import RefundVendorCreditTransactionsTable from './RefundVendorCreditTransactions/RefundVendorCreditTransactionsTable';
|
import RefundVendorCreditTransactionsTable from './RefundVendorCreditTransactions/RefundVendorCreditTransactionsTable';
|
||||||
import ReconcileVendorCreditTransactionsTable from './ReconcileVendorCreditTransactions/ReconcileVendorCreditTransactionsTable';
|
import ReconcileVendorCreditTransactionsTable from './ReconcileVendorCreditTransactions/ReconcileVendorCreditTransactionsTable';
|
||||||
import { VendorCreditGLEntriesTable } from './JournalEntriesTransactions/JournalEntriesTransactionsTable';
|
import { VendorCreditGLEntriesTable } from './JournalEntriesTransactions/JournalEntriesTransactionsTable';
|
||||||
|
import {
|
||||||
|
VendorCreditAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vendor credit view detail.
|
* Vendor credit view detail.
|
||||||
@@ -40,6 +44,7 @@ function VendorCreditDetailsTabs() {
|
|||||||
id={'journal_entries'}
|
id={'journal_entries'}
|
||||||
panel={<VendorCreditGLEntriesTable />}
|
panel={<VendorCreditGLEntriesTable />}
|
||||||
/>
|
/>
|
||||||
|
{/* <Can I={VendorCreditAction.View} a={AbilitySubject.VendorCredit}> */}
|
||||||
<Tab
|
<Tab
|
||||||
title={intl.get('vendor_credit.drawer.label_refund_transactions')}
|
title={intl.get('vendor_credit.drawer.label_refund_transactions')}
|
||||||
id={'refund_transactions'}
|
id={'refund_transactions'}
|
||||||
@@ -50,6 +55,7 @@ function VendorCreditDetailsTabs() {
|
|||||||
id={'reconcile_transactions'}
|
id={'reconcile_transactions'}
|
||||||
panel={<ReconcileVendorCreditTransactionsTable />}
|
panel={<ReconcileVendorCreditTransactionsTable />}
|
||||||
/>
|
/>
|
||||||
|
{/* </Can> */}
|
||||||
</DrawerMainTabs>
|
</DrawerMainTabs>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ import {
|
|||||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||||
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
||||||
import { VendorCreditMenuItem } from './utils';
|
import { VendorCreditMenuItem } from './utils';
|
||||||
|
import {
|
||||||
|
VendorCreditAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../common/abilityOption';
|
||||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
@@ -59,6 +62,7 @@ function VendorCreditDetailActionsBar({
|
|||||||
return (
|
return (
|
||||||
<DashboardActionsBar>
|
<DashboardActionsBar>
|
||||||
<NavbarGroup>
|
<NavbarGroup>
|
||||||
|
<Can I={VendorCreditAction.Edit} a={AbilitySubject.VendorCredit}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
@@ -66,6 +70,8 @@ function VendorCreditDetailActionsBar({
|
|||||||
onClick={handleEditVendorCredit}
|
onClick={handleEditVendorCredit}
|
||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
|
</Can>
|
||||||
|
<Can I={VendorCreditAction.Refund} a={AbilitySubject.VendorCredit}>
|
||||||
<If condition={!vendorCredit.is_closed && !vendorCredit.is_draft}>
|
<If condition={!vendorCredit.is_closed && !vendorCredit.is_draft}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
@@ -75,6 +81,8 @@ function VendorCreditDetailActionsBar({
|
|||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
</If>
|
</If>
|
||||||
|
</Can>
|
||||||
|
<Can I={VendorCreditAction.Delete} a={AbilitySubject.VendorCredit}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||||
@@ -82,13 +90,9 @@ function VendorCreditDetailActionsBar({
|
|||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={handleDeleteVendorCredit}
|
onClick={handleDeleteVendorCredit}
|
||||||
/>
|
/>
|
||||||
<If
|
</Can>
|
||||||
condition={
|
<Can I={VendorCreditAction.Edit} a={AbilitySubject.VendorCredit}>
|
||||||
!vendorCredit.is_closed &&
|
<If condition={!vendorCredit.is_closed && !vendorCredit.is_draft}>
|
||||||
!vendorCredit.is_draft
|
|
||||||
// vendorCredit.is_published
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
<VendorCreditMenuItem
|
<VendorCreditMenuItem
|
||||||
payload={{
|
payload={{
|
||||||
@@ -96,6 +100,7 @@ function VendorCreditDetailActionsBar({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
|
</Can>
|
||||||
</NavbarGroup>
|
</NavbarGroup>
|
||||||
</DashboardActionsBar>
|
</DashboardActionsBar>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
|
Can,
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
DashboardActionViewsList,
|
DashboardActionViewsList,
|
||||||
AdvancedFilterPopover,
|
AdvancedFilterPopover,
|
||||||
@@ -19,7 +20,10 @@ import {
|
|||||||
import DashboardActionsBar from '../../../../components/Dashboard/DashboardActionsBar';
|
import DashboardActionsBar from '../../../../components/Dashboard/DashboardActionsBar';
|
||||||
|
|
||||||
import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider';
|
import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider';
|
||||||
|
import {
|
||||||
|
VendorCreditAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
import withVendorsCreditNotes from './withVendorsCreditNotes';
|
import withVendorsCreditNotes from './withVendorsCreditNotes';
|
||||||
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
|
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
|
||||||
import withSettings from '../../../Settings/withSettings';
|
import withSettings from '../../../Settings/withSettings';
|
||||||
@@ -84,12 +88,14 @@ function VendorsCreditNoteActionsBar({
|
|||||||
onChange={handleTabChange}
|
onChange={handleTabChange}
|
||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
|
<Can I={VendorCreditAction.Create} a={AbilitySubject.VendorCredit}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon={'plus'} />}
|
icon={<Icon icon={'plus'} />}
|
||||||
text={<T id={'vendor_credits.label.new_vendor_credit'} />}
|
text={<T id={'vendor_credits.label.new_vendor_credit'} />}
|
||||||
onClick={handleClickNewVendorCredit}
|
onClick={handleClickNewVendorCredit}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
<AdvancedFilterPopover
|
<AdvancedFilterPopover
|
||||||
advancedFilterProps={{
|
advancedFilterProps={{
|
||||||
conditions: vendorCreditFilterRoles,
|
conditions: vendorCreditFilterRoles,
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ import React from 'react';
|
|||||||
import { Button, Intent } from '@blueprintjs/core';
|
import { Button, Intent } from '@blueprintjs/core';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { EmptyStatus } from 'components';
|
import { EmptyStatus } from 'components';
|
||||||
import { FormattedMessage as T } from 'components';
|
import { Can, FormattedMessage as T } from 'components';
|
||||||
|
import {
|
||||||
|
VendorCreditAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
export default function VendorsCreditNoteEmptyStatus() {
|
export default function VendorsCreditNoteEmptyStatus() {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
@@ -16,6 +20,7 @@ export default function VendorsCreditNoteEmptyStatus() {
|
|||||||
}
|
}
|
||||||
action={
|
action={
|
||||||
<>
|
<>
|
||||||
|
<Can I={VendorCreditAction.Create} a={AbilitySubject.VendorCredit}>
|
||||||
<Button
|
<Button
|
||||||
intent={Intent.PRIMARY}
|
intent={Intent.PRIMARY}
|
||||||
large={true}
|
large={true}
|
||||||
@@ -27,6 +32,7 @@ export default function VendorsCreditNoteEmptyStatus() {
|
|||||||
<Button intent={Intent.NONE} large={true}>
|
<Button intent={Intent.NONE} large={true}>
|
||||||
<T id={'learn_more'} />
|
<T id={'learn_more'} />
|
||||||
</Button>
|
</Button>
|
||||||
|
</Can>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -10,8 +10,13 @@ import {
|
|||||||
Choose,
|
Choose,
|
||||||
If,
|
If,
|
||||||
Icon,
|
Icon,
|
||||||
|
Can,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
VendorCreditAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions menu.
|
* Actions menu.
|
||||||
@@ -27,19 +32,13 @@ export function ActionsMenu({
|
|||||||
text={intl.get('view_details')}
|
text={intl.get('view_details')}
|
||||||
onClick={safeCallback(onViewDetails, original)}
|
onClick={safeCallback(onViewDetails, original)}
|
||||||
/>
|
/>
|
||||||
|
<Can I={VendorCreditAction.Edit} a={AbilitySubject.VendorCredit}>
|
||||||
<MenuDivider />
|
<MenuDivider />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
text={intl.get('vendor_credits.action.edit_vendor_credit')}
|
text={intl.get('vendor_credits.action.edit_vendor_credit')}
|
||||||
onClick={safeCallback(onEdit, original)}
|
onClick={safeCallback(onEdit, original)}
|
||||||
/>
|
/>
|
||||||
<If condition={!original.is_closed && original.is_published}>
|
|
||||||
<MenuItem
|
|
||||||
icon={<Icon icon="quick-payment-16" />}
|
|
||||||
text={intl.get('vendor_credits.action.refund_vendor_credit')}
|
|
||||||
onClick={safeCallback(onRefund, original)}
|
|
||||||
/>
|
|
||||||
</If>
|
|
||||||
<If condition={original.is_draft}>
|
<If condition={original.is_draft}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon={'check'} iconSize={18} />}
|
icon={<Icon icon={'check'} iconSize={18} />}
|
||||||
@@ -47,19 +46,37 @@ export function ActionsMenu({
|
|||||||
onClick={safeCallback(onOpen, original)}
|
onClick={safeCallback(onOpen, original)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
<If condition={!original.is_draft && !original.is_closed && original.is_published}>
|
</Can>
|
||||||
|
<Can I={VendorCreditAction.Refund} a={AbilitySubject.VendorCredit}>
|
||||||
|
<If condition={!original.is_closed && original.is_published}>
|
||||||
|
<MenuItem
|
||||||
|
icon={<Icon icon="quick-payment-16" />}
|
||||||
|
text={intl.get('vendor_credits.action.refund_vendor_credit')}
|
||||||
|
onClick={safeCallback(onRefund, original)}
|
||||||
|
/>
|
||||||
|
</If>
|
||||||
|
</Can>
|
||||||
|
<Can I={VendorCreditAction.Edit} a={AbilitySubject.VendorCredit}>
|
||||||
|
<If
|
||||||
|
condition={
|
||||||
|
!original.is_draft && !original.is_closed && original.is_published
|
||||||
|
}
|
||||||
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
// icon={<Icon icon="quick-payment-16" />}
|
// icon={<Icon icon="quick-payment-16" />}
|
||||||
text={intl.get('vendor_credits.action.reconcile_with_bills')}
|
text={intl.get('vendor_credits.action.reconcile_with_bills')}
|
||||||
onClick={safeCallback(onReconcile, original)}
|
onClick={safeCallback(onReconcile, original)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
|
</Can>
|
||||||
|
<Can I={VendorCreditAction.Delete} a={AbilitySubject.VendorCredit}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('vendor_credits.action.delete_vendor_credit')}
|
text={intl.get('vendor_credits.action.delete_vendor_credit')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -83,8 +100,8 @@ export function StatusAccessor(creditNote) {
|
|||||||
</Tag>
|
</Tag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
|
|
||||||
<Choose.When condition={creditNote.is_draft} round={true}>
|
<Choose.When condition={creditNote.is_draft}>
|
||||||
<Tag minimal={true}>
|
<Tag minimal={true} round={true}>
|
||||||
<T id={'draft'} />
|
<T id={'draft'} />
|
||||||
</Tag>
|
</Tag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
|
Can,
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
DashboardActionViewsList,
|
DashboardActionViewsList,
|
||||||
AdvancedFilterPopover,
|
AdvancedFilterPopover,
|
||||||
@@ -19,7 +20,10 @@ import {
|
|||||||
import DashboardActionsBar from '../../../../components/Dashboard/DashboardActionsBar';
|
import DashboardActionsBar from '../../../../components/Dashboard/DashboardActionsBar';
|
||||||
|
|
||||||
import { useCreditNoteListContext } from './CreditNotesListProvider';
|
import { useCreditNoteListContext } from './CreditNotesListProvider';
|
||||||
|
import {
|
||||||
|
CreditNoteAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
import withCreditNotes from './withCreditNotes';
|
import withCreditNotes from './withCreditNotes';
|
||||||
import withCreditNotesActions from './withCreditNotesActions';
|
import withCreditNotesActions from './withCreditNotesActions';
|
||||||
import withSettings from '../../../Settings/withSettings';
|
import withSettings from '../../../Settings/withSettings';
|
||||||
@@ -78,12 +82,14 @@ function CreditNotesActionsBar({
|
|||||||
onChange={handleTabChange}
|
onChange={handleTabChange}
|
||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
|
<Can I={CreditNoteAction.Create} a={AbilitySubject.CreditNote}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon={'plus'} />}
|
icon={<Icon icon={'plus'} />}
|
||||||
text={<T id={'credit_note.label.new_credit_note'} />}
|
text={<T id={'credit_note.label.new_credit_note'} />}
|
||||||
onClick={handleClickNewCreateNote}
|
onClick={handleClickNewCreateNote}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
<AdvancedFilterPopover
|
<AdvancedFilterPopover
|
||||||
advancedFilterProps={{
|
advancedFilterProps={{
|
||||||
conditions: creditNoteFilterRoles,
|
conditions: creditNoteFilterRoles,
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ import React from 'react';
|
|||||||
import { Button, Intent } from '@blueprintjs/core';
|
import { Button, Intent } from '@blueprintjs/core';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { EmptyStatus } from 'components';
|
import { EmptyStatus } from 'components';
|
||||||
import { FormattedMessage as T } from 'components';
|
import { Can, FormattedMessage as T } from 'components';
|
||||||
|
import {
|
||||||
|
CreditNoteAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
export default function CreditNotesEmptyStatus() {
|
export default function CreditNotesEmptyStatus() {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
@@ -16,6 +20,7 @@ export default function CreditNotesEmptyStatus() {
|
|||||||
}
|
}
|
||||||
action={
|
action={
|
||||||
<>
|
<>
|
||||||
|
<Can I={CreditNoteAction.Create} a={AbilitySubject.CreditNote}>
|
||||||
<Button
|
<Button
|
||||||
intent={Intent.PRIMARY}
|
intent={Intent.PRIMARY}
|
||||||
large={true}
|
large={true}
|
||||||
@@ -27,6 +32,7 @@ export default function CreditNotesEmptyStatus() {
|
|||||||
<Button intent={Intent.NONE} large={true}>
|
<Button intent={Intent.NONE} large={true}>
|
||||||
<T id={'learn_more'} />
|
<T id={'learn_more'} />
|
||||||
</Button>
|
</Button>
|
||||||
|
</Can>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -10,8 +10,13 @@ import {
|
|||||||
Choose,
|
Choose,
|
||||||
If,
|
If,
|
||||||
Icon,
|
Icon,
|
||||||
|
Can,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import {
|
||||||
|
CreditNoteAction,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
export function ActionsMenu({
|
export function ActionsMenu({
|
||||||
payload: { onEdit, onDelete, onRefund, onOpen, onReconcile, onViewDetails },
|
payload: { onEdit, onDelete, onRefund, onOpen, onReconcile, onViewDetails },
|
||||||
@@ -24,6 +29,7 @@ export function ActionsMenu({
|
|||||||
text={intl.get('view_details')}
|
text={intl.get('view_details')}
|
||||||
onClick={safeCallback(onViewDetails, original)}
|
onClick={safeCallback(onViewDetails, original)}
|
||||||
/>
|
/>
|
||||||
|
<Can I={CreditNoteAction.Edit} a={AbilitySubject.CreditNote}>
|
||||||
<MenuDivider />
|
<MenuDivider />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="pen-18" />}
|
icon={<Icon icon="pen-18" />}
|
||||||
@@ -37,24 +43,34 @@ export function ActionsMenu({
|
|||||||
onClick={safeCallback(onOpen, original)}
|
onClick={safeCallback(onOpen, original)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
|
</Can>
|
||||||
|
|
||||||
|
<Can I={CreditNoteAction.Refund} a={AbilitySubject.CreditNote}>
|
||||||
<If condition={!original.is_closed && original.is_published}>
|
<If condition={!original.is_closed && original.is_published}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="quick-payment-16" />}
|
icon={<Icon icon="quick-payment-16" />}
|
||||||
text={intl.get('credit_note.action.refund_credit_note')}
|
text={intl.get('credit_note.action.refund_credit_note')}
|
||||||
onClick={safeCallback(onRefund, original)}
|
onClick={safeCallback(onRefund, original)}
|
||||||
/>
|
/>
|
||||||
|
</If>
|
||||||
|
</Can>
|
||||||
|
<Can I={CreditNoteAction.Edit} a={AbilitySubject.CreditNote}>
|
||||||
|
<If condition={!original.is_closed && original.is_published}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('credit_note.action.reconcile_with_invoices')}
|
text={intl.get('credit_note.action.reconcile_with_invoices')}
|
||||||
icon={<Icon icon="receipt-24" iconSize={16} />}
|
icon={<Icon icon="receipt-24" iconSize={16} />}
|
||||||
onClick={safeCallback(onReconcile, original)}
|
onClick={safeCallback(onReconcile, original)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
|
</Can>
|
||||||
|
<Can I={CreditNoteAction.Delete} a={AbilitySubject.CreditNote}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('credit_note.action.delete_credit_note')}
|
text={intl.get('credit_note.action.delete_credit_note')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
onClick={safeCallback(onDelete, original)}
|
onClick={safeCallback(onDelete, original)}
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
/>
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1145,7 +1145,7 @@
|
|||||||
"Landed": "Landed",
|
"Landed": "Landed",
|
||||||
"This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.": "This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.",
|
"This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.": "This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.",
|
||||||
"Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?": "Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?",
|
"Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?": "Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?",
|
||||||
"journal_entries": "Journal entries",
|
"journal_entries": "Journal Entries",
|
||||||
"contact": "Contact",
|
"contact": "Contact",
|
||||||
"invoice_details": "Invoice details",
|
"invoice_details": "Invoice details",
|
||||||
"receipt_details": "Receipt details",
|
"receipt_details": "Receipt details",
|
||||||
|
|||||||
Reference in New Issue
Block a user