IO-2887 Null out BillData if returnfrombill is not available
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
@@ -45,14 +45,14 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
setModalContext({
|
||||
context: context,
|
||||
modal: "billEnter",
|
||||
}),
|
||||
})
|
||||
),
|
||||
setPartsReceiveContext: (context) =>
|
||||
dispatch(
|
||||
setModalContext({
|
||||
context: context,
|
||||
modal: "partsReceive",
|
||||
}),
|
||||
})
|
||||
),
|
||||
});
|
||||
|
||||
@@ -98,7 +98,7 @@ export function PartsOrderListTableDrawerComponent({
|
||||
const { refetch } = billsQuery;
|
||||
|
||||
const selectedPartsOrderRecord = parts_orders.find(
|
||||
(r) => r.id === selectedpartsorder,
|
||||
(r) => r.id === selectedpartsorder
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -112,7 +112,7 @@ export function PartsOrderListTableDrawerComponent({
|
||||
} catch (error) {
|
||||
console.error("Error fetching bill data:", error);
|
||||
}
|
||||
}
|
||||
} else setBillData(null);
|
||||
};
|
||||
fetchData();
|
||||
}, [selectedPartsOrderRecord, billQuery]);
|
||||
@@ -158,7 +158,7 @@ export function PartsOrderListTableDrawerComponent({
|
||||
fields: {
|
||||
parts_orders(existingPartsOrders, { readField }) {
|
||||
return existingPartsOrders.filter(
|
||||
(billref) => record.id !== readField("id", billref),
|
||||
(billref) => record.id !== readField("id", billref)
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -372,7 +372,7 @@ export function PartsOrderListTableDrawerComponent({
|
||||
title={
|
||||
billData
|
||||
? `${record.vendor.name} - ${record.order_number} - ${t(
|
||||
"bills.labels.returnfrombill",
|
||||
"bills.labels.returnfrombill"
|
||||
)}: ${billData.bills_by_pk.invoice_number}`
|
||||
: `${record.vendor.name} - ${record.order_number}`
|
||||
}
|
||||
@@ -412,5 +412,5 @@ export function PartsOrderListTableDrawerComponent({
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps,
|
||||
mapDispatchToProps
|
||||
)(PartsOrderListTableDrawerComponent);
|
||||
|
||||
Reference in New Issue
Block a user