fix: ability option key.

This commit is contained in:
elforjani13
2021-11-27 20:23:40 +02:00
parent 68227b81e8
commit 346696f673
6 changed files with 34 additions and 22 deletions

View File

@@ -46,7 +46,7 @@ export const SaleInvoiceAction = {
Create: 'Create', Create: 'Create',
Edit: 'Edit', Edit: 'Edit',
Delete: 'Delete', Delete: 'Delete',
Writeoff: 'Writeoff', Writeoff: 'bad-debt',
NotifyBySms: 'NotifyBySms', NotifyBySms: 'NotifyBySms',
}; };

View File

@@ -90,11 +90,13 @@ function EstimateDetailActionsBar({
/> />
<NavbarDivider /> <NavbarDivider />
</Can> </Can>
<MoreMenuItems <Can I={SaleEstimateAction.NotifyBySms} a={AbilitySubject.Estimate}>
payload={{ <MoreMenuItems
onNotifyViaSMS: handleNotifyViaSMS, payload={{
}} onNotifyViaSMS: handleNotifyViaSMS,
/> }}
/>
</Can>
</NavbarGroup> </NavbarGroup>
</DashboardActionsBar> </DashboardActionsBar>
); );

View File

@@ -120,9 +120,9 @@ function InvoiceDetailActionsBar({
intent={Intent.DANGER} intent={Intent.DANGER}
onClick={handleDeleteInvoice} onClick={handleDeleteInvoice}
/> />
<NavbarDivider />
</Can> </Can>
<Can I={SaleInvoiceAction.Writeoff} a={AbilitySubject.Invoice}> <Can I={SaleInvoiceAction.Writeoff} a={AbilitySubject.Invoice}>
<NavbarDivider />
<BadDebtMenuItem <BadDebtMenuItem
payload={{ payload={{
onBadDebt: handleBadDebtInvoice, onBadDebt: handleBadDebtInvoice,

View File

@@ -8,7 +8,11 @@ import {
MenuItem, MenuItem,
Menu, Menu,
} from '@blueprintjs/core'; } from '@blueprintjs/core';
import { Icon, FormattedMessage as T, Choose } from 'components'; import { Icon, FormattedMessage as T, Choose, Can } from 'components';
import {
SaleInvoiceAction,
AbilitySubject,
} from '../../../common/abilityOption';
import { FormatNumberCell } from '../../../components'; import { FormatNumberCell } from '../../../components';
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider'; import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
@@ -88,10 +92,12 @@ export const BadDebtMenuItem = ({
/> />
</Choose.When> </Choose.When>
</Choose> </Choose>
<MenuItem <Can I={SaleInvoiceAction.NotifyBySms} a={AbilitySubject.Invoice}>
onClick={onNotifyViaSMS} <MenuItem
text={<T id={'notify_via_sms.dialog.notify_via_sms'} />} onClick={onNotifyViaSMS}
/> text={<T id={'notify_via_sms.dialog.notify_via_sms'} />}
/>
</Can>
</Menu> </Menu>
} }
> >

View File

@@ -80,11 +80,13 @@ function PaymentReceiveActionsBar({
/> />
<NavbarDivider /> <NavbarDivider />
</Can> </Can>
<MoreMenuItems <Can I={PaymentReceiveAction.NotifyBySms} a={AbilitySubject.PaymentReceive}>
payload={{ <MoreMenuItems
onNotifyViaSMS: handleNotifyViaSMS, payload={{
}} onNotifyViaSMS: handleNotifyViaSMS,
/> }}
/>
</Can>
</NavbarGroup> </NavbarGroup>
</DashboardActionsBar> </DashboardActionsBar>
); );

View File

@@ -85,11 +85,13 @@ function ReceiptDetailActionBar({
/> />
<NavbarDivider /> <NavbarDivider />
</Can> </Can>
<MoreMenuItems <Can I={SaleReceiptAction.NotifyBySms} a={AbilitySubject.Receipt}>
payload={{ <MoreMenuItems
onNotifyViaSMS: handleNotifyViaSMS, payload={{
}} onNotifyViaSMS: handleNotifyViaSMS,
/> }}
/>
</Can>
</NavbarGroup> </NavbarGroup>
</DashboardActionsBar> </DashboardActionsBar>
); );