diff --git a/packages/esm-billing-app/src/billable-services/bill-manager/bill-line-items.component.tsx b/packages/esm-billing-app/src/billable-services/bill-manager/bill-line-items.component.tsx index 7de1083f5..bfdfb4aef 100644 --- a/packages/esm-billing-app/src/billable-services/bill-manager/bill-line-items.component.tsx +++ b/packages/esm-billing-app/src/billable-services/bill-manager/bill-line-items.component.tsx @@ -41,11 +41,16 @@ const BillLineItems: React.FC<{ bill: MappedBill }> = ({ bill }) => { }; const LineItemRow = ({ lineItem, bill }: { lineItem: LineItem; bill: MappedBill }) => { + const refundedLineItemUUIDs = bill.lineItems.filter((li) => Math.sign(li.price) === -1).map((li) => li.uuid); + const isRefundedLineItem = refundedLineItemUUIDs.includes(lineItem.uuid); + const refundedLineItemBillableServiceUUIDs = bill.lineItems .filter((li) => Math.sign(li.price) === -1) .map((li) => li.billableService.split(':').at(0)); - const isRefundedItem = refundedLineItemBillableServiceUUIDs.includes(lineItem.billableService.split(':').at(0)); + const isRefundedBillableService = refundedLineItemBillableServiceUUIDs.includes( + lineItem.billableService.split(':').at(0), + ); const { t } = useTranslation(); @@ -77,7 +82,7 @@ const LineItemRow = ({ lineItem, bill }: { lineItem: LineItem; bill: MappedBill }; return ( - + {lineItem.item === '' ? extractString(lineItem.billableService) : extractString(lineItem.item)} @@ -88,7 +93,7 @@ const LineItemRow = ({ lineItem, bill }: { lineItem: LineItem; bill: MappedBill handleOpenEditLineItemWorkspace(lineItem)} /> - {!isRefundedItem && ( + {!isRefundedBillableService && ( handleOpenRefundLineItemModal(lineItem)} /> )}