DigitalConsumer.ISS/src/helpers/recal-helper.js
Bill Richardson 107cec3d69 Updates to provider call.
Reorg'd imports on store index.js
Sorted by file name (constants, helpers)
Updated serviceability call with application name.
2024-10-24 14:34:23 -04:00

25 lines
789 B
JavaScript

import partTypeStrings from '@/constants/part-type-strings';
const recalPartTypes = [partTypeStrings.RECALIBRATION, partTypeStrings.ADAS_RECALIBRATION];
export function isRecalPart(part) {
return recalPartTypes.some((type) => type === part.partType);
}
export function isRecalPartOrHasChildRecalPart(glassPart) {
const isGlassPartRecalPart = isRecalPart(glassPart);
if (!isGlassPartRecalPart && glassPart.childParts && glassPart.childParts.length > 0) {
return glassPart.childParts.filter((cp) => isRecalPartOrHasChildRecalPart(cp));
}
return isGlassPartRecalPart;
}
export function getTopLevelGlassPartsWithRecal(glassParts) {
if (!glassParts) {
return null;
}
return glassParts.filter((gp) => isRecalPartOrHasChildRecalPart(gp));
}