From 92b62768f1f0918df0670c485751a1d507923dcf Mon Sep 17 00:00:00 2001 From: Sneha Date: Tue, 26 Sep 2023 16:46:21 +0530 Subject: [PATCH 1/4] CSR-1652 --- src/layouts/vehicle/vehicle.vue | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index 97c66c3bf..b653588b6 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -264,8 +264,24 @@ export default { model ); this.styleOptions = result?.data; - if (this.styleOptions.length === 1) this.selectedStyle = this.styleOptions[0]; - else this.selectedStyle = null; + if (this.styleOptions.length === 1) { + const sameStyle = this.selectedStyle === this.styleOptions[0]; + this.selectedStyle = this.styleOptions[0]; + if (sameStyle) { + this.carId = null; + const result = await this.getVehicle( + this.selectedYear, + this.selectedMake, + this.selectedModel, + this.selectedStyle + ); + this.carId = result?.data.carId; + this.category = result?.data.category; + this.imageUrl = result?.data.imageUrl; + this.imageVifNumber = result?.data.imageVifNumber; + this.imageVifColor = result?.data.imageVifColor; + } + } else this.selectedStyle = null; } else { this.styleOptions = []; this.selectedStyle = null; From 7d365962d4485151e2674ee5abe51cb09168f3be Mon Sep 17 00:00:00 2001 From: Sneha Date: Tue, 26 Sep 2023 17:48:44 +0530 Subject: [PATCH 2/4] Refactor changes --- src/layouts/vehicle/vehicle.vue | 40 +++++++++++++-------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index b653588b6..4027c246a 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -268,18 +268,7 @@ export default { const sameStyle = this.selectedStyle === this.styleOptions[0]; this.selectedStyle = this.styleOptions[0]; if (sameStyle) { - this.carId = null; - const result = await this.getVehicle( - this.selectedYear, - this.selectedMake, - this.selectedModel, - this.selectedStyle - ); - this.carId = result?.data.carId; - this.category = result?.data.category; - this.imageUrl = result?.data.imageUrl; - this.imageVifNumber = result?.data.imageVifNumber; - this.imageVifColor = result?.data.imageVifColor; + this.getCarID(); } } else this.selectedStyle = null; } else { @@ -289,18 +278,7 @@ export default { }, async selectedStyle(style) { if (style) { - this.carId = null; - const result = await this.getVehicle( - this.selectedYear, - this.selectedMake, - this.selectedModel, - style - ); - this.carId = result?.data.carId; - this.category = result?.data.category; - this.imageUrl = result?.data.imageUrl; - this.imageVifNumber = result?.data.imageVifNumber; - this.imageVifColor = result?.data.imageVifColor; + this.getCarID(); } else { this.imageUrl = null; } @@ -334,6 +312,20 @@ export default { arePagePrerequisitesValid() { return true; }, + async getCarID(){ + this.carId = null; + const result = await this.getVehicle( + this.selectedYear, + this.selectedMake, + this.selectedModel, + this.selectedStyle + ); + this.carId = result?.data.carId; + this.category = result?.data.category; + this.imageUrl = result?.data.imageUrl; + this.imageVifNumber = result?.data.imageVifNumber; + this.imageVifColor = result?.data.imageVifColor; + }, async forwardButtonAction() { this.dispatchStoreAction( From 2fc7c57d40b37b4a97e35b980d57d2cc5d4c2391 Mon Sep 17 00:00:00 2001 From: Sneha Date: Tue, 26 Sep 2023 17:50:03 +0530 Subject: [PATCH 3/4] Update vehicle.vue --- src/layouts/vehicle/vehicle.vue | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index 4027c246a..fc2dfec25 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -278,7 +278,7 @@ export default { }, async selectedStyle(style) { if (style) { - this.getCarID(); + this.getCarID(); } else { this.imageUrl = null; } @@ -312,19 +312,19 @@ export default { arePagePrerequisitesValid() { return true; }, - async getCarID(){ + async getCarID() { this.carId = null; - const result = await this.getVehicle( - this.selectedYear, - this.selectedMake, - this.selectedModel, - this.selectedStyle - ); - this.carId = result?.data.carId; - this.category = result?.data.category; - this.imageUrl = result?.data.imageUrl; - this.imageVifNumber = result?.data.imageVifNumber; - this.imageVifColor = result?.data.imageVifColor; + const result = await this.getVehicle( + this.selectedYear, + this.selectedMake, + this.selectedModel, + this.selectedStyle + ); + this.carId = result?.data.carId; + this.category = result?.data.category; + this.imageUrl = result?.data.imageUrl; + this.imageVifNumber = result?.data.imageVifNumber; + this.imageVifColor = result?.data.imageVifColor; }, async forwardButtonAction() { From 948473edcf7fe058ee32f21061fc589ab45530b8 Mon Sep 17 00:00:00 2001 From: Sneha Date: Tue, 26 Sep 2023 19:14:24 +0530 Subject: [PATCH 4/4] Update vehicle.vue --- src/layouts/vehicle/vehicle.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index fc2dfec25..494027bb9 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -268,7 +268,7 @@ export default { const sameStyle = this.selectedStyle === this.styleOptions[0]; this.selectedStyle = this.styleOptions[0]; if (sameStyle) { - this.getCarID(); + this.getVehicleDetails(); } } else this.selectedStyle = null; } else { @@ -278,7 +278,7 @@ export default { }, async selectedStyle(style) { if (style) { - this.getCarID(); + this.getVehicleDetails(); } else { this.imageUrl = null; } @@ -312,7 +312,7 @@ export default { arePagePrerequisitesValid() { return true; }, - async getCarID() { + async getVehicleDetails() { this.carId = null; const result = await this.getVehicle( this.selectedYear,