Tengo las funciones de la siguiente manera. Pero arroja el error "Cannot read properties of undefined (reading 'newQuoteInventoryCheck')" . He estado tratando de averiguar lo que hice, pero no pude resolverlo. Necesito ayuda para entender y resolver el problema.
updateInventory(newData){ if (newData.id =="" || newData.id == null){ (this.sales_oder.items).forEach(function (items, i) { this.newQuoteInventoryCheck(items.product_id.id, items.quantity, function(uData){ if(uData[2]){ console.log('success'); } else{ console.log('failed'); } }); }); } } newQuoteInventoryCheck(newItem, added_quantity, cb){ Api.get('materials/get/'+newItem).then((data)=>{ let available_quantity = data.quantity; if (added_quantity <= available_quantity){ cb([newItem,(available_quantity - added_quantity),true]); } else{ cb([newItem,0,false]); // $('#maxquantityavailable').text('Total quantity available for "'+ data.name+'" in inventory is: '+available_quantity); // $('#maximum-quantity-exceeded-modal').modal('show'); } return null; }); }