Reorg'd imports on store index.js Sorted by file name (constants, helpers) Updated serviceability call with application name.
25 lines
789 B
JavaScript
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));
|
|
}
|