mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
feat: add convert to credit note in drawer.
This commit is contained in:
@@ -14,7 +14,13 @@ 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 { If, Can, Icon, DrawerActionsBar, FormattedMessage as T } from 'components';
|
import {
|
||||||
|
If,
|
||||||
|
Can,
|
||||||
|
Icon,
|
||||||
|
DrawerActionsBar,
|
||||||
|
FormattedMessage as T,
|
||||||
|
} from 'components';
|
||||||
import {
|
import {
|
||||||
SaleInvoiceAction,
|
SaleInvoiceAction,
|
||||||
PaymentReceiveAction,
|
PaymentReceiveAction,
|
||||||
@@ -48,6 +54,14 @@ function InvoiceDetailActionsBar({
|
|||||||
closeDrawer('invoice-detail-drawer');
|
closeDrawer('invoice-detail-drawer');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle convert to invoice.
|
||||||
|
const handleConvertToCreitNote = () => {
|
||||||
|
history.push(`/credit-notes/new?from_invoice_id=${invoiceId}`, {
|
||||||
|
invoiceId: invoiceId,
|
||||||
|
});
|
||||||
|
closeDrawer('invoice-detail-drawer');
|
||||||
|
};
|
||||||
|
|
||||||
// Handle delete sale invoice.
|
// Handle delete sale invoice.
|
||||||
const handleDeleteInvoice = () => {
|
const handleDeleteInvoice = () => {
|
||||||
openAlert('invoice-delete', { invoiceId });
|
openAlert('invoice-delete', { invoiceId });
|
||||||
@@ -124,6 +138,7 @@ function InvoiceDetailActionsBar({
|
|||||||
onBadDebt: handleBadDebtInvoice,
|
onBadDebt: handleBadDebtInvoice,
|
||||||
onCancelBadDebt: handleCancelBadDebtInvoice,
|
onCancelBadDebt: handleCancelBadDebtInvoice,
|
||||||
onNotifyViaSMS: handleNotifyViaSMS,
|
onNotifyViaSMS: handleNotifyViaSMS,
|
||||||
|
onConvert: handleConvertToCreitNote,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Can>
|
</Can>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export const useInvoiceReadonlyEntriesColumns = () =>
|
|||||||
* @returns {React.JSX}
|
* @returns {React.JSX}
|
||||||
*/
|
*/
|
||||||
export const BadDebtMenuItem = ({
|
export const BadDebtMenuItem = ({
|
||||||
payload: { onCancelBadDebt, onBadDebt, onNotifyViaSMS },
|
payload: { onCancelBadDebt, onBadDebt, onNotifyViaSMS, onConvert },
|
||||||
}) => {
|
}) => {
|
||||||
const { invoice } = useInvoiceDetailDrawerContext();
|
const { invoice } = useInvoiceDetailDrawerContext();
|
||||||
|
|
||||||
@@ -104,6 +104,12 @@ export const BadDebtMenuItem = ({
|
|||||||
/>
|
/>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
</Choose>
|
</Choose>
|
||||||
|
<Can I={SaleInvoiceAction.Edit} a={AbilitySubject.Invoice}>
|
||||||
|
<MenuItem
|
||||||
|
onClick={onConvert}
|
||||||
|
text={<T id={'convert_to_credit_note'} />}
|
||||||
|
/>
|
||||||
|
</Can>
|
||||||
<Can I={SaleInvoiceAction.NotifyBySms} a={AbilitySubject.Invoice}>
|
<Can I={SaleInvoiceAction.NotifyBySms} a={AbilitySubject.Invoice}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={onNotifyViaSMS}
|
onClick={onNotifyViaSMS}
|
||||||
|
|||||||
Reference in New Issue
Block a user