diff --git a/src/common-components/input-button-wrapper/input-button-wrapper.vue b/src/common-components/input-button-wrapper/input-button-wrapper.vue index e9368df30..356126e3c 100644 --- a/src/common-components/input-button-wrapper/input-button-wrapper.vue +++ b/src/common-components/input-button-wrapper/input-button-wrapper.vue @@ -205,6 +205,7 @@ export default { this.valueToEmit = newValue; } else { + console.log("not multi") this.valueToEmit = this.value; } @@ -237,10 +238,11 @@ export default { }, computed: { isChecked() { - if (this.isMultiSelect && this.modelValue instanceof Array) { + if (this.isMultiSelect || this.modelValue instanceof Array) { return this.modelValue.includes(this.value); } - return this.modelValue === this.value; + + return this.modelValue == this.value; }, inputType() { return this.isMultiSelect ? "checkbox" : "radio"; diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 432d71958..881b2fa45 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -17,7 +17,7 @@ alertClass="alert-warning" :isDismissible="false" /> - selectedDamageLocations: {{selectedDamageLocations}}
+ selectedWindshieldOptions: {{selectedWindshieldOptions}}
+ WCCQ selectedValue: {{selectedValue}} - WO selectedWindshieldReplaceOptionsValues: {{selectedWindshieldReplaceOptionsValues}} --> -
+
{{ buttonLabel }} @@ -60,102 +60,108 @@ export default { default: "", }, validationRules: String, - selectedValues: [Array, String], + // selectedValues: [Array, String], hasError: Boolean, valueToLogType: String, }, data() { return { isLoaderDisplayed: false, - checkValue: Boolean, + // checkValue: Boolean, }; }, - created() { - if (Array.isArray(this.selectedValues)) { - this.checkValue = this.isMultiSelect - ? this.selectedValues.includes(this.value) - : this.selectedValues[0] == this.value; - } - else { - this.checkValue = this.selectedValues; - } - }, + // created() { + // if (Array.isArray(this.selectedValues)) { + // this.checkValue = this.isMultiSelect + // ? this.selectedValues.includes(this.value) + // : this.selectedValues[0] == this.value; + // } + // else { + // this.checkValue = this.selectedValues; + // } + // }, methods: { - isValueSelectedByArray(arr) { - return this.isMultiSelect - ? arr.includes(this.value) - : arr[0]; - }, + // isValueSelectedByArray(arr) { + // return this.isMultiSelect + // ? arr.includes(this.value) + // : arr[0]; + // }, displayLoader() { this.isLoaderDisplayed = true; }, - handleInputChange() { - if (!this.selectingInitiatesLoad) { - this.handleCheckChange(); - } - }, - handleKeyupArrow() { - if (this.isMultiSelect) { - return; // Prevent arrow keys from doing anything if element is a checkbox - } + handleAnswerChange(e) { + // TODO KO all the buttons have this function - if (!this.selectingInitiatesLoad) { - this.handleCheckChange(); - } + console.log(e) + this.$emit("change", e); }, - triggerButton() { - if (this.selectingInitiatesLoad) { - this.displayLoader(); - this.handleCheckChange(); - } + // handleInputChange() { + // if (!this.selectingInitiatesLoad) { + // this.handleCheckChange(); + // } + // }, + // handleKeyupArrow() { + // if (this.isMultiSelect) { + // return; // Prevent arrow keys from doing anything if element is a checkbox + // } - this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true, this.valueToLogType); - }, - handleCheckChange() { - const emitEvent = { - checkValue: this.checkValue, // only read on checkboxes, on handleCheckedChanged on button-question - value: this.value, - buttonId: this.buttonID && this.buttonID.toString(), - }; + // if (!this.selectingInitiatesLoad) { + // this.handleCheckChange(); + // } + // }, + // triggerButton() { + // if (this.selectingInitiatesLoad) { + // this.displayLoader(); + // this.handleCheckChange(); + // } - this.handleChange(this.value); - this.$emit("isCheckedChanged", emitEvent); - this.$emit("update:modelValue", emitEvent); - } + // this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true, this.valueToLogType); + // }, + // handleCheckChange() { + // const emitEvent = { + // checkValue: this.checkValue, // only read on checkboxes, on handleCheckedChanged on button-question + // value: this.value, + // buttonId: this.buttonID && this.buttonID.toString(), + // }; + + // this.handleChange(this.value); + // this.$emit("isCheckedChanged", emitEvent); + // this.$emit("update:modelValue", emitEvent); + // } }, components: { loader, inputButtonWrapper }, - setup(props) { - const inputType = props.isMultiSelect ? "checkbox" : "radio"; + // setup(props) { + // const inputType = props.isMultiSelect ? "checkbox" : "radio"; - const fieldOptions = { - type: inputType, - checkedValue: props.value, - potentialInitialValue: props.selectedValues, - }; + // const fieldOptions = { + // type: inputType, + // checkedValue: props.value, + // potentialInitialValue: props.selectedValues, + // }; - // Set initialValue for validation setup if pre-selected - // NOTE: props.selectedValues could be an array of strings, or an array of integers... - if (props.selectedValues && (props.selectedValues.includes(props.value) || props.selectedValues.includes(parseInt(props.value)))) { - fieldOptions['initialValue'] = fieldOptions.potentialInitialValue; - } + // // Set initialValue for validation setup if pre-selected + // // NOTE: props.selectedValues could be an array of strings, or an array of integers... + // if (props.selectedValues && (props.selectedValues.includes(props.value) || props.selectedValues.includes(parseInt(props.value)))) { + // fieldOptions['initialValue'] = fieldOptions.potentialInitialValue; + // } - const { - handleChange, - errors, - value - } = useField(toRef(props, "groupName"), toRef(props, "validationRules"), fieldOptions); + // const { + // handleChange, + // errors, + // value + // } = useField(toRef(props, "groupName"), toRef(props, "validationRules"), fieldOptions); - const validateValue = value; - return { - handleChange, - errors, - validateValue, - fieldOptions, // only need to expose this for unit test purposes - }; - }, + // const validateValue = value; + // return { + // handleChange, + // errors, + // validateValue, + // fieldOptions, // only need to expose this for unit test purposes + // }; + // }, }; diff --git a/src/ux-components/list-button/list-button.vue b/src/ux-components/list-button/list-button.vue index 10a86e1a7..cb663e0e3 100644 --- a/src/ux-components/list-button/list-button.vue +++ b/src/ux-components/list-button/list-button.vue @@ -69,10 +69,10 @@ import inputButtonWrapper from "@/common-components/input-button-wrapper/input-b export default { name: "listButton", props: { - // groupName: String, + groupName: String, // TODO KO these shared props should be moved somewhere buttonLabel: [Number, String], // buttonID: [Number, String], - // isRequired: Boolean, + isRequired: Boolean, textPosition: String, buttonLabelSubCopy: String, screenReaderOnlyText: String,