Added separate emit for the full provider object when a button is clicked
This commit is contained in:
parent
8a6dbe7b0c
commit
e115b2a5c1
3 changed files with 35 additions and 17 deletions
|
|
@ -71,7 +71,8 @@
|
||||||
<shopQuestion
|
<shopQuestion
|
||||||
ref="shopQuestion"
|
ref="shopQuestion"
|
||||||
v-show="isShopQuestionDisplayed"
|
v-show="isShopQuestionDisplayed"
|
||||||
v-model="selectedProvider"
|
v-model="selectedProviderNumber"
|
||||||
|
@providerSelected="onProviderSelected"
|
||||||
:serviceZipCode="zipCode"
|
:serviceZipCode="zipCode"
|
||||||
:selectedAppointmentType="selectedAppointmentType"
|
:selectedAppointmentType="selectedAppointmentType"
|
||||||
:isDisplayed="isShopQuestionDisplayed"
|
:isDisplayed="isShopQuestionDisplayed"
|
||||||
|
|
@ -133,6 +134,14 @@ 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() {
|
||||||
|
|
@ -148,7 +157,8 @@ export default {
|
||||||
isGlassServiceableMobile: null,
|
isGlassServiceableMobile: null,
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
selectedAppointmentType: null,
|
selectedAppointmentType: null,
|
||||||
selectedProvider: null,
|
selectedProvider: this.getSelectedProvider(),
|
||||||
|
selectedProviderNumber: this.getSelectedProvider().providerNumber,
|
||||||
mobileFeePart: null,
|
mobileFeePart: null,
|
||||||
zipContainsMilitaryBase: false,
|
zipContainsMilitaryBase: false,
|
||||||
};
|
};
|
||||||
|
|
@ -215,7 +225,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 = null;
|
this.selectedProvider = defaultProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state = newValue.state;
|
this.state = newValue.state;
|
||||||
|
|
@ -250,7 +260,7 @@ export default {
|
||||||
if (!this.selectedAppointmentType == "Mobile") {
|
if (!this.selectedAppointmentType == "Mobile") {
|
||||||
this.selectedAppointmentType = null;
|
this.selectedAppointmentType = null;
|
||||||
}
|
}
|
||||||
this.selectedProvider = null;
|
this.selectedProvider = defaultProvider;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -340,6 +350,9 @@ export default {
|
||||||
getServiceZipCodeFromStore() {
|
getServiceZipCodeFromStore() {
|
||||||
return store.getters.order.serviceLocation.zipCode;
|
return store.getters.order.serviceLocation.zipCode;
|
||||||
},
|
},
|
||||||
|
getSelectedProvider() {
|
||||||
|
return store.getters.order.serviceLocation.provider ?? defaultProvider;
|
||||||
|
},
|
||||||
setMobileFeePart(mobileFeePart) {
|
setMobileFeePart(mobileFeePart) {
|
||||||
this.mobileFeePart = mobileFeePart;
|
this.mobileFeePart = mobileFeePart;
|
||||||
},
|
},
|
||||||
|
|
@ -373,6 +386,16 @@ export default {
|
||||||
async reloadShopData() {
|
async reloadShopData() {
|
||||||
await this.$refs.shopQuestion.reloadShopData(this.zipCode);
|
await this.$refs.shopQuestion.reloadShopData(this.zipCode);
|
||||||
},
|
},
|
||||||
|
onProviderSelected(selectedProvider) {
|
||||||
|
this.selectedProvider = selectedProvider;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
selectedProvider: {
|
||||||
|
handler(newValue) {
|
||||||
|
console.log(newValue);
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
alert,
|
alert,
|
||||||
|
|
|
||||||
|
|
@ -157,17 +157,7 @@ describe("shop-question.vue", () => {
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mixins: [mockMixin],
|
mixins: [mockMixin],
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: null,
|
||||||
address: {
|
|
||||||
city: "POWELL",
|
|
||||||
country: "US",
|
|
||||||
state: "OH",
|
|
||||||
streetAddress: "3938 POWELL RD",
|
|
||||||
zipCode: "43065",
|
|
||||||
},
|
|
||||||
distanceInMiles: 16.2690495685233,
|
|
||||||
providerNumber: null,
|
|
||||||
},
|
|
||||||
serviceZipCode: "43081",
|
serviceZipCode: "43081",
|
||||||
selectedAppointmentType: "Dropoff",
|
selectedAppointmentType: "Dropoff",
|
||||||
cmsWidgetName: cmsWidgetName,
|
cmsWidgetName: cmsWidgetName,
|
||||||
|
|
@ -437,10 +427,14 @@ describe("shop-question.vue", () => {
|
||||||
|
|
||||||
it("Should display the number of shops necessary to show a previously selected shop", async () => {
|
it("Should display the number of shops necessary to show a previously selected shop", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
const selectedProvider = {
|
||||||
|
providerNumber: "003341",
|
||||||
|
};
|
||||||
|
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mixins: [mockMixin],
|
mixins: [mockMixin],
|
||||||
props: {
|
props: {
|
||||||
modelValue: "003341",
|
modelValue: selectedProvider.providerNumber,
|
||||||
serviceZipCode: "43081",
|
serviceZipCode: "43081",
|
||||||
selectedAppointmentType: "Dropoff",
|
selectedAppointmentType: "Dropoff",
|
||||||
cmsWidgetName: cmsWidgetName,
|
cmsWidgetName: cmsWidgetName,
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,8 @@ export default {
|
||||||
(provider) => provider.providerNumber == newValue
|
(provider) => provider.providerNumber == newValue
|
||||||
);
|
);
|
||||||
|
|
||||||
this.$emit("update:modelValue", provider);
|
this.$emit("update:modelValue", newValue);
|
||||||
|
this.$emit("providerSelected", provider);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
displayDropoffInformation() {
|
displayDropoffInformation() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue