Expand CMS data structure

This commit is contained in:
Chloe Herd 2023-07-25 12:27:19 -04:00
parent 9c417e1c1b
commit 843105a9ac
2 changed files with 15 additions and 1 deletions

View file

@ -13,6 +13,7 @@ export default {
name: "damage-review",
props: {
cmsWidgetName: String,
damageLocationsWidgetName: String,
damage: Object,
},
data() {
@ -22,6 +23,13 @@ export default {
editClicked() {
this.$emit("edit-clicked");
},
getLocationAnswer(damageLocation) {
if(!this.locationAnswers) {
return undefined;
}
return this.locationAnswers.find((answer) => answer.Name === damageLocation);
},
},
computed: {
displayContent() {
@ -36,12 +44,17 @@ export default {
);
},
windshieldCopy() {
const answerContent = this.getLocationAnswer(damageLocationsSelected.WINDSHIELD);
if (this.hasWindshieldDamage) {
return [this.getCmsContent("WindshieldDamageWidget", "Text")];
return [answerContent?.Text];
} else {
return [];
}
},
locationAnswers() {
return this.getCmsContent(this.damageLocationsWidgetName, "Answers");
},
},
components: {
reviewBlock,

View file

@ -48,6 +48,7 @@
<damageReview
cmsWidgetName="DamageReviewWidget"
damageLocationsWidgetName="DamageLocationsWidget"
:damage="damageInfo"
@edit-clicked="editDamage" />