Merge pull request #423 from Safelite/feature/CSR-543

CSR-543 Allow for number validation in textbox-questions for initialV…
This commit is contained in:
katieoh-safelite 2022-05-11 13:36:18 -04:00 committed by GitHub
commit 284aea5a9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 7 deletions

View file

@ -51,13 +51,26 @@ export default {
default: '', default: '',
}, },
validationRules: String, validationRules: String,
cmsWidgetName: String, cmsWidgetName: String
}, },
setup(props) { setup(props) {
const propsClone = Object.assign({}, props);
const modelValue = propsClone.modelValue;
let initialValue;
switch (typeof modelValue) {
case "number":
initialValue = modelValue;
break;
default:
initialValue = (modelValue && modelValue.length > 0) ? modelValue : "";
break;
}
const fieldOptions = { const fieldOptions = {
type: "text", type: "text",
value: props.modelValue, value: modelValue,
initialValue: (props.modelValue && props.modelValue.length > 0) ? props.modelValue : "", initialValue: initialValue
}; };
const { const {

View file

@ -26,7 +26,6 @@ export function getDamageString() {
export function getIsWindshieldOnly () { export function getIsWindshieldOnly () {
const damageLocations = store.getters.damage.glassToReplace; const damageLocations = store.getters.damage.glassToReplace;
const returnString = damageLocations.length === 1 && damageLocations[0]?.location === "Windshield" ? "windshield" : "glass"; const returnString = damageLocations.length === 1 && damageLocations[0]?.location === "Windshield" ? "windshield" : "glass";
console.log(damageLocations);
return returnString; return returnString;
} }

View file

@ -262,13 +262,13 @@ export default {
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
}, },
getEmailFromStore(){ getEmailFromStore(){
return store.getters.order.customer.emailAddress return store.getters.order.customer.emailAddress;
}, },
getVinFromStore(){ getVinFromStore(){
return store.getters.vehicle.vin return store.getters.vehicle.vin;
}, },
getZipFromStore(){ getZipFromStore(){
return store.getters.vehicle.registration.zipCode return store.getters.order.serviceLocation.zipCode;
}, },
attachCustomEvents() { attachCustomEvents() {
this.prependActionToMethod(this, this.forwardButtonAction, () => { this.prependActionToMethod(this, this.forwardButtonAction, () => {