mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: add ability credit & vendor & item transactions.
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import {
|
||||
Icon,
|
||||
Can,
|
||||
FormattedMessage as T,
|
||||
DashboardActionViewsList,
|
||||
AdvancedFilterPopover,
|
||||
@@ -19,7 +20,10 @@ import {
|
||||
import DashboardActionsBar from '../../../../components/Dashboard/DashboardActionsBar';
|
||||
|
||||
import { useCreditNoteListContext } from './CreditNotesListProvider';
|
||||
|
||||
import {
|
||||
CreditNoteAction,
|
||||
AbilitySubject,
|
||||
} from '../../../../common/abilityOption';
|
||||
import withCreditNotes from './withCreditNotes';
|
||||
import withCreditNotesActions from './withCreditNotesActions';
|
||||
import withSettings from '../../../Settings/withSettings';
|
||||
@@ -78,12 +82,14 @@ function CreditNotesActionsBar({
|
||||
onChange={handleTabChange}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'plus'} />}
|
||||
text={<T id={'credit_note.label.new_credit_note'} />}
|
||||
onClick={handleClickNewCreateNote}
|
||||
/>
|
||||
<Can I={CreditNoteAction.Create} a={AbilitySubject.CreditNote}>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'plus'} />}
|
||||
text={<T id={'credit_note.label.new_credit_note'} />}
|
||||
onClick={handleClickNewCreateNote}
|
||||
/>
|
||||
</Can>
|
||||
<AdvancedFilterPopover
|
||||
advancedFilterProps={{
|
||||
conditions: creditNoteFilterRoles,
|
||||
|
||||
@@ -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 {
|
||||
CreditNoteAction,
|
||||
AbilitySubject,
|
||||
} from '../../../../common/abilityOption';
|
||||
|
||||
export default function CreditNotesEmptyStatus() {
|
||||
const history = useHistory();
|
||||
@@ -16,17 +20,19 @@ export default function CreditNotesEmptyStatus() {
|
||||
}
|
||||
action={
|
||||
<>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
large={true}
|
||||
onClick={() => history.push('/credit-notes/new')}
|
||||
>
|
||||
<T id={'credit_note.label.new_credit_note'} />
|
||||
</Button>
|
||||
<Can I={CreditNoteAction.Create} a={AbilitySubject.CreditNote}>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
large={true}
|
||||
onClick={() => history.push('/credit-notes/new')}
|
||||
>
|
||||
<T id={'credit_note.label.new_credit_note'} />
|
||||
</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 {
|
||||
CreditNoteAction,
|
||||
AbilitySubject,
|
||||
} from '../../../../common/abilityOption';
|
||||
|
||||
export function ActionsMenu({
|
||||
payload: { onEdit, onDelete, onRefund, onOpen, onReconcile, onViewDetails },
|
||||
@@ -24,37 +29,48 @@ export function ActionsMenu({
|
||||
text={intl.get('view_details')}
|
||||
onClick={safeCallback(onViewDetails, original)}
|
||||
/>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={intl.get('credit_note.action.edit_credit_note')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
<If condition={original.is_draft}>
|
||||
<Can I={CreditNoteAction.Edit} a={AbilitySubject.CreditNote}>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon={'check'} iconSize={18} />}
|
||||
text={intl.get('credit_note.action.make_as_open')}
|
||||
onClick={safeCallback(onOpen, original)}
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={intl.get('credit_note.action.edit_credit_note')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
</If>
|
||||
<If condition={!original.is_closed && original.is_published}>
|
||||
<If condition={original.is_draft}>
|
||||
<MenuItem
|
||||
icon={<Icon icon={'check'} iconSize={18} />}
|
||||
text={intl.get('credit_note.action.make_as_open')}
|
||||
onClick={safeCallback(onOpen, original)}
|
||||
/>
|
||||
</If>
|
||||
</Can>
|
||||
|
||||
<Can I={CreditNoteAction.Refund} a={AbilitySubject.CreditNote}>
|
||||
<If condition={!original.is_closed && original.is_published}>
|
||||
<MenuItem
|
||||
icon={<Icon icon="quick-payment-16" />}
|
||||
text={intl.get('credit_note.action.refund_credit_note')}
|
||||
onClick={safeCallback(onRefund, original)}
|
||||
/>
|
||||
</If>
|
||||
</Can>
|
||||
<Can I={CreditNoteAction.Edit} a={AbilitySubject.CreditNote}>
|
||||
<If condition={!original.is_closed && original.is_published}>
|
||||
<MenuItem
|
||||
text={intl.get('credit_note.action.reconcile_with_invoices')}
|
||||
icon={<Icon icon="receipt-24" iconSize={16} />}
|
||||
onClick={safeCallback(onReconcile, original)}
|
||||
/>
|
||||
</If>
|
||||
</Can>
|
||||
<Can I={CreditNoteAction.Delete} a={AbilitySubject.CreditNote}>
|
||||
<MenuItem
|
||||
icon={<Icon icon="quick-payment-16" />}
|
||||
text={intl.get('credit_note.action.refund_credit_note')}
|
||||
onClick={safeCallback(onRefund, original)}
|
||||
text={intl.get('credit_note.action.delete_credit_note')}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
/>
|
||||
<MenuItem
|
||||
text={intl.get('credit_note.action.reconcile_with_invoices')}
|
||||
icon={<Icon icon="receipt-24" iconSize={16} />}
|
||||
onClick={safeCallback(onReconcile, original)}
|
||||
/>
|
||||
</If>
|
||||
<MenuItem
|
||||
text={intl.get('credit_note.action.delete_credit_note')}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
/>
|
||||
</Can>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user