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