From c46d527acbace9dac975e28064ff141cd0a3c78c Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Thu, 16 Feb 2023 16:31:48 -0500 Subject: [PATCH] All defaults selection logic is working --- .../glass-part-question.vue | 24 +++++++++---------- src/layouts/vehicle-parts/vehicle-parts.vue | 1 - 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue index da16f281..9b5fe8ed 100644 --- a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue +++ b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue @@ -179,14 +179,6 @@ export default { return tintSourceObject.src; }, - // Reset selections when tint changes for the same glass to ensure proper selection. - // Also checks if only a single part is present for the tint. - ResetTintAndPartSelections() { - this.selectedPartNumber = null; - this.AutoSelect(); - }, - - AutoSelect() { // Check if only a single part is present for the tint and set the v-model if it is. if (this.partsForSelectedTint?.length == 1) { @@ -205,14 +197,22 @@ export default { document.querySelector('input[value=' + this.selectedPartNumber + ']').checked = true; }); }, + // Loads the preselected values from the store. LoadPreselectedValues() { this.$nextTick(() => { - if (this.modelValue !== undefined) { - // Populate button-question model-value if parts data already exists in store - this.selectedTint = this.modelValue?.color; + // Populate button-question model-value if parts data already exists in store + if(this.modelValue) + { + this.selectedTint = this.modelValue.color; } - }); + else{ + // If one item in list, select it + if (this.tintSelectionOptions?.length == 1) { + this.selectedTint = this.tintSelectionOptions[0].value; + } + } + }); }, }, watch: { diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index b9b88916..7d8f4e25 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -34,7 +34,6 @@ cmsWidgetName="SiteFooterWidget" ref="siteFooter" :isForwardActionDisabled="isForwardActionDisabled" - @tempButtonClicked="() => handleTempButtonClicked(this)" @backClicked="navigateBack" @ForwardClicked="forwardButtonAction" />