mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: add convert to vendor credit in drawer.
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
PaymentMadeAction,
|
||||
AbilitySubject,
|
||||
} from '../../../common/abilityOption';
|
||||
import { BillMenuItem } from './utils';
|
||||
|
||||
import { safeCallback, compose } from 'utils';
|
||||
|
||||
@@ -50,6 +51,14 @@ function BillDetailActionsBar({
|
||||
closeDrawer('bill-drawer');
|
||||
};
|
||||
|
||||
// Handle convert to vendor credit.
|
||||
const handleConvertToVendorCredit = () => {
|
||||
history.push(`/vendor-credits/new?from_bill_id=${billId}`, {
|
||||
billId: billId,
|
||||
});
|
||||
closeDrawer('bill-drawer');
|
||||
};
|
||||
|
||||
// Handle delete bill.
|
||||
const onDeleteBill = () => {
|
||||
openAlert('bill-delete', { billId });
|
||||
@@ -92,6 +101,14 @@ function BillDetailActionsBar({
|
||||
onClick={safeCallback(onDeleteBill)}
|
||||
/>
|
||||
</Can>
|
||||
<Can I={BillAction.Edit} a={AbilitySubject.Bill}>
|
||||
<NavbarDivider />
|
||||
<BillMenuItem
|
||||
payload={{
|
||||
onConvert: handleConvertToVendorCredit,
|
||||
}}
|
||||
/>
|
||||
</Can>
|
||||
</NavbarGroup>
|
||||
</DrawerActionsBar>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user