Remove unused model-value, add newZipCode datamember
This commit is contained in:
parent
371849e924
commit
12c3cabb25
2 changed files with 8 additions and 57 deletions
|
|
@ -106,15 +106,10 @@
|
||||||
</div>
|
</div>
|
||||||
<shopQuestionPopup
|
<shopQuestionPopup
|
||||||
v-if="isShopQuestionDisplayed"
|
v-if="isShopQuestionDisplayed"
|
||||||
:modelValue="{
|
|
||||||
zipCode: zipCode,
|
|
||||||
state: state,
|
|
||||||
}"
|
|
||||||
:preSelectedProviderNumber="selectedProvider?.providerNumber"
|
:preSelectedProviderNumber="selectedProvider?.providerNumber"
|
||||||
:shopProviderData="shopProviderData"
|
:shopProviderData="shopProviderData"
|
||||||
@updated-serviceability="setServiceabilityDetails"
|
@updated-serviceability="setServiceabilityDetails"
|
||||||
@shop-selected="onShopSelected"
|
@shop-selected="onShopSelected"
|
||||||
@update:modelValue="onShopModelUpdated"
|
|
||||||
@updated-zipcode-ctu="setZipcodeCtu"
|
@updated-zipcode-ctu="setZipcodeCtu"
|
||||||
@update-shop-provider-data="shopProviderData = $event"
|
@update-shop-provider-data="shopProviderData = $event"
|
||||||
@updated-contains-military-base="setContainsMilitaryBase"
|
@updated-contains-military-base="setContainsMilitaryBase"
|
||||||
|
|
@ -1185,25 +1180,6 @@ export default {
|
||||||
setZipcodeCtu(zipcodeCtu) {
|
setZipcodeCtu(zipcodeCtu) {
|
||||||
this.zipCodeCtu = zipcodeCtu;
|
this.zipCodeCtu = zipcodeCtu;
|
||||||
},
|
},
|
||||||
onShopModelUpdated(newModel) {
|
|
||||||
if (newModel.zipCode) {
|
|
||||||
this.zipCode = newModel.zipCode;
|
|
||||||
}
|
|
||||||
if (newModel.zipCodeCtu) {
|
|
||||||
this.zipCodeCtu = newModel.zipCodeCtu;
|
|
||||||
}
|
|
||||||
if (newModel.state) {
|
|
||||||
this.state = newModel.state;
|
|
||||||
}
|
|
||||||
if (this.shopProviderData && newModel.selectedProviderNumber) {
|
|
||||||
const provider = this.shopProviderData.shopProviders.find(
|
|
||||||
(p) => p.providerNumber === newModel.selectedProviderNumber
|
|
||||||
);
|
|
||||||
if (provider) {
|
|
||||||
this.selectedProvider = provider;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async getMoreScheduleData(startDate, endDate) {
|
async getMoreScheduleData(startDate, endDate) {
|
||||||
// called only when "View more dates" is clicked; not on initial page load
|
// called only when "View more dates" is clicked; not on initial page load
|
||||||
const moreShopTimeSlots = await getScheduleApiResponse({
|
const moreShopTimeSlots = await getScheduleApiResponse({
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
ref="serviceZipQuestion"
|
ref="serviceZipQuestion"
|
||||||
class="shop-question-zipcode"
|
class="shop-question-zipcode"
|
||||||
customInputId="serviceZipCode"
|
customInputId="serviceZipCode"
|
||||||
v-model="internalModel.zipCode"
|
v-model="newZipCode"
|
||||||
cmsWidgetName="ServiceZipQuestionWidget"
|
cmsWidgetName="ServiceZipQuestionWidget"
|
||||||
@search-icon-click="onSearchZip"
|
@search-icon-click="onSearchZip"
|
||||||
@keydown.enter="onSearchZip"
|
@keydown.enter="onSearchZip"
|
||||||
|
|
@ -111,7 +111,7 @@ export default {
|
||||||
mixins: [baseMixin],
|
mixins: [baseMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
internalModel: this.copyModel(this.modelValue), // zip refactor
|
newZipCode: this.zipCode,
|
||||||
answers: [],
|
answers: [],
|
||||||
shopListButton: shopListButton,
|
shopListButton: shopListButton,
|
||||||
shopIndex: 0,
|
shopIndex: 0,
|
||||||
|
|
@ -125,13 +125,6 @@ export default {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
shopProviderData: Object,
|
shopProviderData: Object,
|
||||||
modelValue: {
|
|
||||||
type: Object,
|
|
||||||
default: () => ({
|
|
||||||
state: "",
|
|
||||||
zipCode: "",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
zipCode: {
|
zipCode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
|
|
@ -157,12 +150,6 @@ export default {
|
||||||
modal() {
|
modal() {
|
||||||
return this.$refs.shopQuestionModal;
|
return this.$refs.shopQuestionModal;
|
||||||
},
|
},
|
||||||
selectedValue: {
|
|
||||||
get: function () {
|
|
||||||
return this.modelValue;
|
|
||||||
},
|
|
||||||
set: function (newValue) {},
|
|
||||||
},
|
|
||||||
additionalButtonData() {
|
additionalButtonData() {
|
||||||
const startDate = new Date();
|
const startDate = new Date();
|
||||||
const endDate = new Date();
|
const endDate = new Date();
|
||||||
|
|
@ -271,12 +258,6 @@ export default {
|
||||||
|
|
||||||
this.scrollToPageBottom();
|
this.scrollToPageBottom();
|
||||||
},
|
},
|
||||||
copyModel(modelToCopy) {
|
|
||||||
return {
|
|
||||||
state: modelToCopy.state,
|
|
||||||
zipCode: modelToCopy.zipCode,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
onModalOpened() {
|
onModalOpened() {
|
||||||
const preSelectedIndex = this.shopProviders.findIndex(
|
const preSelectedIndex = this.shopProviders.findIndex(
|
||||||
(provider) => provider.providerNumber == this.preSelectedProviderNumber
|
(provider) => provider.providerNumber == this.preSelectedProviderNumber
|
||||||
|
|
@ -287,8 +268,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.shopIndex = 3;
|
this.shopIndex = 3;
|
||||||
}
|
}
|
||||||
this.internalModel = this.copyModel(this.modelValue);
|
|
||||||
this.internalModel.zipCode = this.zipCode;
|
|
||||||
this.localShopProviderData = this.shopProviderData;
|
this.localShopProviderData = this.shopProviderData;
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
this.onSearchZip();
|
this.onSearchZip();
|
||||||
|
|
@ -307,7 +287,6 @@ export default {
|
||||||
this.modal.closeModal();
|
this.modal.closeModal();
|
||||||
},
|
},
|
||||||
onModalClosed() {
|
onModalClosed() {
|
||||||
this.internalModel = this.copyModel(this.modelValue);
|
|
||||||
this.resetsOnZipInput();
|
this.resetsOnZipInput();
|
||||||
},
|
},
|
||||||
resetsOnZipInput() {
|
resetsOnZipInput() {
|
||||||
|
|
@ -320,9 +299,8 @@ export default {
|
||||||
}
|
}
|
||||||
this.resetsOnZipInput();
|
this.resetsOnZipInput();
|
||||||
this.displayNoShopsAlert = false;
|
this.displayNoShopsAlert = false;
|
||||||
const zip = this.internalModel.zipCode;
|
|
||||||
const zipCodeData = await this.getZipCodeData(
|
const zipCodeData = await this.getZipCodeData(
|
||||||
this.internalModel.zipCode,
|
this.newZipCode,
|
||||||
"service-location"
|
"service-location"
|
||||||
);
|
);
|
||||||
if (!zipCodeData.isValid) {
|
if (!zipCodeData.isValid) {
|
||||||
|
|
@ -333,7 +311,7 @@ export default {
|
||||||
if (this.isVehicleHeavyTruck) {
|
if (this.isVehicleHeavyTruck) {
|
||||||
// check the location endpoint to verify this zip can service a heavy truck
|
// check the location endpoint to verify this zip can service a heavy truck
|
||||||
const closestShops = await getClosestApplicableShops(
|
const closestShops = await getClosestApplicableShops(
|
||||||
this.internalModel.zipCode,
|
this.newZipCode,
|
||||||
this.carId,
|
this.carId,
|
||||||
"service-location"
|
"service-location"
|
||||||
);
|
);
|
||||||
|
|
@ -344,12 +322,12 @@ export default {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getShopProviderData(zip).then(async (result) => {
|
getShopProviderData(this.newZipCode).then(async (result) => {
|
||||||
if (this.displayNoShopsAlert === true) {
|
if (this.displayNoShopsAlert === true) {
|
||||||
this.displayNoShopsAlert = false;
|
this.displayNoShopsAlert = false;
|
||||||
}
|
}
|
||||||
this.localShopProviderData = result.data;
|
this.localShopProviderData = result.data;
|
||||||
this.updateShopsForZip(this.internalModel.zipCode);
|
this.updateShopsForZip(this.newZipCode);
|
||||||
this.selectedProvider = new Provider();
|
this.selectedProvider = new Provider();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -504,15 +482,12 @@ export default {
|
||||||
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
||||||
this.$emit("updated-bill-to-account-number", billToAccountNumber);
|
this.$emit("updated-bill-to-account-number", billToAccountNumber);
|
||||||
this.$emit("updated-zipcode-ctu", selectedProvider.address.zipCodeCtu);
|
this.$emit("updated-zipcode-ctu", selectedProvider.address.zipCodeCtu);
|
||||||
|
|
||||||
this.$emit("update:modelValue", this.selectedValue);
|
|
||||||
this.$emit("update-shop-provider-data", this.localShopProviderData);
|
this.$emit("update-shop-provider-data", this.localShopProviderData);
|
||||||
this.internalModel.state = zipCodeData.state;
|
|
||||||
this.$emit("shop-selected", {
|
this.$emit("shop-selected", {
|
||||||
providerNumber: selectedProvider?.providerNumber,
|
providerNumber: selectedProvider?.providerNumber,
|
||||||
address: selectedProvider?.address,
|
address: selectedProvider?.address,
|
||||||
searchedZip: zipToEmit,
|
searchedZip: zipToEmit,
|
||||||
searchedState: this.internalModel.state,
|
searchedState: zipCodeData.state,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue