From 00e62c42404c2288f70c124e061e307551023ed1 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 8 Mar 2022 15:07:47 -0500 Subject: [PATCH 01/18] CSR-319: update repair/replace validation logic --- .../windshield-options/windshield-options.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue index 1d483f269..792b1ed11 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue @@ -37,7 +37,11 @@ defineRule("windshield-chip-count-required", required(errorMessages.WINDSHIELD_C defineRule("windshield-replace-options-required", required(errorMessages.WINSHIELD_REPLACE_OPTIONS_REQUIRED)); defineRule("checkForRepairAndReplace", (value, [other]) => { - if (value.toString().toUpperCase().includes("REPAIR") && other.toString().toUpperCase().includes("WINDSHIELD") && other.length > 1) { + if (value.toString().toUpperCase().includes("REPAIR") && + other.toString().toUpperCase().includes("WINDSHIELD") && + Array.isArray(other) && + other.length > 1) + { return "checkForRepairAndReplace error" } return true; From a3c8998345c72c3a5a142565057301f0093846ea Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 8 Mar 2022 17:36:34 -0500 Subject: [PATCH 02/18] CSR-319: add new alert error if no windshield replace option is available --- .../windshield-options/windshield-options.vue | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue index 792b1ed11..c3a7aca68 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue @@ -1,12 +1,20 @@ From c19bb1cf7969ade99d069fb0dc85e69170fea8d2 Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 10 Mar 2022 15:42:17 -0500 Subject: [PATCH 13/18] Add classes inline, remove from global. --- src/layouts/vin-lookup/vin-lookup.vue | 2 +- src/styles/common-styles.scss | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 6b86ec4f5..aa179439a 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -9,7 +9,7 @@ @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }" - class="vehicle-damage-form" + class="d-flex flex-column h-100" > used for validation. Keeps footer stuck to the bottom. -.vehicle-damage-form { - display: flex; - flex-direction: column; - height: 100%; -} From 98e3b7026a9879bfd222948d3671070cec0a7575 Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 10 Mar 2022 15:56:32 -0500 Subject: [PATCH 14/18] Update route per Carl's comment. --- src/router/router-constants/routing-table.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 9333d7c6c..3bd937c41 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -59,7 +59,7 @@ const routingTable = [ }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + destinationFmgPageValue: fmgPageValues.REVEAL, }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, @@ -84,6 +84,19 @@ const routingTable = [ }, ], }, + { + fmgPageValue: fmgPageValues.REVEAL, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_PARTS, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + ], + }, ]; export { routingTable }; From 5370e1ce86b3a707b8354f918256f4e0767cab13 Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 10 Mar 2022 16:10:20 -0500 Subject: [PATCH 15/18] Update routing. --- src/router/router-constants/routing-table.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 3bd937c41..c9dc7ba4d 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -84,19 +84,6 @@ const routingTable = [ }, ], }, - { - fmgPageValue: fmgPageValues.REVEAL, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.SELECTED_PARTS, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, - }, - ], - }, ]; export { routingTable }; From 1d12c6a325e4d568609ee0802d8896e22320fa00 Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 10 Mar 2022 16:20:04 -0500 Subject: [PATCH 16/18] Update routing table. --- src/router/router-constants/routing-table.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index c9dc7ba4d..3bd937c41 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -84,6 +84,19 @@ const routingTable = [ }, ], }, + { + fmgPageValue: fmgPageValues.REVEAL, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_PARTS, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + ], + }, ]; export { routingTable }; From 79dca4d4bbdb7b1f7baef5aa1e60aee1b075439d Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 10 Mar 2022 16:37:04 -0500 Subject: [PATCH 17/18] CSR-319: add final special validation for preventSplitAndSingleTogether --- .../button-question/button-question.vue | 5 +- .../replace-options-question.vue | 2 + src/layouts/vehicle-damage/vehicle-damage.vue | 18 +++++++ .../windshield-options/windshield-options.vue | 53 ++++++++++++++++--- 4 files changed, 68 insertions(+), 10 deletions(-) diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index 80c02af69..b46d933c0 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -37,8 +37,8 @@ -
- +
+
@@ -133,6 +133,7 @@ export default { if(this.isMultiSelect && this.selectedValues) { // Add or remove item to array of data to emit const newSelectedValues = this.selectedValues; + if(Array.isArray(this.selectedValues)) { val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1); this.selectedValues = newSelectedValues; diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue index cdbb0c48d..fe43419e8 100644 --- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue +++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue @@ -10,6 +10,7 @@ buttonType="listCard" v-model="selectedValues" :validationRules="validationRules" + :suppressError="suppressError" /> @@ -35,6 +36,7 @@ export default ({ modelValue: Array, isMultiSelect: Boolean, validationRules: String, + suppressError: Boolean, }, methods: { initializeComponent(cmsContent, replaceOptions){ diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 0eb11fbf0..20c498198 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -19,6 +19,7 @@ ref="windshieldOptions" v-model="selectedWindshieldOptions" :hasRepairReplaceConflict="hasRepairReplaceConflict" + :hasSplitSingleConflict="hasSplitSingleConflict" :selectedDamageLocations="selectedDamageLocations" /> 1 && this.isWindshieldRepair; }, + hasSplitSingleConflict() { + if (!this.selectedWindshieldOptions.selectedWindshieldReplaceOptions) return false; + + return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield => + { + return selectedSingleWindshield.toUpperCase() === damageLocationsSelected.SINGLE.toUpperCase(); + }) && + (this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedDriverWindshield => + { + return selectedDriverWindshield.toUpperCase() === damageLocationsSelected.DRIVER.toUpperCase(); + }) || + this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedPassengerWindshield => + { + return selectedPassengerWindshield.toUpperCase() === damageLocationsSelected.PASSENGER.toUpperCase(); + }) + ); + }, }, components: { diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue index c1539e91a..21f4e6f33 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue @@ -2,14 +2,17 @@
+ isSplitWindshieldOption: {{isSplitWindshieldOption}} +
+ isWindshieldReplaceAvailable: {{isWindshieldReplaceAvailable}} +
@@ -53,17 +65,25 @@ defineRule("checkForRepairAndReplace", (value, [otherFieldValue]) => { Array.isArray(otherFieldValue) && otherFieldValue.length > 1) { - return "checkForRepairAndReplace error" + return false; } return true; }); - defineRule("repairOnly", (value) => { if (value.toString().toUpperCase() === damageLocationsSelected.REPAIR.toUpperCase()) { return true; } return false; }); +defineRule("preventSplitAndSingleTogether", (value) => { + if (value.toString().toUpperCase().includes(damageLocationsSelected.SINGLE.toUpperCase()) && + (value.toString().toUpperCase().includes(damageLocationsSelected.DRIVER.toUpperCase()) || + value.toString().toUpperCase().includes(damageLocationsSelected.PASSENGER.toUpperCase()))) + { + return false; + } + return true; +}); export default ({ name: "windshieldOptions", @@ -77,7 +97,8 @@ export default ({ props: { modelValue: Array, selectedDamageLocations: Array, - hasRepairReplaceConflict: Boolean + hasRepairReplaceConflict: Boolean, + hasSplitSingleConflict: Boolean, }, methods: { @@ -151,12 +172,28 @@ export default ({ isWindshieldReplaceAvailable() { return !(Array.isArray(this.windshieldAvailableReplacementOptions) && this.windshieldAvailableReplacementOptions.length < 1); }, - showNoReplaceAvailableError() { + isSplitWindshieldOption() { + const options = this.windshieldAvailableReplacementOptions.toString().toUpperCase(); + if (options.includes('DRIVER') && options.includes('PASSENGER')) { + return true; + } + return false; + }, + showNoReplacementAvailableError() { if (this.isReplaceOptionSelected && !this.isWindshieldReplaceAvailable) { return true; } return false; }, + windshieldDamageTypeQuestionValidationRules() { + // Note: the validation rules string is not dynamic (it cannot be changed once component has been created) + let validationRules = "windshield-damage-type-required|checkForRepairAndReplace:@DamageLocationQuestion"; + // if vehicle has no windshield replacement option + if (!this.isWindshieldReplaceAvailable) { + validationRules = validationRules.concat('|repairOnly'); + } + return validationRules; + } }, components: { windshieldDamageTypeQuestion, From c4707fd6af9f2a0e8b90d31abe51425e5bd25f2d Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 10 Mar 2022 16:42:24 -0500 Subject: [PATCH 18/18] CSR-319: clean up output on page --- .../vehicle-damage/windshield-options/windshield-options.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue index 21f4e6f33..30f8c15d7 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue @@ -7,9 +7,6 @@ v-model="selectedWindshieldDamageTypeValues" :validationRules="windshieldDamageTypeQuestionValidationRules" /> - isSplitWindshieldOption: {{isSplitWindshieldOption}} -
- isWindshieldReplaceAvailable: {{isWindshieldReplaceAvailable}}