0👍
✅
You certainly have some other properties to identify each selected purchase requests… Like in the below example, a number
and/or a description
:
let requestStatuses = [];
for(let i = 0; i < this.selectedPurchaseRequests.length; i++) {
requestStatuses.push({
number: this.selectedPurchaseRequests[i].number,
description: this.selectedPurchaseRequests[i].description,
status: this.selectedPurchaseRequests[i].docStatus
})
if(this.selectedPurchaseRequests[i].docStatus !== 'In Preparation') {
continue;
} else {
fetch(`url`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
}
})
}
}
console.log(requestStatuses) // do something with that array
0👍
Working Demo :
new Vue({
el: '#app',
data() {
return {
selectedPurchaseRequests: [{
number: 1,
summary: 'Aplha',
docStatus: 'Approved'
}, {
number: 2,
summary: 'Beta',
docStatus: 'In Preparation'
}, {
number: 3,
summary: 'Gama',
docStatus: 'Rejected'
}],
notEqualInPrep: []
}
},
mounted: function() {
this.selectedPurchaseRequests.forEach((request) => {
if (request.docStatus !== 'In Preparation') {
this.notEqualInPrep.push(`${request.number}-${request.summary}-${request.docStatus}`);
}
});
alert(this.notEqualInPrep.toString())
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
</div>
Source:stackexchange.com