WIP
This commit is contained in:
parent
1a92b71927
commit
c2b683114f
4 changed files with 35 additions and 28 deletions
|
|
@ -121,7 +121,7 @@ export default {
|
||||||
isOverflowScrollable: Boolean,
|
isOverflowScrollable: Boolean,
|
||||||
isWide: Boolean,
|
isWide: Boolean,
|
||||||
isCashOrInsurance: Boolean,
|
isCashOrInsurance: Boolean,
|
||||||
modelValue: [Array, Number, String, Object],
|
modelValue: [Array, Number, String],
|
||||||
value: [Number, String],
|
value: [Number, String],
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
suppressError: Boolean,
|
suppressError: Boolean,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="fade" mode="out-in">
|
<transition name="fade" mode="out-in">
|
||||||
<div class="appointment-type-question" aria-live="polite">
|
<div class="appointment-type-question" aria-live="polite" v-if="isDisplayed">
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
ref="buttonQuestion"
|
ref="buttonQuestion"
|
||||||
customButtonQuestionId="appointmentTypeQuestion"
|
customButtonQuestionId="appointmentTypeQuestion"
|
||||||
|
|
@ -25,6 +25,7 @@ export default {
|
||||||
modelValue: String,
|
modelValue: String,
|
||||||
groupName: String,
|
groupName: String,
|
||||||
isAvailable: Boolean,
|
isAvailable: Boolean,
|
||||||
|
isDisplayed: Boolean,
|
||||||
suppressError: Boolean,
|
suppressError: Boolean,
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
cmsWidgetName: String,
|
cmsWidgetName: String,
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,10 @@
|
||||||
alertClass="alert-warning" />
|
alertClass="alert-warning" />
|
||||||
<appointmentTypeQuestion
|
<appointmentTypeQuestion
|
||||||
v-model="selectedAppointmentType"
|
v-model="selectedAppointmentType"
|
||||||
v-show="!displayNoShopsAlert"
|
v-show="isAppointmentTypeDisplayed"
|
||||||
:isServiceableMobile="isServiceableMobile"
|
:isServiceableMobile="isServiceableMobile"
|
||||||
:isServiceableInshop="isServiceableInshop"
|
:isServiceableInshop="isServiceableInshop"
|
||||||
|
:isDisplayed="isAppointmentTypeDisplayed"
|
||||||
ref="appointmentTypeQuestion"
|
ref="appointmentTypeQuestion"
|
||||||
groupName="appointmentTypeQuestion"
|
groupName="appointmentTypeQuestion"
|
||||||
cmsWidgetName="AppointmentTypeQuestionWidget"
|
cmsWidgetName="AppointmentTypeQuestionWidget"
|
||||||
|
|
@ -71,7 +72,7 @@
|
||||||
<shopQuestion
|
<shopQuestion
|
||||||
ref="shopQuestion"
|
ref="shopQuestion"
|
||||||
v-show="isShopQuestionDisplayed"
|
v-show="isShopQuestionDisplayed"
|
||||||
v-model="selectedProviderNumber"
|
v-model="selectedProvider"
|
||||||
@providerSelected="onProviderSelected"
|
@providerSelected="onProviderSelected"
|
||||||
:serviceZipCode="zipCode"
|
:serviceZipCode="zipCode"
|
||||||
:selectedAppointmentType="selectedAppointmentType"
|
:selectedAppointmentType="selectedAppointmentType"
|
||||||
|
|
@ -134,14 +135,6 @@ defineRule("mobile-location-required", (value) => {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultProvider = {
|
|
||||||
providerNumber: null,
|
|
||||||
address: null,
|
|
||||||
city: null,
|
|
||||||
state: null,
|
|
||||||
zip: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-location",
|
name: "service-location",
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -158,7 +151,7 @@ export default {
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
selectedAppointmentType: this.getSelectedAppointmentType(),
|
selectedAppointmentType: this.getSelectedAppointmentType(),
|
||||||
selectedProvider: this.getSelectedProvider(),
|
selectedProvider: this.getSelectedProvider(),
|
||||||
selectedProviderNumber: this.getSelectedProvider().providerNumber,
|
//selectedProviderNumber: this.getSelectedProvider().providerNumber,
|
||||||
mobileFeePart: null,
|
mobileFeePart: null,
|
||||||
zipContainsMilitaryBase: false,
|
zipContainsMilitaryBase: false,
|
||||||
zipCodeCtu: null,
|
zipCodeCtu: null,
|
||||||
|
|
@ -226,7 +219,7 @@ export default {
|
||||||
if (newValue.zipCode !== this.zipCode) {
|
if (newValue.zipCode !== this.zipCode) {
|
||||||
this.resetMobileLocation();
|
this.resetMobileLocation();
|
||||||
this.selectedAppointmentType = null;
|
this.selectedAppointmentType = null;
|
||||||
this.selectedProvider = defaultProvider;
|
this.selectedProvider = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state = newValue.state;
|
this.state = newValue.state;
|
||||||
|
|
@ -261,7 +254,7 @@ export default {
|
||||||
if (!this.selectedAppointmentType == "Mobile") {
|
if (!this.selectedAppointmentType == "Mobile") {
|
||||||
this.selectedAppointmentType = null;
|
this.selectedAppointmentType = null;
|
||||||
}
|
}
|
||||||
this.selectedProvider = defaultProvider;
|
this.selectedProvider = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -285,6 +278,11 @@ export default {
|
||||||
this.selectedAppointmentType === "Dropoff"
|
this.selectedAppointmentType === "Dropoff"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
isAppointmentTypeDisplayed() {
|
||||||
|
return (
|
||||||
|
this.zipCode && !this.displayNoShopsAlert
|
||||||
|
);
|
||||||
|
},
|
||||||
// Specifically check for isRecalibrationServiceableMobile === false, not null or true.
|
// Specifically check for isRecalibrationServiceableMobile === false, not null or true.
|
||||||
requiresInshopRecalibration() {
|
requiresInshopRecalibration() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -353,10 +351,10 @@ export default {
|
||||||
return store.getters.order.serviceLocation.zipCode;
|
return store.getters.order.serviceLocation.zipCode;
|
||||||
},
|
},
|
||||||
getSelectedAppointmentType() {
|
getSelectedAppointmentType() {
|
||||||
return store.getters.order.serviceLocation.appointmentType;
|
return store.getters.order.serviceLocation.appointmentType == "None" ? null : store.getters.order.serviceLocation.appointmentType;
|
||||||
},
|
},
|
||||||
getSelectedProvider() {
|
getSelectedProvider() {
|
||||||
return store.getters.order.serviceLocation.provider ?? defaultProvider;
|
return store.getters.order.serviceLocation.provider ?? null;
|
||||||
},
|
},
|
||||||
setMobileFeePart(mobileFeePart) {
|
setMobileFeePart(mobileFeePart) {
|
||||||
this.mobileFeePart = mobileFeePart;
|
this.mobileFeePart = mobileFeePart;
|
||||||
|
|
|
||||||
|
|
@ -84,13 +84,8 @@ export default {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
// Button Question only supports primitive values so we must get the full object to emit to the page
|
const provider = this.getSelectedProviderObject(newValue);
|
||||||
const provider = this.shopProviders?.find(
|
this.$emit("update:modelValue", provider);
|
||||||
(provider) => provider.providerNumber == newValue
|
|
||||||
);
|
|
||||||
|
|
||||||
this.$emit("update:modelValue", newValue);
|
|
||||||
this.$emit("providerSelected", provider);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
displayDropoffInformation() {
|
displayDropoffInformation() {
|
||||||
|
|
@ -185,6 +180,21 @@ export default {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await this.getNextShopsFromList();
|
await this.getNextShopsFromList();
|
||||||
},
|
},
|
||||||
|
getSelectedProviderObject(providerNumber) {
|
||||||
|
// Button Question only supports primitive values so we must get the full object
|
||||||
|
const provider = this.shopProviders?.find(
|
||||||
|
(provider) => provider.providerNumber == providerNumber
|
||||||
|
);
|
||||||
|
|
||||||
|
return provider;
|
||||||
|
},
|
||||||
|
getSelectedProviderIndex(providers, selectedProviderNumber) {
|
||||||
|
const index = providers.findIndex(
|
||||||
|
(provider) => provider.providerNumber == selectedProviderNumber
|
||||||
|
);
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectedAppointmentType: {
|
selectedAppointmentType: {
|
||||||
|
|
@ -200,14 +210,12 @@ export default {
|
||||||
},
|
},
|
||||||
shopProviders: {
|
shopProviders: {
|
||||||
async handler(newValue) {
|
async handler(newValue) {
|
||||||
//this.resetAnswers();
|
this.resetAnswers();
|
||||||
|
|
||||||
await this.$nextTick();
|
await this.$nextTick();
|
||||||
|
|
||||||
if (this.selectedAppointmentType) {
|
if (this.selectedAppointmentType) {
|
||||||
const selectedShopIndex = newValue.findIndex(
|
const selectedShopIndex = this.getSelectedProviderIndex(newValue, this.modelValue);
|
||||||
(provider) => provider.providerNumber == this.modelValue
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedShopIndex >= 3) {
|
if (selectedShopIndex >= 3) {
|
||||||
await this.getNextShopsFromList(selectedShopIndex + 1);
|
await this.getNextShopsFromList(selectedShopIndex + 1);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue