CSR-343 Fix back button
This commit is contained in:
parent
8fe1dd8d7b
commit
a979bf2c85
3 changed files with 14 additions and 58 deletions
|
|
@ -14,7 +14,7 @@
|
|||
isRequired
|
||||
:groupName="`${glassLocation}-${glassName}`"
|
||||
@isCheckedChanged="ResetTintAndPartSelections"
|
||||
:validationRules="`${glassLocation}-${glassName}-tint-required`"
|
||||
:validationRules="tintValidationRules"
|
||||
>
|
||||
<div class="row my-2" aria-live="polite">
|
||||
<div class="col">
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
:loaderEnabled="false"
|
||||
isRequired
|
||||
:groupName="`${glassLocation}-${glassName}-${selectedTint}`"
|
||||
:validationRules="`${glassLocation}-${glassName}-part-required`"
|
||||
:validationRules="partValidationRules"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -67,13 +67,22 @@ export default {
|
|||
alreadyPopulatedPartsData: Object
|
||||
},
|
||||
mounted() {
|
||||
this.setAllValidationRules();
|
||||
this.LoadPreselectedValues();
|
||||
},
|
||||
components: {
|
||||
buttonQuestion,
|
||||
},
|
||||
computed: {
|
||||
tintValidationRules() {
|
||||
const validationRuleName = `${this.glassLocation}-${this.glassName}-tint-required`;
|
||||
defineRule(validationRuleName, required(errorMessages.OPTION_REQUIRED));
|
||||
return validationRuleName;
|
||||
},
|
||||
partValidationRules() {
|
||||
const validationRuleName = `${this.glassLocation}-${this.glassName}-part-required`;
|
||||
defineRule(validationRuleName, required(errorMessages.OPTION_REQUIRED));
|
||||
return validationRuleName;
|
||||
},
|
||||
colorQuestionText() {
|
||||
return getCustomTransformValue(
|
||||
this.glassColorQuestion,
|
||||
|
|
@ -107,10 +116,10 @@ export default {
|
|||
},
|
||||
|
||||
partsForSelectedTint() {
|
||||
return this.PartDataFromApi.partsOrQuestions.filter(dataForGlassLocationAndName =>
|
||||
return this.PartDataFromApi.partsOrQuestions?.filter(dataForGlassLocationAndName =>
|
||||
dataForGlassLocationAndName.glassName == this.glassName &&
|
||||
dataForGlassLocationAndName.glassLocation == this.glassLocation)[0]
|
||||
.parts.filter(part => part.color == this.selectedTint);
|
||||
.parts?.filter(part => part.color == this.selectedTint) ?? [];
|
||||
},
|
||||
|
||||
// Creates a map of the feature list data in the correct Name/Value
|
||||
|
|
@ -192,10 +201,6 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
setAllValidationRules() {
|
||||
defineRule(`${this.glassLocation}-${this.glassName}-tint-required`, required(errorMessages.OPTION_REQUIRED));
|
||||
defineRule(`${this.glassLocation}-${this.glassName}-part-required`, required(errorMessages.OPTION_REQUIRED));
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
selectedTint() {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ glassParts }}
|
||||
<div v-for="(item, i) in PartsOrQuestions" :key="i">
|
||||
<!-- Render horizontal lines if there is multi-glass (aka if i > 0) -->
|
||||
<hr v-if="i > 0" />
|
||||
|
|
@ -177,8 +176,6 @@ methods: {
|
|||
throw new Error("Could not match any parts to the selected parts");
|
||||
}
|
||||
|
||||
console.log(matchedParts)
|
||||
|
||||
// Save parts to the store.
|
||||
store.commit(storeMutations.UPDATE_GLASS_PARTS, matchedParts);
|
||||
|
||||
|
|
@ -194,48 +191,14 @@ methods: {
|
|||
},
|
||||
|
||||
LoadInitialPartsData() {
|
||||
console.log("Loading in vehicle-parts")
|
||||
this.alreadyPopulatedPartsData = this.$store.getters.lineItems.glassParts ?? [];
|
||||
|
||||
// MOCKKKK, real one is above
|
||||
// console.log(this.PartsFromApi.partsOrQuestions[0])
|
||||
// this.alreadyPopulatedPartsData = [this.PartsFromApi.partsOrQuestions[0].parts[0], this.PartsFromApi.partsOrQuestions[1].parts[0], this.PartsFromApi.partsOrQuestions[2].parts[0], this.PartsFromApi.partsOrQuestions[3].parts[0], this.PartsFromApi.partsOrQuestions[4].parts[0]];
|
||||
// console.log("MOCK alreadyPopulatedPartsData")
|
||||
// console.log(this.alreadyPopulatedPartsData)
|
||||
|
||||
const savedPartNumbers = this.alreadyPopulatedPartsData.map(part => part.partNumber)
|
||||
console.log(savedPartNumbers)
|
||||
|
||||
// const allPartsForGlass = this.PartsFromApi.partsOrQuestions.filter(glass => glass.glassLocation == this.glassLocation && glass.glassName == this.glassName)[0].parts;
|
||||
|
||||
this.PartsFromApi.partsOrQuestions.forEach(glass => {
|
||||
console.log("glass")
|
||||
console.log(glass)
|
||||
|
||||
const savedPart = glass.parts.filter(part => savedPartNumbers.includes(part.partNumber))[0];
|
||||
console.log('savedPart')
|
||||
console.log(savedPart)
|
||||
if (savedPart) {
|
||||
this.glassParts[`${glass.glassLocation}-${glass.glassName}`.replace(" ", "-")] = savedPart;
|
||||
}
|
||||
console.log('glassParts')
|
||||
console.log(this.glassParts)
|
||||
// this.glassParts[`${glass.glassLocation}-${glass.glassName}`] =
|
||||
// If the part is already populated, use the value from the store and populate the v-model.
|
||||
|
||||
// Object.keys(alreadyPopulatedPartsData).forEach(savedPart => {
|
||||
// const savedPartNumber = savedPart.partNumber;
|
||||
|
||||
// let test = partFromApi.parts.filter(part => part.partNumber == savedPartNumber);
|
||||
// console.log(test);
|
||||
// // g.parts.forEach((p) => {
|
||||
// // if (p.partNumber === partNumber) {
|
||||
// // this.glassParts[g.glassLocation + "-" + g.glassName] = {
|
||||
// // [g.glassLocation]: [partNumber],
|
||||
// // };
|
||||
// // }
|
||||
// // });
|
||||
// });
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -105,9 +105,6 @@ export default {
|
|||
: this.selectedValues[0];
|
||||
}
|
||||
else {
|
||||
console.log("HI")
|
||||
console.log(this.modelValue)
|
||||
console.log(this.value)
|
||||
this.checkValue = this.selectedValues == this.value || this.modelValue == this.value;
|
||||
}
|
||||
},
|
||||
|
|
@ -132,9 +129,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
handleInputChange() {
|
||||
console.log("HI 1")
|
||||
if(!this.selectingInitiatesLoad) {
|
||||
console.log("HI 2")
|
||||
this.handleCheckChange();
|
||||
}
|
||||
},
|
||||
|
|
@ -175,14 +170,7 @@ export default {
|
|||
}
|
||||
},
|
||||
selectedValues(newVal) {
|
||||
// this.handleChange(newVal == this.value);
|
||||
console.log("WATCH")
|
||||
console.log(newVal)
|
||||
console.log(typeof newVal)
|
||||
console.log(typeof newVal === "string")
|
||||
if (typeof newVal === "string") {
|
||||
console.log(this.value)
|
||||
// console.log(newVal == this.value)
|
||||
this.handleChange(this.value);
|
||||
this.checkValue = newVal == this.value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue