conditionally show endorsement questions

This commit is contained in:
Katie Kroell 2023-10-12 11:58:01 -04:00
parent 33420c6077
commit 8fbb991989

View file

@ -16,6 +16,7 @@
cmsWidgetName="SiteSubHeaderWidget"
class="mt-5" />
<buttonQuestion
v-if="educatorEndorsement"
ref="schoolPropertyQuestion"
v-model="schoolPropertyAnswer"
class="radioQuestion windshield-chip-count-question mb-4"
@ -29,6 +30,7 @@
:validationRules="rules.selectionRequired">
</buttonQuestion>
<buttonQuestion
v-if="parkingGuardEndorsement"
ref="parkingLotQuestion"
v-model="parkingLotAnswer"
class="radioQuestion windshield-chip-count-question"
@ -117,6 +119,12 @@ export default {
},
parkingLotAnswersFromCms() {
return this.getCmsContent('ParkingLotQuestion', 'Answers');
},
educatorEndorsement() {
return useMainStore().order.policy.endorsements.includes('Educator');
},
parkingGuardEndorsement() {
return useMainStore().order.policy.endorsements.includes('Parking Guard');
}
},
methods:
@ -126,18 +134,24 @@ export default {
},
async forwardButtonAction() {
// TO DO: remove hard coding and update data format once service returns endorsement questions
this.questionAnswersArray.push(
if (this.educatorEndorsement) {
this.questionAnswersArray.push(
{
questionNum: 1,
endorsement: 'Educator',
questionText: this.schoolPropertyQuestionText,
selectedAnswer: this.schoolPropertyAnswer
},
});
};
if (this.parkingGuardEndorsement) {
this.questionAnswersArray.push(
{
questionNum: 2,
endorsement: 'Parking Guard',
questionText: this.parkingLotQuestionText,
selectedAnswer: this.parkingLotAnswer
}
);
});
};
// save answers to store as order.policy.endorsementQuestionAnswers
useMainStore().saveEndorsementQuestionAnswers(this.questionAnswersArray);