diff --git a/src/store/index.js b/src/store/index.js index 2c83269aa..5a2a3ba1d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1112,3 +1112,18 @@ export default createStore({ // Private Functions +function getHasRecalibrationPart(state) { + var hasRequiresRecalibration = getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "requiresRecalibration")?.length > 0; + var hasRecalibrationType = getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType")?.length > 0; + + if (hasRequiresRecalibration) { + if (hasRecalibrationType) { // Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType' + return getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType")[0].toLowerCase() != "unknown"; + } else { // Has 'requiresRecalibration' but no 'recalibrationType' at all + return true; + } + } else { // Does not have 'requiresRecalibration' + return false; + } + +} \ No newline at end of file