INSR-9513: Add all recal parts to glass part child parts array
This commit is contained in:
parent
3d72aa36c9
commit
4fbca5ccd8
1 changed files with 10 additions and 7 deletions
|
|
@ -1120,7 +1120,7 @@ export const useMainStore = defineStore({
|
|||
.then((response) => {
|
||||
const recalResponse = response.data;
|
||||
if (recalResponse && recalResponse.recalibrationParts && recalResponse.recalibrationParts.length > 0) {
|
||||
this.addGlassPartRecalibrationInfo(partNumberChecked, recalResponse.recalibrationParts[0]);
|
||||
this.addGlassPartRecalibrationInfo(partNumberChecked, recalResponse.recalibrationParts);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
@ -1128,15 +1128,18 @@ export const useMainStore = defineStore({
|
|||
await Promise.allSettled(recalPromises);
|
||||
}
|
||||
},
|
||||
addGlassPartRecalibrationInfo(partNumber, recalPartInformation) {
|
||||
addGlassPartRecalibrationInfo(partNumber, recalPartArray) {
|
||||
const glassPart = this.lineItems.glassParts.find((gp) => gp.partNumber === partNumber);
|
||||
if (glassPart) {
|
||||
const recalChildPart = glassPart.childParts?.find((cp) => cp.partNumber === recalPartInformation.partNumber);
|
||||
if (!recalChildPart) {
|
||||
if (!Array.isArray(glassPart.childParts) || !glassPart.childParts.length) {
|
||||
glassPart.childParts = [];
|
||||
for (const recalPartInformation of recalPartArray) {
|
||||
const recalChildPart = glassPart.childParts?.find((cp) => cp.partNumber === recalPartInformation.partNumber);
|
||||
console.log('Existing recalibration child part found', recalChildPart);
|
||||
if (!recalChildPart) {
|
||||
if (!Array.isArray(glassPart.childParts) || !glassPart.childParts.length) {
|
||||
glassPart.childParts = [];
|
||||
}
|
||||
glassPart.childParts.push(recalPartInformation);
|
||||
}
|
||||
glassPart.childParts.push(recalPartInformation);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue