Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ofmcc 2105 check for inclusion policy #318

Merged
merged 8 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions frontend/src/components/supp-allowances/SupportNeedsSummary.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<template>
<v-card v-for="model in supportModels" :key="model.supplementaryApplicationId ? model.supplementaryApplicationId : model.id" fluid class="pb-0 my-5">
<AppAlertBanner v-if="model.isNextTerm" type="info">This Allowance application is for next year</AppAlertBanner>
<AppAlertBanner v-if="!hasInclusionPolicy" type="warning">
You must have an inclusion policy to apply for Support Needs Allowance. Your organization account manager can update inclusion policy details in
<router-link :to="{ name: 'manage-organization' }">Account Management.</router-link>
</AppAlertBanner>
<div class="px-5">
<div class="mt-2">
<h4 class="text-decoration-underline">Funding Selected</h4>
Expand Down Expand Up @@ -41,11 +45,19 @@ export default {
},
required: true,
},
hasInclusionPolicy: {
type: Boolean,
required: true,
default: () => {
return false
},
},
},
created() {
this.SUPPORT_CHECKBOX_LABELS = SUPPORT_CHECKBOX_LABELS
this.APPLICATION_ERROR_MESSAGES = APPLICATION_ERROR_MESSAGES
},

methods: {
selectedFunding(model) {
return this.SUPPORT_CHECKBOX_LABELS.filter((item) => model.supportFundingModel.includes(item.value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@
import AppLabel from '@/components/ui/AppLabel.vue'
import AppNavButtons from '@/components/ui/AppNavButtons.vue'
import { useAuthStore } from '@/stores/auth'
import { mapState } from 'pinia'
import { mapState, mapActions } from 'pinia'
import ApplicationService from '@/services/applicationService'
import FundingAgreementService from '@/services/fundingAgreementService'
import alertMixin from '@/mixins/alertMixin'
import permissionsMixin from '@/mixins/permissionsMixin'
import { isEmpty } from 'lodash'
import rules from '@/utils/rules'
import { useOrgStore } from '@/stores/org'

export default {
name: 'SupplementaryAllowanceView',
Expand Down Expand Up @@ -104,7 +105,7 @@ export default {
return true
},
showCancel() {
return !isEmpty(this.application)
return !isEmpty(this.application) && this.hasPermission(this.PERMISSIONS.APPLY_FOR_FUNDING)
},
showSave() {
return !isEmpty(this.application) && this.hasPermission(this.PERMISSIONS.APPLY_FOR_FUNDING)
Expand Down Expand Up @@ -135,9 +136,12 @@ export default {

methods: {
isEmpty,
...mapActions(useOrgStore, ['getOrganizationInfo']),
async loadData() {
try {
this.loading = true
await this.getOrganizationInfo(this.userInfo?.organizationId)

// navigate from the Application Confirmation page (after the providers have just submitted their core funding application)
if (this.$route.params.applicationGuid) {
this.application = await ApplicationService.getApplication(this.$route.params.applicationGuid)
Expand Down
16 changes: 7 additions & 9 deletions frontend/src/views/supp-allowances/SupplementaryFormView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ import permissionsMixin from '@/mixins/permissionsMixin'
import { isEmpty, isEqual, cloneDeep } from 'lodash'
import { SUPPLEMENTARY_TYPES, VIRUS_SCAN_ERROR_MESSAGE, GOOD_STANDING_STATUS_CODES, SUPPLEMENTARY_APPLICATION_STATUS_CODES, NOT_IN_GOOD_STANDING_WARNING_MESSAGE } from '@/utils/constants'
import { uuid } from 'vue-uuid'
import { mapState, mapActions } from 'pinia'
import { useAuthStore } from '@/stores/auth'
import { mapState } from 'pinia'
import { useOrgStore } from '@/stores/org'
import { isApplicationLocked } from '@/utils/common'
import { SUPP_TERM_CODES } from '@/utils/constants/suppConstants'
Expand Down Expand Up @@ -211,7 +210,6 @@ export default {
}
},
computed: {
...mapState(useAuthStore, ['userInfo']),
...mapState(useOrgStore, ['currentOrg']),
allPanelIDs() {
return this.PANELS?.map((panel) => panel.id)
Expand All @@ -227,7 +225,9 @@ export default {
watch: {
back: {
async handler() {
await this.saveApplication()
if (this.hasPermission(this.PERMISSIONS.APPLY_FOR_FUNDING)) {
await this.saveApplication()
}
this.$router.push({ name: 'applications-history' })
},
},
Expand All @@ -243,7 +243,9 @@ export default {
},
next: {
async handler() {
await this.saveApplication()
if (this.hasPermission(this.PERMISSIONS.APPLY_FOR_FUNDING)) {
await this.saveApplication()
}
const applicationId = this.applicationId ? this.applicationId : this.$route.params.applicationGuid
this.$router.push({ name: 'supp-allowances-submit', params: { applicationGuid: applicationId } })
},
Expand Down Expand Up @@ -277,7 +279,6 @@ export default {
await this.loadData()
},
methods: {
...mapActions(useOrgStore, ['getOrganizationInfo']),
isEmpty,
togglePanel() {
this.panel = isEmpty(this.panel) ? this.allPanelIDs : []
Expand All @@ -286,9 +287,6 @@ export default {
try {
this.loading = true
this.$emit('process', true)
if (!this.currentOrg) {
await this.getOrganizationInfo(this.userInfo?.organizationId)
}
if (this.$route?.query?.nextTerm === 'true') {
this.setActiveTerm(true)
}
Expand Down
20 changes: 17 additions & 3 deletions frontend/src/views/supp-allowances/SupplementarySubmitView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
<IndigenousProgrammingSummary
v-if="panel.id === 'indigenous' && panel.supplementaryApplicationId"
:indigenousProgrammingModels="getModelsByType(SUPPLEMENTARY_TYPES.INDIGENOUS)"></IndigenousProgrammingSummary>
<SupportNeedsSummary v-if="panel.id === 'support-needs' && panel.supplementaryApplicationId" :supportModels="getModelsByType(SUPPLEMENTARY_TYPES.SUPPORT)"></SupportNeedsSummary>
<SupportNeedsSummary
v-if="panel.id === 'support-needs' && panel.supplementaryApplicationId"
:supportModels="getModelsByType(SUPPLEMENTARY_TYPES.SUPPORT)"
:hasInclusionPolicy="currentOrg.hasInclusionPolicy"></SupportNeedsSummary>
<TransportationSummary
v-if="panel.id === 'transportation' && panel.supplementaryApplicationId"
:draftTransportModels="getModelsByType(SUPPLEMENTARY_TYPES.TRANSPORT)"
Expand Down Expand Up @@ -94,6 +97,8 @@ import { SUPPLEMENTARY_TYPES, SUPPLEMENTARY_APPLICATION_STATUS_CODES } from '@/u
import { isEmpty } from 'lodash'
import { INDIG_CHECKBOX_LABELS, SUPPORT_CHECKBOX_LABELS, SUPP_TERM_CODES } from '@/utils/constants/suppConstants'
import { hasDuplicateVIN } from '@/utils/common'
import { mapState } from 'pinia'
import { useOrgStore } from '@/stores/org'

import rules from '@/utils/rules'

Expand Down Expand Up @@ -145,6 +150,7 @@ export default {
}
},
computed: {
...mapState(useOrgStore, ['currentOrg']),
allPanelIDs() {
return this.PANELS?.map((panel) => panel.id)
},
Expand Down Expand Up @@ -174,16 +180,23 @@ export default {
})
},
isApplicationComplete() {
return this.isIndigenousComplete && this.isSupportComplete && this.isTransportComplete
return this.isIndigenousComplete && this.isSupportComplete && this.isTransportComplete && this.hasSupportApplicationAndInclusionPolicy
},
readonly() {
return !this.isApplicationComplete || this.processing || this.loading || !this.hasPermission(this.PERMISSIONS.APPLY_FOR_FUNDING)
},
//this function disables submit if user has filled out a Support Needs App - but then after removes inclusion policy.
//The logic was moved out of isSupportComplete() so the red 'missing info' messaging won't appear when user is missing inclusion policy
hasSupportApplicationAndInclusionPolicy() {
return !this.getModel(SUPPLEMENTARY_TYPES.SUPPORT) || this.currentOrg.hasInclusionPolicy
},
},
watch: {
back: {
async handler() {
await this.saveApplication()
if (this.hasPermission(this.PERMISSIONS.APPLY_FOR_FUNDING)) {
await this.saveApplication()
}
this.$router.push({ name: 'supp-allowances-form', params: { applicationGuid: this.$route.params.applicationGuid } })
},
},
Expand Down Expand Up @@ -236,6 +249,7 @@ export default {
try {
this.loading = true
this.$emit('process', true)

//this page should specifiy to load only those applications in "draft" status - as there will be
//scenarios where some applications have been submitted, but the user will want to come back and fill in others.
this.models = await ApplicationService.getSupplementaryApplications(this.$route.params.applicationGuid)
Expand Down
Loading