Pull serviceability logic up to service-location page.
This commit is contained in:
parent
d37087f966
commit
23d433931d
2 changed files with 31 additions and 43 deletions
|
|
@ -20,10 +20,8 @@
|
|||
alertClass="alert-warning" />
|
||||
<serviceTypeQuestion
|
||||
v-model="selectedServiceType"
|
||||
:isGlassServiceableInshop="isGlassServiceableInshop"
|
||||
:isRecalibrationServiceableInshop="isRecalibrationServiceableInshop"
|
||||
:isGlassServiceableMobile="isGlassServiceableMobile"
|
||||
:isRecalibrationServiceableMobile="isRecalibrationServiceableMobile"
|
||||
:isServiceableMobile="isServiceableMobile"
|
||||
:isServiceableInshop="isServiceableInshop"
|
||||
ref="serviceTypeQuestion"
|
||||
groupName="serviceTypeQuestion"
|
||||
cmsWidgetName="ServiceTypeQuestionWidget"
|
||||
|
|
@ -190,10 +188,24 @@ export default {
|
|||
},
|
||||
},
|
||||
showMilitaryZipAlert() {
|
||||
const isZipServiceableMobile =
|
||||
this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile;
|
||||
|
||||
return this.zipContainsMilitaryBase && isZipServiceableMobile;
|
||||
return this.zipContainsMilitaryBase && this.isServiceableMobile;
|
||||
},
|
||||
isServiceableMobile() {
|
||||
if (this.isRecalibrationServiceableMobile !== null) {
|
||||
return this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile;
|
||||
} else {
|
||||
return this.isGlassServiceableMobile;
|
||||
}
|
||||
},
|
||||
isServiceableInshop() {
|
||||
if (this.isRecalibrationServiceableInshop !== null) {
|
||||
return this.isGlassServiceableInshop && this.isRecalibrationServiceableInshop;
|
||||
} else {
|
||||
return this.isGlassServiceableInshop;
|
||||
}
|
||||
},
|
||||
isServiceableMobileOnly() {
|
||||
return this.isServiceableMobile && !this.isServiceableInshop;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@ export default {
|
|||
suppressError: Boolean,
|
||||
validationRules: String,
|
||||
cmsWidgetName: String,
|
||||
isGlassServiceableMobile: Boolean,
|
||||
isGlassServiceableInshop: Boolean,
|
||||
isRecalibrationServiceableInshop: Boolean,
|
||||
isRecalibrationServiceableMobile: Boolean,
|
||||
isServiceableMobile: Boolean,
|
||||
isServiceableInshop: Boolean,
|
||||
},
|
||||
computed: {
|
||||
questionText() {
|
||||
|
|
@ -40,45 +38,20 @@ export default {
|
|||
},
|
||||
answersToDisplay() {
|
||||
let filteredAnswers;
|
||||
if (this.serviceability == "All") {
|
||||
if (this.isServiceableMobile && this.isServiceableInshop) {
|
||||
filteredAnswers = this.answersFromCms;
|
||||
} else if (this.serviceability == "MobileOnly") {
|
||||
} else if (this.isServiceableMobile) {
|
||||
filteredAnswers = this.answersFromCms.filter((answer) => answer.Name == "Mobile");
|
||||
} else if (this.serviceability == "InshopOnly") {
|
||||
} else if (this.isServiceableInshop) {
|
||||
filteredAnswers = this.answersFromCms.filter(
|
||||
(answer) => answer.Name == "Inshop" || answer.Name == "DropOff"
|
||||
);
|
||||
} else if (this.serviceability == "None") {
|
||||
} else {
|
||||
filteredAnswers = [];
|
||||
}
|
||||
|
||||
return filteredAnswers;
|
||||
},
|
||||
serviceability() {
|
||||
let mobileAvailable;
|
||||
if (this.IsRecalibrationServiceableMobile == null) {
|
||||
mobileAvailable = this.isGlassServiceableMobile;
|
||||
} else {
|
||||
mobileAvailable =
|
||||
this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile;
|
||||
}
|
||||
|
||||
const inshopAvailable =
|
||||
this.isGlassServiceableInshop && this.isRecalibrationServiceableInshop;
|
||||
|
||||
let result;
|
||||
if (inshopAvailable && mobileAvailable) {
|
||||
result = "All";
|
||||
} else if (inshopAvailable && !mobileAvailable) {
|
||||
result = "InshopOnly";
|
||||
} else if (!inshopAvailable && mobileAvailable) {
|
||||
result = "MobileOnly";
|
||||
} else if (!inshopAvailable && !mobileAvailable) {
|
||||
result = "None";
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
selectedValues: {
|
||||
get: function () {
|
||||
return this.modelValue;
|
||||
|
|
@ -87,11 +60,14 @@ export default {
|
|||
this.$emit("update:modelValue", newValue);
|
||||
},
|
||||
},
|
||||
isMobileOnly() {
|
||||
return this.isServiceableMobile && !this.isServiceableInshop;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
serviceability: {
|
||||
isMobileOnly: {
|
||||
handler(newValue) {
|
||||
if (newValue == "MobileOnly") {
|
||||
if (newValue) {
|
||||
this.selectedValues = "Mobile";
|
||||
} else {
|
||||
this.selectedValues = null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue