43 lines
No EOL
1.8 KiB
JavaScript
43 lines
No EOL
1.8 KiB
JavaScript
export default {
|
|
|
|
methods: {
|
|
hasPartQuestions(partsOrQuestions) {
|
|
return partsOrQuestions?.some(pq => pq.partQuestions?.length > 0);
|
|
},
|
|
hasGlassLocationWithMultipleParts(partsOrQuestions) {
|
|
return partsOrQuestions?.some(pq => pq.parts?.length > 1);
|
|
},
|
|
hasChildPartQuestions(partsOrQuestions) {
|
|
return partsOrQuestions.some(pq => {
|
|
return pq.parts?.some(part => part.childPartQuestions?.length > 0);
|
|
});
|
|
},
|
|
hasCapabilityQuestions(partsOrQuestions) {
|
|
return partsOrQuestions.some(pq => {
|
|
return pq.parts?.some(part => part.requiresCapabilityQuestions === true);
|
|
});
|
|
},
|
|
// method to only include keys listed for lineItems.glassParts in
|
|
// https://safelite.atlassian.net/wiki/spaces/DC/pages/17137665/Catalog+Front-End+State#glassParts
|
|
reducedGlassPartsArray(glassParts) {
|
|
const reducedGlassParts = [];
|
|
glassParts.forEach((glass) => {
|
|
if (Array.isArray(glass.parts) && glass.parts.length === 1) {
|
|
const singlePart = glass.parts[0];
|
|
reducedGlassParts.push({
|
|
partNumber: singlePart.partNumber,
|
|
description: singlePart.description,
|
|
color: singlePart.color,
|
|
requiresRecalibration: singlePart.requiresRecalibration,
|
|
requiresCapabilityQuestions: singlePart.requiresCapabilityQuestions,
|
|
recalibrationType: singlePart.recalibrationType,
|
|
childParts: singlePart.childParts,
|
|
price: singlePart.price,
|
|
});
|
|
}
|
|
});
|
|
return reducedGlassParts;
|
|
}
|
|
}
|
|
|
|
} |