mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat: add ability credit & vendor & item transactions.
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
} from '@blueprintjs/core';
|
||||
import {
|
||||
Icon,
|
||||
Can,
|
||||
FormattedMessage as T,
|
||||
DashboardActionViewsList,
|
||||
AdvancedFilterPopover,
|
||||
@@ -19,7 +20,10 @@ import {
|
||||
import DashboardActionsBar from '../../../../components/Dashboard/DashboardActionsBar';
|
||||
|
||||
import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider';
|
||||
|
||||
import {
|
||||
VendorCreditAction,
|
||||
AbilitySubject,
|
||||
} from '../../../../common/abilityOption';
|
||||
import withVendorsCreditNotes from './withVendorsCreditNotes';
|
||||
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
|
||||
import withSettings from '../../../Settings/withSettings';
|
||||
@@ -84,12 +88,14 @@ function VendorsCreditNoteActionsBar({
|
||||
onChange={handleTabChange}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'plus'} />}
|
||||
text={<T id={'vendor_credits.label.new_vendor_credit'} />}
|
||||
onClick={handleClickNewVendorCredit}
|
||||
/>
|
||||
<Can I={VendorCreditAction.Create} a={AbilitySubject.VendorCredit}>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'plus'} />}
|
||||
text={<T id={'vendor_credits.label.new_vendor_credit'} />}
|
||||
onClick={handleClickNewVendorCredit}
|
||||
/>
|
||||
</Can>
|
||||
<AdvancedFilterPopover
|
||||
advancedFilterProps={{
|
||||
conditions: vendorCreditFilterRoles,
|
||||
|
||||
@@ -2,7 +2,11 @@ import React from 'react';
|
||||
import { Button, Intent } from '@blueprintjs/core';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
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() {
|
||||
const history = useHistory();
|
||||
@@ -16,17 +20,19 @@ export default function VendorsCreditNoteEmptyStatus() {
|
||||
}
|
||||
action={
|
||||
<>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
large={true}
|
||||
onClick={() => history.push('/vendor-credits/new')}
|
||||
>
|
||||
<T id={'vendor_credits.action.new_vendor_credit'} />
|
||||
</Button>
|
||||
<Can I={VendorCreditAction.Create} a={AbilitySubject.VendorCredit}>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
large={true}
|
||||
onClick={() => history.push('/vendor-credits/new')}
|
||||
>
|
||||
<T id={'vendor_credits.action.new_vendor_credit'} />
|
||||
</Button>
|
||||
|
||||
<Button intent={Intent.NONE} large={true}>
|
||||
<T id={'learn_more'} />
|
||||
</Button>
|
||||
<Button intent={Intent.NONE} large={true}>
|
||||
<T id={'learn_more'} />
|
||||
</Button>
|
||||
</Can>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -10,8 +10,13 @@ import {
|
||||
Choose,
|
||||
If,
|
||||
Icon,
|
||||
Can,
|
||||
} from 'components';
|
||||
import { safeCallback } from 'utils';
|
||||
import {
|
||||
VendorCreditAction,
|
||||
AbilitySubject,
|
||||
} from '../../../../common/abilityOption';
|
||||
|
||||
/**
|
||||
* Actions menu.
|
||||
@@ -27,39 +32,51 @@ export function ActionsMenu({
|
||||
text={intl.get('view_details')}
|
||||
onClick={safeCallback(onViewDetails, original)}
|
||||
/>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={intl.get('vendor_credits.action.edit_vendor_credit')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
<If condition={!original.is_closed && original.is_published}>
|
||||
<Can I={VendorCreditAction.Edit} a={AbilitySubject.VendorCredit}>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon="quick-payment-16" />}
|
||||
text={intl.get('vendor_credits.action.refund_vendor_credit')}
|
||||
onClick={safeCallback(onRefund, original)}
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={intl.get('vendor_credits.action.edit_vendor_credit')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
</If>
|
||||
<If condition={original.is_draft}>
|
||||
<If condition={original.is_draft}>
|
||||
<MenuItem
|
||||
icon={<Icon icon={'check'} iconSize={18} />}
|
||||
text={intl.get('vendor_credits.action.mark_as_open')}
|
||||
onClick={safeCallback(onOpen, original)}
|
||||
/>
|
||||
</If>
|
||||
</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
|
||||
// icon={<Icon icon="quick-payment-16" />}
|
||||
text={intl.get('vendor_credits.action.reconcile_with_bills')}
|
||||
onClick={safeCallback(onReconcile, original)}
|
||||
/>
|
||||
</If>
|
||||
</Can>
|
||||
<Can I={VendorCreditAction.Delete} a={AbilitySubject.VendorCredit}>
|
||||
<MenuItem
|
||||
icon={<Icon icon={'check'} iconSize={18} />}
|
||||
text={intl.get('vendor_credits.action.mark_as_open')}
|
||||
onClick={safeCallback(onOpen, original)}
|
||||
text={intl.get('vendor_credits.action.delete_vendor_credit')}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
/>
|
||||
</If>
|
||||
<If condition={!original.is_draft && !original.is_closed && original.is_published}>
|
||||
<MenuItem
|
||||
// icon={<Icon icon="quick-payment-16" />}
|
||||
text={intl.get('vendor_credits.action.reconcile_with_bills')}
|
||||
onClick={safeCallback(onReconcile, original)}
|
||||
/>
|
||||
</If>
|
||||
<MenuItem
|
||||
text={intl.get('vendor_credits.action.delete_vendor_credit')}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
/>
|
||||
</Can>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
@@ -83,8 +100,8 @@ export function StatusAccessor(creditNote) {
|
||||
</Tag>
|
||||
</Choose.When>
|
||||
|
||||
<Choose.When condition={creditNote.is_draft} round={true}>
|
||||
<Tag minimal={true}>
|
||||
<Choose.When condition={creditNote.is_draft}>
|
||||
<Tag minimal={true} round={true}>
|
||||
<T id={'draft'} />
|
||||
</Tag>
|
||||
</Choose.When>
|
||||
|
||||
Reference in New Issue
Block a user