mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
feat(InvoiceDetails): invoice payment transactions ability access control.
This commit is contained in:
@@ -3,7 +3,8 @@ 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 { Can, DrawerMainTabs } from 'components';
|
import { useAbilityContext } from 'hooks/utils';
|
||||||
|
import { DrawerMainTabs } from 'components';
|
||||||
import {
|
import {
|
||||||
PaymentReceiveAction,
|
PaymentReceiveAction,
|
||||||
AbilitySubject,
|
AbilitySubject,
|
||||||
@@ -18,6 +19,8 @@ import InvoiceDetailTab from './InvoiceDetailTab';
|
|||||||
* @returns {React.JSX}
|
* @returns {React.JSX}
|
||||||
*/
|
*/
|
||||||
function InvoiceDetailsTabs() {
|
function InvoiceDetailsTabs() {
|
||||||
|
const ability = useAbilityContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DrawerMainTabs
|
<DrawerMainTabs
|
||||||
renderActiveTabPanelOnly={true}
|
renderActiveTabPanelOnly={true}
|
||||||
@@ -33,13 +36,16 @@ function InvoiceDetailsTabs() {
|
|||||||
id={'journal_entries'}
|
id={'journal_entries'}
|
||||||
panel={<InvoiceGLEntriesTable />}
|
panel={<InvoiceGLEntriesTable />}
|
||||||
/>
|
/>
|
||||||
{/* <Can I={PaymentReceiveAction.View} a={AbilitySubject.PaymentReceive}> */}
|
{ability.can(
|
||||||
<Tab
|
PaymentReceiveAction.View,
|
||||||
title={intl.get('payment_transactions')}
|
AbilitySubject.PaymentReceive,
|
||||||
id={'payment_transactions'}
|
) && (
|
||||||
panel={<InvoicePaymentTransactionsTable />}
|
<Tab
|
||||||
/>
|
title={intl.get('payment_transactions')}
|
||||||
{/* </Can> */}
|
id={'payment_transactions'}
|
||||||
|
panel={<InvoicePaymentTransactionsTable />}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</DrawerMainTabs>
|
</DrawerMainTabs>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user