From ff6a45e6e420a311444f7b5a03f3b4acc3b34945 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 17:11:52 -0400 Subject: [PATCH 1/4] CSR-835 Update list-button-horizontal, getPartsOrQuestions call --- src/store/index.js | 2 +- .../list-button-horizontal/list-button-horizontal.vue | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 0a57a82a3..dd2a59683 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -717,7 +717,7 @@ export const actions = { endpoint: endpoints.GetPartsOrQuestions.url, payload: { carId: carId, - glass: glassArray, + glass: glassArray ?? [], zip: zipCode, vin: vin }, diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 7011835b9..84d9c715b 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -14,7 +14,6 @@ :name="groupName" :value="value" :aria-required="isRequired" - v-model="checkValue" :checked="checkValue" @change="handleInputChange()" /> @@ -91,7 +90,7 @@ export default { if (Array.isArray(this.selectedValues)) { this.checkValue = this.isMultiSelect ? this.selectedValues.includes(this.value) - : this.selectedValues[0]; + : this.selectedValues[0] == this.value; } }, methods: { From 4c2fbba29eb6fe79803565f9d830ffb9f51fb026 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 19:00:20 -0400 Subject: [PATCH 2/4] CSR-385 Fix list-button-horizontal --- .../list-button-horizontal/list-button-horizontal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 84d9c715b..94bd59534 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -12,8 +12,8 @@ :type="isMultiSelect ? 'checkbox' : 'radio'" :id="buttonID" :name="groupName" - :value="value" :aria-required="isRequired" + v-model="checkValue" :checked="checkValue" @change="handleInputChange()" /> From d8fa80bbe1de272768692a5329c1c90198d5c0f1 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 19:08:26 -0400 Subject: [PATCH 3/4] CSR-835 Fix broken test --- .../list-button-horizontal/list-button-horizontal.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js b/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js index 5c288f660..08aaad712 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js @@ -211,11 +211,12 @@ describe("list-button-horizontal.vue", () => { isWide: false, modelValue: ["List Card Checkbox"], isMultiSelect: false, + value: "Car-Front", selectedValues: ["Car-Front"] }, }); // Assert - expect(wrapper.componentVM.checkValue).toEqual("Car-Front"); + expect(wrapper.vm.checkValue).toEqual(true); }); it("Should run handleCheckChange if selectingInitiatesLoad is false and handleInputChange is triggered", async () => { From 9d6b829cb174f08d6c8c62ad147404c2001a8d7e Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Wed, 14 Sep 2022 08:04:21 -0400 Subject: [PATCH 4/4] trying to fix repair-chips --- src/common-components/button-question/button-question.vue | 7 ++++++- .../windshield-chip-count-question.vue | 3 ++- src/store/index.js | 8 +++++++- .../list-button-horizontal/list-button-horizontal.vue | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index 6a235ef8a..2f7d3e0a1 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -173,11 +173,16 @@ export default { if(this.selectingInitiatesLoad) { this.selectedValues = val.value; } else { - if(Array.isArray(this.selectedValues)) { + if(this.isMultiSelect) { const newSelectedValues = this.selectedValues; val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1); this.selectedValues = newSelectedValues; } + else if (Array.isArray(this.selectedValues)) { + this.selectedValues[0] = val.value; + const temp = this.selectedValues; + this.selectedValues = temp; + } else { this.selectedValues = val.value; } diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue index 25d273eca..31a681857 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue @@ -47,7 +47,8 @@ export default ({ return this.modelValue; }, set: function(newValue) { - this.$emit("update:modelValue", newValue); + const numberValue = Number(newValue); + this.$emit("update:modelValue", numberValue); } }, }, diff --git a/src/store/index.js b/src/store/index.js index dd2a59683..95dd63ef7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -942,8 +942,14 @@ export const actions = { .slice() .sort() .every((obj, index) => obj.glassLocation === selectedGlassPassedInSorted[index].glassLocation && obj.glassName === selectedGlassPassedInSorted[index].glassName); + const isWindshieldRepairTheSame = isWindshieldRepair === context.state.order.damage.isRepair; + const isChipCountTheSame = Array.isArray(selectedWindshieldChipCount) //TODO: fix the underlying components so this is never an array + ? selectedWindshieldChipCount[0] === context.state.order.damage.numberOfChips + : selectedWindshieldChipCount === context.state.order.damage.numberOfChips; - if (!isGlassToReplaceTheSame) { + const isDamageChanging = !isGlassToReplaceTheSame || !isWindshieldRepairTheSame || (isWindshieldRepair && !isChipCountTheSame); + + if (isDamageChanging) { //Reset dependent state when changing context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 94bd59534..c037cb3b7 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -122,7 +122,7 @@ export default { handleCheckChange() { const emitEvent = { checkValue: this.checkValue, // only read on checkboxes, on handleCheckedChanged on button-question - value: this.value.toString(), + value: this.value, buttonId: this.buttonID && this.buttonID.toString(), };