mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat: add payment receive ability.
This commit is contained in:
@@ -19,7 +19,7 @@ import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
|||||||
import { If, Can, Icon, FormattedMessage as T } from 'components';
|
import { If, Can, Icon, FormattedMessage as T } from 'components';
|
||||||
import {
|
import {
|
||||||
Invoice_Abilities,
|
Invoice_Abilities,
|
||||||
PaymentReceive,
|
Payment_Receive_Abilities,
|
||||||
AbilitySubject,
|
AbilitySubject,
|
||||||
} from '../../../common/abilityOption';
|
} from '../../../common/abilityOption';
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ function InvoiceDetailActionsBar({
|
|||||||
|
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
</Can>
|
</Can>
|
||||||
<Can I={PaymentReceive.Create} a={AbilitySubject.PaymentReceive}>
|
<Can I={Payment_Receive_Abilities.Create} a={AbilitySubject.PaymentReceive}>
|
||||||
<If condition={invoice.is_delivered && !invoice.is_fully_paid}>
|
<If condition={invoice.is_delivered && !invoice.is_fully_paid}>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ 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 { Icon, FormattedMessage as T, MoreMenuItems } from 'components';
|
import { Can, Icon, FormattedMessage as T, MoreMenuItems } from 'components';
|
||||||
|
import { Payment_Receive_Abilities, AbilitySubject } from '../../../common/abilityOption';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -57,21 +58,25 @@ function PaymentReceiveActionsBar({
|
|||||||
return (
|
return (
|
||||||
<DashboardActionsBar>
|
<DashboardActionsBar>
|
||||||
<NavbarGroup>
|
<NavbarGroup>
|
||||||
<Button
|
<Can I={Payment_Receive_Abilities.Edit} a={AbilitySubject.PaymentReceive}>
|
||||||
className={Classes.MINIMAL}
|
<Button
|
||||||
icon={<Icon icon="pen-18" />}
|
className={Classes.MINIMAL}
|
||||||
text={<T id={'edit_payment_receive'} />}
|
icon={<Icon icon="pen-18" />}
|
||||||
onClick={handleEditPaymentReceive}
|
text={<T id={'edit_payment_receive'} />}
|
||||||
/>
|
onClick={handleEditPaymentReceive}
|
||||||
<NavbarDivider />
|
/>
|
||||||
<Button
|
<NavbarDivider />
|
||||||
className={Classes.MINIMAL}
|
</Can>
|
||||||
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
<Can I={Payment_Receive_Abilities.Delete} a={AbilitySubject.PaymentReceive}>
|
||||||
text={<T id={'delete'} />}
|
<Button
|
||||||
intent={Intent.DANGER}
|
className={Classes.MINIMAL}
|
||||||
onClick={handleDeletePaymentReceive}
|
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||||
/>
|
text={<T id={'delete'} />}
|
||||||
<NavbarDivider />
|
intent={Intent.DANGER}
|
||||||
|
onClick={handleDeletePaymentReceive}
|
||||||
|
/>
|
||||||
|
<NavbarDivider />
|
||||||
|
</Can>
|
||||||
<MoreMenuItems
|
<MoreMenuItems
|
||||||
payload={{
|
payload={{
|
||||||
onNotifyViaSMS: handleNotifyViaSMS,
|
onNotifyViaSMS: handleNotifyViaSMS,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
import { formattedAmount, safeCallback, calculateStatus } from 'utils';
|
import { formattedAmount, safeCallback, calculateStatus } from 'utils';
|
||||||
import {
|
import {
|
||||||
Invoice_Abilities,
|
Invoice_Abilities,
|
||||||
PaymentReceive,
|
Payment_Receive_Abilities,
|
||||||
AbilitySubject,
|
AbilitySubject,
|
||||||
} from '../../../../common/abilityOption';
|
} from '../../../../common/abilityOption';
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ export function ActionsMenu({
|
|||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
</Can>
|
</Can>
|
||||||
<Can I={PaymentReceive.Create} a={AbilitySubject.PaymentReceive}>
|
<Can I={Payment_Receive_Abilities.Create} a={AbilitySubject.PaymentReceive}>
|
||||||
<If condition={original.is_delivered && !original.is_fully_paid}>
|
<If condition={original.is_delivered && !original.is_fully_paid}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="quick-payment-16" iconSize={16} />}
|
icon={<Icon icon="quick-payment-16" iconSize={16} />}
|
||||||
|
|||||||
@@ -19,14 +19,17 @@ import {
|
|||||||
|
|
||||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||||
|
|
||||||
import { If, DashboardActionViewsList } from 'components';
|
import { Can, If, DashboardActionViewsList } from 'components';
|
||||||
|
|
||||||
import withPaymentReceivesActions from './withPaymentReceivesActions';
|
import withPaymentReceivesActions from './withPaymentReceivesActions';
|
||||||
import withPaymentReceives from './withPaymentReceives';
|
import withPaymentReceives from './withPaymentReceives';
|
||||||
|
|
||||||
import withSettingsActions from 'containers/Settings/withSettingsActions';
|
import withSettingsActions from 'containers/Settings/withSettingsActions';
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
|
import {
|
||||||
|
Payment_Receive_Abilities,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
|
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
|
||||||
import { useRefreshPaymentReceive } from 'hooks/query/paymentReceives';
|
import { useRefreshPaymentReceive } from 'hooks/query/paymentReceives';
|
||||||
@@ -85,12 +88,14 @@ function PaymentReceiveActionsBar({
|
|||||||
onChange={handleTabChange}
|
onChange={handleTabChange}
|
||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
<Button
|
<Can I={Payment_Receive_Abilities.Create} a={AbilitySubject.PaymentReceive}>
|
||||||
className={Classes.MINIMAL}
|
<Button
|
||||||
icon={<Icon icon={'plus'} />}
|
className={Classes.MINIMAL}
|
||||||
text={<T id={'new_payment_receive'} />}
|
icon={<Icon icon={'plus'} />}
|
||||||
onClick={handleClickNewPaymentReceive}
|
text={<T id={'new_payment_receive'} />}
|
||||||
/>
|
onClick={handleClickNewPaymentReceive}
|
||||||
|
/>
|
||||||
|
</Can>
|
||||||
<AdvancedFilterPopover
|
<AdvancedFilterPopover
|
||||||
advancedFilterProps={{
|
advancedFilterProps={{
|
||||||
conditions: paymentFilterConditions,
|
conditions: paymentFilterConditions,
|
||||||
|
|||||||
@@ -11,10 +11,13 @@ import {
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { FormatDateCell, Money, Icon } from 'components';
|
import { FormatDateCell, Money, Icon, Can } from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
import { CLASSES } from '../../../../common/classes';
|
import { CLASSES } from '../../../../common/classes';
|
||||||
|
import {
|
||||||
|
Payment_Receive_Abilities,
|
||||||
|
AbilitySubject,
|
||||||
|
} from '../../../../common/abilityOption';
|
||||||
/**
|
/**
|
||||||
* Table actions menu.
|
* Table actions menu.
|
||||||
*/
|
*/
|
||||||
@@ -29,18 +32,22 @@ export function ActionsMenu({
|
|||||||
text={intl.get('view_details')}
|
text={intl.get('view_details')}
|
||||||
onClick={safeCallback(onViewDetails, paymentReceive)}
|
onClick={safeCallback(onViewDetails, paymentReceive)}
|
||||||
/>
|
/>
|
||||||
<MenuDivider />
|
<Can I={Payment_Receive_Abilities.Edit} a={AbilitySubject.PaymentReceive}>
|
||||||
<MenuItem
|
<MenuDivider />
|
||||||
icon={<Icon icon="pen-18" />}
|
<MenuItem
|
||||||
text={intl.get('edit_payment_receive')}
|
icon={<Icon icon="pen-18" />}
|
||||||
onClick={safeCallback(onEdit, paymentReceive)}
|
text={intl.get('edit_payment_receive')}
|
||||||
/>
|
onClick={safeCallback(onEdit, paymentReceive)}
|
||||||
<MenuItem
|
/>
|
||||||
text={intl.get('delete_payment_receive')}
|
</Can>
|
||||||
intent={Intent.DANGER}
|
<Can I={Payment_Receive_Abilities.Delete} a={AbilitySubject.PaymentReceive}>
|
||||||
onClick={safeCallback(onDelete, paymentReceive)}
|
<MenuItem
|
||||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
text={intl.get('delete_payment_receive')}
|
||||||
/>
|
intent={Intent.DANGER}
|
||||||
|
onClick={safeCallback(onDelete, paymentReceive)}
|
||||||
|
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||||
|
/>
|
||||||
|
</Can>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user