Checkpoint

This commit is contained in:
Leah Schumann 2024-05-02 08:53:11 -04:00
parent 53530095dc
commit a34e594832
4 changed files with 59 additions and 103 deletions

View file

@ -45,8 +45,7 @@
@blur="handleChange" @blur="handleChange"
:maxlength="maxLength ? maxLength : '999'" :maxlength="maxLength ? maxLength : '999'"
@focus="$emit('focus', $event.target.value)" @focus="$emit('focus', $event.target.value)"
@keydown="keyDownHandler" @keydown="keyDownHandler" />
@animationstart="checkAnimation" />
<button <button
v-if="includeSearchIcon" v-if="includeSearchIcon"
type="submit" type="submit"
@ -131,7 +130,6 @@ export default {
default: false, default: false,
isRequired: false, isRequired: false,
}, },
autofilled: Boolean
}, },
setup(props) { setup(props) {
const uuid = uuidv4(); const uuid = uuidv4();
@ -176,30 +174,10 @@ export default {
}, },
methods: { methods: {
focusSearchInput() { focusSearchInput() {
//Focus cursor in input when search icon is clicked // Focus cursor in input when search icon is clicked
const field = document.querySelector("input"); const field = document.querySelector("input");
field.focus(); field.focus();
}, },
checkAnimation(e) {
// if(e.animationName == "onAutoFillStart")
// {
// console.log("onAutoFillStart")
// //this.autofilled = true;
// }
if(e.animationName == "onAutoFillSelected")
{
//console.log("onAutoFillSelected")
this.$emit("autofilled", { inputId: this.inputId, autofilled: true});
}
else if(e.animationName == "onAutoFillCancel")
{
//console.log("onAutoFillCancel")
this.$emit("autofilled", { inputId: this.inputId, autofilled: false});
}
},
async imageChanged(e) { async imageChanged(e) {
let file = e.target.files[0]; let file = e.target.files[0];

View file

@ -12,8 +12,7 @@
aria-haspopup="" aria-haspopup=""
hasIcon hasIcon
validationRules="street-address-required" validationRules="street-address-required"
@keydown.enter.prevent @keydown.enter.prevent />
/>
</div> </div>
</div> </div>
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
@ -26,8 +25,7 @@
customInputId="apartmentNumberOrBusinessName" customInputId="apartmentNumberOrBusinessName"
cmsWidgetName="ApartmentNumberOrBusinessNameQuestionWidget" cmsWidgetName="ApartmentNumberOrBusinessNameQuestionWidget"
v-model="addressModel.apartmentNumberOrBusinessName" v-model="addressModel.apartmentNumberOrBusinessName"
ref="apartmentNumberOrBusinessName" ref="apartmentNumberOrBusinessName" />
/>
</div> </div>
</div> </div>
</transition> </transition>
@ -39,8 +37,7 @@
cmsWidgetName="CityQuestionWidget" cmsWidgetName="CityQuestionWidget"
v-model="addressModel.city" v-model="addressModel.city"
ref="city" ref="city"
validationRules="city-required" validationRules="city-required" />
/>
</div> </div>
</div> </div>
</transition> </transition>
@ -53,8 +50,7 @@
v-model="addressModel.state" v-model="addressModel.state"
ref="state" ref="state"
:options="stateOptions" :options="stateOptions"
validationRules="state-required" validationRules="state-required" />
/>
</div> </div>
<div class="col"> <div class="col">
<textboxQuestion <textboxQuestion
@ -63,8 +59,7 @@
v-model="addressModel.zipCode" v-model="addressModel.zipCode"
ref="zipCode" ref="zipCode"
mask="#####" mask="#####"
validationRules="zip-code-required|zip-code-format" validationRules="zip-code-required|zip-code-format" />
/>
</div> </div>
</div> </div>
</transition> </transition>
@ -124,7 +119,6 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//autofilled: Boolean,
}, },
data() { data() {
return { return {
@ -228,13 +222,6 @@ export default {
this.initializeAutocomplete(); this.initializeAutocomplete();
}); });
}, },
setAutofilled(value) {
console.log(value)
if (value.autofilled) {
this.showAddressFields = true;
}
this.$emit("autofilled", value);
},
initializeAutocomplete() { initializeAutocomplete() {
// Initialize the Google Places Autocomplete // Initialize the Google Places Autocomplete
this.autocomplete = new window.google.maps.places.Autocomplete(this.addressField1, { this.autocomplete = new window.google.maps.places.Autocomplete(this.addressField1, {
@ -264,6 +251,11 @@ export default {
// Unfortunately this is the only place we can set the autocomplete attribute without the // Unfortunately this is the only place we can set the autocomplete attribute without the
// Google Places object resetting it to "off" which does nothing to prevent browser autofill // Google Places object resetting it to "off" which does nothing to prevent browser autofill
//this.addressField1.setAttribute("autocomplete", "do-not-autofill");
});
// When the user starts entering text into Street Address textbox disable autofill
this.addressField1.addEventListener("input", (e) => {
this.addressField1.setAttribute("autocomplete", "do-not-autofill"); this.addressField1.setAttribute("autocomplete", "do-not-autofill");
}); });
@ -411,6 +403,15 @@ export default {
if (!this.showAddressFields) { if (!this.showAddressFields) {
this.loadGooglePlacesAutocompleteScript(); this.loadGooglePlacesAutocompleteScript();
} }
const element = document.getElementsByClassName("address-questions")[0];
element.addEventListener("change", (e) => {
const inputs = element.querySelectorAll("input:-internal-autofill-selected");
this.showAddressFields = inputs.length > 0;
// if (this.showAddressFields) {
// this.unloadAutocomplete();
// }
});
}, },
unmounted() { unmounted() {
this.unloadAutocomplete(); this.unloadAutocomplete();
@ -448,10 +449,8 @@ export default {
); );
} }
}, },
deep: true,
}, },
autofilled(value) {
console.log(value)
}
}, },
components: { components: {
textboxQuestion, textboxQuestion,

View file

@ -5,7 +5,7 @@
ref="theForm" ref="theForm"
v-slot="{ meta }" v-slot="{ meta }"
autocomplete="off"> autocomplete="off">
<div class="container-fluid page-container-grouped-styles"> <div class="container-fluid page-container-grouped-styles" id="address-lookup">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6"> <div class="col-md-6">
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" /> <funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
@ -25,7 +25,6 @@
v-model="customerQuestions" v-model="customerQuestions"
:validationRules="EmailValidationRules" :validationRules="EmailValidationRules"
:isEmailOptional="IsEmailOptional" /> :isEmailOptional="IsEmailOptional" />
<alert <alert
ref="alertVinNotFound" ref="alertVinNotFound"
v-if="displayVinNotFoundAlert" v-if="displayVinNotFoundAlert"

View file

@ -1,4 +1,5 @@
<template> <template>
<div class="customer-questions">
<addressQuestions ref="addressQuestions" v-model="customerModel.addressQuestions" /> <addressQuestions ref="addressQuestions" v-model="customerModel.addressQuestions" />
<div class="row mb-4"> <div class="row mb-4">
<div class="col"> <div class="col">
@ -7,8 +8,7 @@
v-model="customerModel.firstName" v-model="customerModel.firstName"
ref="firstName" ref="firstName"
customInputId="firstName" customInputId="firstName"
validationRules="first-name-required" validationRules="first-name-required" />
@autofilled="setAutofilled"/>
</div> </div>
</div> </div>
<div class="row mb-4"> <div class="row mb-4">
@ -18,8 +18,7 @@
v-model="customerModel.lastName" v-model="customerModel.lastName"
ref="lastName" ref="lastName"
customInputId="lastName" customInputId="lastName"
validationRules="last-name-required" validationRules="last-name-required" />
@autofilled="setAutofilled"/>
</div> </div>
</div> </div>
<div class="row mt-4"> <div class="row mt-4">
@ -31,8 +30,7 @@
customInputId="emailAddress" customInputId="emailAddress"
:isRequired="!isEmailOptional" :isRequired="!isEmailOptional"
:validationRules="validationRules" :validationRules="validationRules"
:addOptionalText="isEmailOptional" :addOptionalText="isEmailOptional" />
:autofilled="autofilled" />
</div> </div>
</div> </div>
<div class="row mb-0"> <div class="row mb-0">
@ -40,6 +38,7 @@
<textBlock cmsWidgetName="QuoteEmailTextBlockWidget" typeStyle="caption" /> <textBlock cmsWidgetName="QuoteEmailTextBlockWidget" typeStyle="caption" />
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -86,25 +85,6 @@ export default {
validationRules: String, validationRules: String,
isEmailOptional: Boolean, isEmailOptional: Boolean,
}, },
data() {
return {
autofilled: false,
}
},
methods: {
setAutofilled(value) {
console.log(value)
if (value.autofilled === true) {
this.autofilled = true;
console.log("autofilled")
}
else {
this.autofilled = false;
console.log("not autofilled")
}
}
},
computed: { computed: {
customerModel: { customerModel: {
get: function () { get: function () {
@ -114,7 +94,7 @@ export default {
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);
}, },
}, },
autofilled(value) {} }, },
components: { components: {
addressQuestions, addressQuestions,
textboxQuestion, textboxQuestion,