Update store getters for recal
This commit is contained in:
parent
e30f2631e5
commit
1dde9eb6f7
1 changed files with 5 additions and 30 deletions
|
|
@ -39,6 +39,7 @@ import {
|
||||||
coverageType,
|
coverageType,
|
||||||
coverageTypeValue,
|
coverageTypeValue,
|
||||||
} from "@/constants/insurance";
|
} from "@/constants/insurance";
|
||||||
|
import { containsRecalParts } from "@/helpers/recal-helper";
|
||||||
|
|
||||||
// Export State
|
// Export State
|
||||||
const getDefaultState = () => {
|
const getDefaultState = () => {
|
||||||
|
|
@ -2421,8 +2422,9 @@ export const actions = {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const order = context.getters.order;
|
const order = context.getters.order;
|
||||||
|
|
||||||
var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu;
|
var providerNumber =
|
||||||
|
order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu;
|
||||||
if (providerNumber.startsWith("00")) {
|
if (providerNumber.startsWith("00")) {
|
||||||
providerNumber = providerNumber.substring(1);
|
providerNumber = providerNumber.substring(1);
|
||||||
}
|
}
|
||||||
|
|
@ -2912,34 +2914,7 @@ export default createStore({
|
||||||
// Private Functions
|
// Private Functions
|
||||||
|
|
||||||
function getHasRecalibrationPart(state) {
|
function getHasRecalibrationPart(state) {
|
||||||
var hasRequiresRecalibration =
|
return containsRecalParts(state.order.lineItems);
|
||||||
getNonFalseValuesOfPropertyInArrayOfObjects(
|
|
||||||
state.order.lineItems.glassParts,
|
|
||||||
"requiresRecalibration"
|
|
||||||
)?.length > 0;
|
|
||||||
var hasRecalibrationType =
|
|
||||||
getNonFalseValuesOfPropertyInArrayOfObjects(
|
|
||||||
state.order.lineItems.glassParts,
|
|
||||||
"recalibrationType"
|
|
||||||
)?.length > 0;
|
|
||||||
|
|
||||||
if (hasRequiresRecalibration) {
|
|
||||||
if (hasRecalibrationType) {
|
|
||||||
// Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType'
|
|
||||||
return (
|
|
||||||
getNonFalseValuesOfPropertyInArrayOfObjects(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) {
|
function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue