From 23d433931d792184a984a2b9029d6818ed364021 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 29 Mar 2023 15:34:52 -0400 Subject: [PATCH] Pull serviceability logic up to service-location page. --- .../service-location/service-location.vue | 28 +++++++---- .../service-type-question.vue | 46 +++++-------------- 2 files changed, 31 insertions(+), 43 deletions(-) diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index d8167ad57..2b166e830 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -20,10 +20,8 @@ alertClass="alert-warning" /> 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;