From 93aa60124bf55753348d3835f0e1e2896f2b7824 Mon Sep 17 00:00:00 2001 From: elforjani13 <39470382+elforjani13@users.noreply.github.com> Date: Sun, 26 Dec 2021 13:25:07 +0200 Subject: [PATCH] feat: add convert to vendor credit. --- .../Purchases/Bills/BillsLanding/BillsTable.js | 6 ++++++ .../Purchases/Bills/BillsLanding/components.js | 6 ++++++ .../CreditNoteForm/VendorCreditNoteForm.js | 6 +++++- .../VendorCreditNoteFormProvider.js | 18 ++++++++++++++++-- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/containers/Purchases/Bills/BillsLanding/BillsTable.js b/src/containers/Purchases/Bills/BillsLanding/BillsTable.js index f2a2ef353..151e14603 100644 --- a/src/containers/Purchases/Bills/BillsLanding/BillsTable.js +++ b/src/containers/Purchases/Bills/BillsLanding/BillsTable.js @@ -70,6 +70,11 @@ function BillsDataTable({ history.push(`/bills/${bill.id}/edit`); }; + // Handle convert to vendor credit. + const handleConvertToVendorCredit = ({ id }) => { + history.push(`/vendor-credits/new?from_bill_id=${id}`, { billId: id }); + }; + // Handle bill delete action. const handleDeleteBill = (bill) => { openAlert('bill-delete', { billId: bill.id }); @@ -137,6 +142,7 @@ function BillsDataTable({ onQuick: handleQuickPaymentMade, onAllocateLandedCost: handleAllocateLandedCost, onViewDetails: handleViewDetailBill, + onConvert: handleConvertToVendorCredit, }} /> diff --git a/src/containers/Purchases/Bills/BillsLanding/components.js b/src/containers/Purchases/Bills/BillsLanding/components.js index 289815252..86427d54a 100644 --- a/src/containers/Purchases/Bills/BillsLanding/components.js +++ b/src/containers/Purchases/Bills/BillsLanding/components.js @@ -34,6 +34,7 @@ export function ActionsMenu({ onOpen, onDelete, onQuick, + onConvert, onViewDetails, onAllocateLandedCost, }, @@ -53,6 +54,11 @@ export function ActionsMenu({ text={intl.get('edit_bill')} onClick={safeCallback(onEdit, original)} /> + } + text={intl.get('convert_to_vendor_credit')} + onClick={safeCallback(onConvert, original)} + />