mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +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 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 {
|
||||
SaleInvoiceAction,
|
||||
PaymentReceiveAction,
|
||||
@@ -48,6 +54,14 @@ function InvoiceDetailActionsBar({
|
||||
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.
|
||||
const handleDeleteInvoice = () => {
|
||||
openAlert('invoice-delete', { invoiceId });
|
||||
@@ -124,6 +138,7 @@ function InvoiceDetailActionsBar({
|
||||
onBadDebt: handleBadDebtInvoice,
|
||||
onCancelBadDebt: handleCancelBadDebtInvoice,
|
||||
onNotifyViaSMS: handleNotifyViaSMS,
|
||||
onConvert: handleConvertToCreitNote,
|
||||
}}
|
||||
/>
|
||||
</Can>
|
||||
|
||||
@@ -76,7 +76,7 @@ export const useInvoiceReadonlyEntriesColumns = () =>
|
||||
* @returns {React.JSX}
|
||||
*/
|
||||
export const BadDebtMenuItem = ({
|
||||
payload: { onCancelBadDebt, onBadDebt, onNotifyViaSMS },
|
||||
payload: { onCancelBadDebt, onBadDebt, onNotifyViaSMS, onConvert },
|
||||
}) => {
|
||||
const { invoice } = useInvoiceDetailDrawerContext();
|
||||
|
||||
@@ -104,6 +104,12 @@ export const BadDebtMenuItem = ({
|
||||
/>
|
||||
</Choose.When>
|
||||
</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}>
|
||||
<MenuItem
|
||||
onClick={onNotifyViaSMS}
|
||||
|
||||
Reference in New Issue
Block a user