CSR-762 Change requests/fix bugs

This commit is contained in:
Katie 2022-10-03 14:13:24 -04:00
parent d093a9b842
commit 458ee702ae
4 changed files with 11 additions and 9 deletions

View file

@ -14,6 +14,7 @@
:value="value" :value="value"
:checked="isChecked" :checked="isChecked"
@blur="handleBlur" @blur="handleBlur"
@keypress.space="handleEventAction('keypressSubmit', $event)"
@keypress.enter="handleEventAction('keypressSubmit', $event)" @keypress.enter="handleEventAction('keypressSubmit', $event)"
@change="handleEventAction('change', $event)" /> @change="handleEventAction('change', $event)" />

View file

@ -5,7 +5,7 @@
groupName="ChooseAddressVehicle" groupName="ChooseAddressVehicle"
:questionText="questionText" :questionText="questionText"
:answers="vehicles" :answers="vehicles"
v-model="selectedVehicleVinAsArray" v-model="selectedVehicleVin"
isRequired isRequired
:validation-rules="validationRules" :validation-rules="validationRules"
:valueToLogType="ValueToLogTypes.LAST_5" :valueToLogType="ValueToLogTypes.LAST_5"
@ -63,18 +63,16 @@ export default {
questionText() { questionText() {
return this.getCmsContent("VehicleConfirmationQuestion", "QuestionText"); return this.getCmsContent("VehicleConfirmationQuestion", "QuestionText");
}, },
selectedVehicleVinAsArray: { selectedVehicleVin: {
get: function() { get: function() {
const modelValueAsArray = this.modelValue ? [this.modelValue] : []; return this.modelValue;
return modelValueAsArray;
}, },
set: function(newValue) { set: function(newValue) {
const newValueAsScalar = newValue && newValue.length > 0 ? newValue[newValue.length-1] : null; this.$emit("update:modelValue", newValue);
this.$emit("update:modelValue", newValueAsScalar);
} }
}, },
selectedVehicle() { // this computed is only needed for the computed differentVehicleAlertBody text above selectedVehicle() { // this computed is only needed for the computed differentVehicleAlertBody text above
return this.vehicles.find( ({ vin }) => vin === this.selectedVehicleVinAsArray[this.selectedVehicleVinAsArray.length-1] ); return this.vehicles.find( ({ vin }) => vin === this.selectedVehicleVin[this.selectedVehicleVin.length-1] );
}, },
}, },
components: { components: {

View file

@ -195,7 +195,7 @@ export default {
selectedVehicleVin: { selectedVehicleVin: {
handler() { handler() {
// does this vehicle match the previously selected carId? // does this vehicle match the previously selected carId?
this.isCarIdDifferent = this.selectedVehicle.vehicle.carId !== store.getters.vehicle.carId; this.isCarIdDifferent = this.selectedVehicle?.vehicle.carId !== store.getters.vehicle.carId;
if (this.isCarIdDifferent) { if (this.isCarIdDifferent) {
this.$refs.funnelFooter.updateButtonText(`Continue with ${this.selectedVehicle.vehicle.year} ${this.selectedVehicle.vehicle.make} ${this.selectedVehicle.vehicle.model}`); this.$refs.funnelFooter.updateButtonText(`Continue with ${this.selectedVehicle.vehicle.year} ${this.selectedVehicle.vehicle.make} ${this.selectedVehicle.vehicle.model}`);
} else { } else {

View file

@ -16,7 +16,10 @@ export default {
valueToLogType: String, valueToLogType: String,
validationRules: String, validationRules: String,
isWide: Boolean, isWide: Boolean,
isRequired: Boolean isRequired: {
type: Boolean,
default: true
}
}, },
data() { data() {
return { return {