Update vehicle.vue

This commit is contained in:
Sneha 2023-08-31 17:34:49 +05:30
parent 27fc4162b4
commit 0d5a8d1564

View file

@ -112,7 +112,7 @@ export default {
selectedMake: this.selectedMakefromStore(), selectedMake: this.selectedMakefromStore(),
selectedModel: this.selectedModelfromStore(), selectedModel: this.selectedModelfromStore(),
selectedStyle: this.selectedStylefromStore(), selectedStyle: this.selectedStylefromStore(),
carId: null, carId: this.getCarIdFromStore(),
category: null, category: null,
imageUrl: this.getImagefromStore(), imageUrl: this.getImagefromStore(),
imageVifNumber: null, imageVifNumber: null,
@ -121,7 +121,7 @@ export default {
makeOptions: [], makeOptions: [],
modelOptions: [], modelOptions: [],
styleOptions: [], styleOptions: [],
displayGeneric: this.displayGenericFromStore(), //displayGeneric: this.displayGenericFromStore(),
}; };
}, },
@ -280,6 +280,7 @@ export default {
}, },
async selectedStyle(style) { async selectedStyle(style) {
if (style) { if (style) {
this.imageUrl = "";
const result = await this.getVehicle( const result = await this.getVehicle(
this.selectedYear, this.selectedYear,
this.selectedMake, this.selectedMake,
@ -291,10 +292,10 @@ export default {
this.imageUrl = result?.data.imageUrl; this.imageUrl = result?.data.imageUrl;
this.imageVifNumber = result?.data.imageVifNumber; this.imageVifNumber = result?.data.imageVifNumber;
this.imageVifColor = result?.data.imageVifColor; this.imageVifColor = result?.data.imageVifColor;
if (this.imageUrl == null) this.displayGeneric = false; //if (this.imageUrl == null) this.displayGeneric = false;
} else { } else {
this.imageUrl = null; this.imageUrl = null;
this.displayGeneric = true; // this.displayGeneric = true;
} }
}, },
}, },
@ -303,6 +304,13 @@ export default {
if (this.imageUrl == null) return true; if (this.imageUrl == null) return true;
else return false; else return false;
}, },
displayGeneric() {
if (this.imageUrl !== null && this.imageUrl !== "") return false;
else if(!this.selectedStyle) return true;
else if (this.imageUrl == null && this.carId !== null)
return false;
else return true;
},
}, },
methods: { methods: {
getVehicle(year, make, model, style) { getVehicle(year, make, model, style) {
@ -313,15 +321,15 @@ export default {
style: style, style: style,
}); });
}, },
displayGenericFromStore() { // displayGenericFromStore() {
if (store.getters.vehicle.imageUrl !== null) return false; // if (store.getters.vehicle.imageUrl !== null) return false;
else if ( // else if (
store.getters.vehicle.imageUrl === null && // store.getters.vehicle.imageUrl === null &&
store.getters.vehicle.carId !== null // store.getters.vehicle.carId !== null
) // )
return false; // return false;
else return true; // else return true;
}, // },
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return true; return true;
}, },
@ -387,6 +395,9 @@ export default {
getImagefromStore() { getImagefromStore() {
return store.getters.vehicle.imageUrl; return store.getters.vehicle.imageUrl;
}, },
getCarIdFromStore() {
return store.getters.vehicle.carId;
},
}, },
components: { components: {