-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from bcgov/develop
Develop
- Loading branch information
Showing
26 changed files
with
1,006 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 161 additions & 0 deletions
161
web/src/components/steps/affidavit/ElectronicFilingStatementAFF.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
<template> | ||
<page-base :disableNext="disableNextButton" v-on:onPrev="onPrev()" v-on:onNext="onNext()" > | ||
<survey v-bind:survey="survey"></survey> | ||
</page-base> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Vue, Prop} from 'vue-property-decorator'; | ||
import * as SurveyVue from "survey-vue"; | ||
import { namespace } from "vuex-class"; | ||
import "@/store/modules/application"; | ||
const applicationState = namespace("Application"); | ||
import * as surveyEnv from "@/components/survey/survey-glossary"; | ||
import surveyJson from "./forms/electronic-filing-statement-aff.json"; | ||
import PageBase from "../PageBase.vue"; | ||
import { stepInfoType, stepResultInfoType } from "@/types/Application"; | ||
import { stepsAndPagesNumberInfoType } from '@/types/Application/StepsAndPages'; | ||
@Component({ | ||
components:{ | ||
PageBase | ||
} | ||
}) | ||
export default class ElectronicFilingStatementAff extends Vue { | ||
@Prop({required: true}) | ||
step!: stepInfoType; | ||
@applicationState.State | ||
public stPgNo!: stepsAndPagesNumberInfoType; | ||
@applicationState.Action | ||
public UpdateStepResultData!: (newStepResultData: stepResultInfoType) => void | ||
@applicationState.Action | ||
public UpdateCommonStepResults!: (newCommonStepResults) => void | ||
survey = new SurveyVue.Model(surveyJson); | ||
currentStep =0; | ||
currentPage =0; | ||
disableNextButton = false; | ||
beforeCreate() { | ||
const Survey = SurveyVue; | ||
surveyEnv.setCss(Survey); | ||
} | ||
created() { | ||
this.disableNextButton = false; | ||
} | ||
mounted(){ | ||
this.initializeSurvey(); | ||
this.addSurveyListener(); | ||
this.reloadPageInformation(); | ||
} | ||
public initializeSurvey(){ | ||
this.survey = new SurveyVue.Model(surveyJson); | ||
this.survey.commentPrefix = "Comment"; | ||
this.survey.showQuestionNumbers = "off"; | ||
this.survey.showNavigationButtons = false; | ||
surveyEnv.setGlossaryMarkdown(this.survey); | ||
} | ||
public addSurveyListener(){ | ||
this.survey.onValueChanged.add((sender, options) => { | ||
if(options.name == "ApplicantName") { | ||
this.$store.commit("Application/setApplicantName", this.survey.data["ApplicantName"]); | ||
this.UpdateCommonStepResults({data:{'applicantName':this.survey.data["ApplicantName"]}}) | ||
} | ||
}) | ||
} | ||
public reloadPageInformation() { | ||
this.currentStep = this.$store.state.Application.currentStep; | ||
this.currentPage = this.$store.state.Application.steps[this.currentStep].currentPage; | ||
if (this.step.result?.electronicFilingStatementAffSurvey) { | ||
this.survey.data = this.step.result.electronicFilingStatementAffSurvey.data; | ||
Vue.filter('scrollToLocation')(this.$store.state.Application.scrollToLocationName); | ||
} else { | ||
this.survey.setValue('OtherPartyInfoEfsp',[]); | ||
this.survey.setValue('PartyInfoEfsp',[]); | ||
} | ||
Vue.filter('setSurveyProgress')(this.survey, this.currentStep, this.currentPage, 50, false); | ||
} | ||
public mergeRespondants(){ | ||
const respondentNames = []; | ||
if(this.$store.state.Application.steps[0].result && this.$store.state.Application.steps[0].result.respondents){ | ||
const respondents = this.$store.state.Application.steps[0].result.respondents | ||
respondentNames.push(...respondents) | ||
} | ||
if(this.survey.data?.Lawyer){ | ||
const applicantIsLawyer = this.survey.data.Lawyer == 'y'; | ||
if (applicantIsLawyer){ | ||
if(this.survey.data?.PartyInfoEfsp && this.survey.data?.PartyInfoEfsp.length>0){ | ||
const respondentNamesEfsp = this.survey.data.PartyInfoEfsp.map(party=>party.name) | ||
respondentNames.push(...respondentNamesEfsp) | ||
} | ||
} else { | ||
if(this.survey.data?.OtherPartyInfoEfsp && this.survey.data?.OtherPartyInfoEfsp.length>0){ | ||
const respondentNamesEfsp = this.survey.data.OtherPartyInfoEfsp.map(otherParty=>otherParty.name) | ||
respondentNames.push(...respondentNamesEfsp) | ||
} | ||
} | ||
} | ||
const fullNamesArray =[]; | ||
for(const name of respondentNames ){ | ||
fullNamesArray.push(Vue.filter('getFullName')(name)) | ||
} | ||
const uniqueArray = respondentNames.filter(function(item, index) { | ||
const fullName = Vue.filter('getFullName')(item) | ||
return fullNamesArray.indexOf(fullName) == index; | ||
}) | ||
this.UpdateCommonStepResults({data:{'respondents':uniqueArray}}) | ||
} | ||
public onPrev() { | ||
Vue.prototype.$UpdateGotoPrevStepPage() | ||
} | ||
public onNext() { | ||
if(!this.survey.isCurrentPageHasErrors) { | ||
Vue.prototype.$UpdateGotoNextStepPage() | ||
} | ||
} | ||
beforeDestroy() { | ||
this.mergeRespondants(); | ||
if(this.survey.data?.["ApplicantName"]) { | ||
this.$store.commit("Application/setApplicantName", this.survey.data["ApplicantName"]); | ||
this.UpdateCommonStepResults({data:{'applicantName':this.survey.data["ApplicantName"]}}) | ||
} | ||
Vue.filter('setSurveyProgress')(this.survey, this.currentStep, this.currentPage, 50, true); | ||
this.UpdateStepResultData({step:this.step, data: {electronicFilingStatementAffSurvey: Vue.filter('getSurveyResults')(this.survey, this.currentStep, this.currentPage)}}) | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.