Tech review changes

This commit is contained in:
Leah Schumann 2023-05-17 10:10:19 -04:00
parent 1283cfab2b
commit e98efb7d6a
3 changed files with 27 additions and 22 deletions

View file

@ -141,7 +141,7 @@ export default {
const fieldOptions = { const fieldOptions = {
value: modelValue, value: modelValue,
initialValue: modelValue, initialValue: null,
}; };
const { errorMessage, handleBlur, handleChange, meta, validate, errors, resetField } = const { errorMessage, handleBlur, handleChange, meta, validate, errors, resetField } =
@ -255,10 +255,8 @@ export default {
}, },
}, },
watch: { watch: {
modelValue(newValue) { modelValue(newValue, oldValue) {
this.resetField({ this.resetField();
value: newValue,
});
}, },
answers() { answers() {
//once we get the answers to display from parent, see if we need a GA event to log what we showed //once we get the answers to display from parent, see if we need a GA event to log what we showed

View file

@ -151,7 +151,6 @@ export default {
isRecalibrationServiceableMobile: null, isRecalibrationServiceableMobile: null,
selectedAppointmentType: this.getSelectedAppointmentType(), selectedAppointmentType: this.getSelectedAppointmentType(),
selectedProvider: this.getSelectedProvider(), selectedProvider: this.getSelectedProvider(),
//selectedProviderNumber: this.getSelectedProvider().providerNumber,
mobileFeePart: null, mobileFeePart: null,
zipContainsMilitaryBase: false, zipContainsMilitaryBase: false,
zipCodeCtu: null, zipCodeCtu: null,
@ -336,6 +335,9 @@ export default {
this.zipContainsMilitaryBase = val; this.zipContainsMilitaryBase = val;
} }
}, },
setMobileFeePart(mobileFeePart) {
this.mobileFeePart = mobileFeePart;
},
getServiceAddressFromStore() { getServiceAddressFromStore() {
return store.getters.order.serviceLocation.address; return store.getters.order.serviceLocation.address;
}, },
@ -354,10 +356,7 @@ export default {
: store.getters.order.serviceLocation.appointmentType; : store.getters.order.serviceLocation.appointmentType;
}, },
getSelectedProvider() { getSelectedProvider() {
return store.getters.order.serviceLocation.provider ?? null; return store.getters.order.serviceLocation.provider;
},
setMobileFeePart(mobileFeePart) {
this.mobileFeePart = mobileFeePart;
}, },
resetMobileLocation() { resetMobileLocation() {
this.streetAddress = ""; this.streetAddress = "";
@ -411,10 +410,14 @@ 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: {
// selectedAppointmentType: {
// handler() {
// this.selectedProvider = null;
// }
// }
// },
components: { components: {
alert, alert,
serviceZipModalQuestion, serviceZipModalQuestion,

View file

@ -45,11 +45,13 @@ import textLink from "@/ux-components/text-link/text-link";
import { storeActions } from "@/constants/store-actions.js"; import { storeActions } from "@/constants/store-actions.js";
// Supporting files // Supporting files
import { defineRule } from "vee-validate"; import { defineRule, useField } from "vee-validate";
import { required } from "@/helpers/validation-rules"; import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages"; import { errorMessages } from "@/constants/error-messages";
import baseMixin from "@/mixins/base-mixin.js"; import baseMixin from "@/mixins/base-mixin.js";
import { nextTick } from "vue"; import { nextTick } from "vue";
import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper";
import { thisTypeAnnotation } from "@babel/types";
defineRule("option-required", required(errorMessages.OPTION_REQUIRED)); defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
@ -68,6 +70,7 @@ export default {
props: { props: {
modelValue: { modelValue: {
type: Object, type: Object,
default: () => (null)
}, },
serviceZipCode: String, serviceZipCode: String,
selectedAppointmentType: String, selectedAppointmentType: String,
@ -81,9 +84,10 @@ export default {
}, },
selectedValue: { selectedValue: {
get: function () { get: function () {
return this.modelValue; return this.modelValue?.providerNumber;
}, },
set: function (newValue) { set: function (newValue) {
// Button Question only supports Number, String data types so we must get the full object to emit
const provider = this.getSelectedProviderObject(newValue); const provider = this.getSelectedProviderObject(newValue);
this.$emit("update:modelValue", provider); this.$emit("update:modelValue", provider);
}, },
@ -165,11 +169,8 @@ export default {
resetAnswers() { resetAnswers() {
this.answers = []; this.answers = [];
this.shopIndex = 0; this.shopIndex = 0;
this.selectedValue = "";
if (this.$refs.buttonQuestion) {
this.$refs.buttonQuestion.resetField();
}
}, },
async reloadShopData(serviceZipCode) { async reloadShopData(serviceZipCode) {
const result = await this.loadData(serviceZipCode); const result = await this.loadData(serviceZipCode);
@ -181,7 +182,6 @@ export default {
await this.getNextShopsFromList(); await this.getNextShopsFromList();
}, },
getSelectedProviderObject(providerNumber) { getSelectedProviderObject(providerNumber) {
// Button Question only supports primitive values so we must get the full object
const provider = this.shopProviders?.find( const provider = this.shopProviders?.find(
(provider) => provider.providerNumber == providerNumber (provider) => provider.providerNumber == providerNumber
); );
@ -203,6 +203,12 @@ export default {
await this.$nextTick(); await this.$nextTick();
this.selectedValue = null;
this.$refs.buttonQuestion?.resetField();
await this.$nextTick();
if (newValue !== "Mobile") { if (newValue !== "Mobile") {
await this.getNextShopsFromList(); await this.getNextShopsFromList();
} }
@ -210,8 +216,6 @@ export default {
}, },
shopProviders: { shopProviders: {
async handler(newValue) { async handler(newValue) {
this.resetAnswers();
await this.$nextTick(); await this.$nextTick();
if (this.selectedAppointmentType) { if (this.selectedAppointmentType) {