I have 4 types of document status: In Preparation, For Approval, Approved, Rejected.
Also, this code has a checkbox that’s why the array is called ‘selectedPurhcaseRequests’. So the code is every time that I check a checkbox, it get its data and pushes it to the ‘selectedPurchaseRequests’ array. And inside of that data, it has a document status. So I want to have a for loop to check all the purchase request’s document status.
for(let i = 0; i < this.selectedPurchaseRequests.length; i++) {
if(this.selectedPurchaseRequests[i].docStatus !== 'In Preparation') {
continue;
} else {
fetch(`url`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
}
})
}
}
Now, I want to alert a message with a summary of those purchase request number with a status of not equal to ‘In Preparation’. But I want it to alert one time when ‘selectedPurchaseRequests’ array is done looping. Because if it alerts multiple time, it will take a lot time and effort for the user to press ok.
Can someone help me?