Skip to content

Commit

Permalink
Merge pull request #330 from bcgov/ofmcc-5285-non-profit-questions
Browse files Browse the repository at this point in the history
Ofmcc 5285 non profit questions
  • Loading branch information
jenbeckett authored Aug 23, 2024
2 parents 652365a + d99a4cb commit cc2a118
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 22 deletions.
5 changes: 3 additions & 2 deletions backend/src/components/organizations.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
'use strict'
const { getOperation, patchOperationWithObjectId } = require('./utils')
const { getMappingString } = require('../util/common')
const { MappableObjectForFront, MappableObjectForBack } = require('../util/mapping/MappableObject')
const { OrganizationMappings, FacilityMappings, UserProfileMappings } = require('../util/mapping/Mappings')
const log = require('./logger')
const HttpStatus = require('http-status-codes')

async function getOrganization(req, res) {
try {
const operation = `accounts(${req.params.organizationId})?$select=accountid,accountnumber,name,emailaddress1,ofm_business_type,telephone1,telephone2,address1_line1,address1_line2,address1_city,address1_postalcode,address1_stateorprovince,ofm_is_mailing_address_different,address2_line1,address2_line2,address2_city,address2_postalcode,address2_stateorprovince,ofm_provider_type,ofm_ownership,statecode,statuscode,ofm_inclusion_policy,ofm_good_standing_status,ofm_doing_business_as`
const orgMappingString = getMappingString(OrganizationMappings)
const operation = `accounts(${req.params.organizationId})?$select=${orgMappingString}`
const response = await getOperation(operation)
return res.status(HttpStatus.OK).json(new MappableObjectForFront(response, OrganizationMappings).toJSON())
} catch (e) {
Expand All @@ -31,7 +33,6 @@ async function getOrganizationFacilities(req, res) {

async function updateOrganization(req, res) {
const organization = new MappableObjectForBack(req.body, OrganizationMappings).toJSON()
delete organization['[email protected]']
try {
const response = await patchOperationWithObjectId('accounts', req.params.organizationId, organization)
return res.status(HttpStatus.OK).json(new MappableObjectForFront(response, OrganizationMappings))
Expand Down
7 changes: 5 additions & 2 deletions backend/src/util/mapping/Mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ const OrganizationMappings = [
{ back: 'name', front: 'name' },
{ back: 'emailaddress1', front: 'email' },
{ back: 'ofm_business_type', front: 'businessTypeCode' },
{ back: '[email protected]', front: 'businessType' },
{ back: 'ofm_doing_business_as', front: 'doingBusinessAsName' },
{ back: 'telephone1', front: 'phoneLandline' },
{ back: 'telephone2', front: 'phoneCell' },
Expand All @@ -211,7 +210,11 @@ const OrganizationMappings = [
{ back: 'ofm_ownership', front: 'ownership' },
{ back: 'ofm_inclusion_policy', front: 'hasInclusionPolicy' },
{ back: 'ofm_good_standing_status', front: 'goodStandingStatusCode' },
{ back: 'ofm_good_standing_status@OData.Community.Display.V1.FormattedValue', front: 'goodStandingStatus' },
{ back: 'ofm_date_of_incorporation', front: 'dateOfIncorporation' },
{ back: 'ofm_open_membership', front: 'openMembership' },
{ back: 'ofm_board_members_elected_unpaid', front: 'boardMembersElected' },
{ back: 'ofm_board_members_selected_membership', front: 'boardMembersSelectedMembership' },
{ back: 'ofm_board_members_residents_of_bc', front: 'boardMembersResidentsOfBC' },
]

const FacilityMappings = [
Expand Down
174 changes: 174 additions & 0 deletions frontend/src/components/organizations/NotForProfitQuestions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<template>
<v-card class="my-4 pa-4 w-100" variant="outlined">
<v-container fluid class="pa-0">
<AppLabel>Not for Profit Information</AppLabel>
<v-card variant="outlined" class="soft-outline px-2 py-6 my-4">
<AppLabel>Date of Incorporation</AppLabel>
<AppDateInput id="date-to" v-model="model.dateOfIncorporation" :rules="[...rules.required, rules.MMDDYYYY]" :max="todayDate" label="Select The Date" class="mt-6 mx-6" />
</v-card>
<v-card v-if="isReferenceLetterRequired" variant="outlined" class="soft-outline px-2 py-6 my-4 w-100">
<v-row no-gutters>
<AppLabel class="mr-4">Upload Documents</AppLabel>
<v-tooltip
content-class="tooltip"
text="A letter from a community representative or agency that has knowledge about the sector and can demonstrate how the society provides services to support the local community."
max-width="300px">
<template #activator="{ props }">
<v-icon size="large" v-bind="props">mdi-information-slab-circle-outline</v-icon>
</template>
</v-tooltip>
</v-row>
<v-card variant="outlined" class="soft-outline px-2 py-6 my-4 w-100">
<AppDocumentUpload
v-model="model.documentsToUpload"
:uploaded-documents="model.uploadedDocuments"
:document-type="DOCUMENT_TYPES.COMMUNITY_LETTER"
:document-label="DOCUMENT_LABELS.COMMUNITY_LETTER"
entity-name="accounts"
:loading="loading"
:rules="[...rules.required]"
@delete-uploaded-document="deleteUploadedDocument"></AppDocumentUpload>
<div v-if="!areDocumentsComplete">
<AppMissingInfoError>
{{ APPLICATION_ERROR_MESSAGES.DOCUMENT_UPLOAD_COMMUNITY_LETTER }}
</AppMissingInfoError>
</div>
</v-card>
</v-card>

<v-card variant="outlined" class="soft-outline px-2 py-6 my-4 w-100">
<AppLabel>Does your facility's not-for-profit have an open membership?</AppLabel>
<v-radio-group v-model="model.openMembership" :readonly="false" :rules="[...rules.required]">
<v-row no-gutters>
<v-col cols="12" sm="2" lg="1">
<v-radio label="Yes" :value="1"></v-radio>
</v-col>
<v-col cols="12" sm="2" lg="1">
<v-radio label="No" :value="0"></v-radio>
</v-col>
</v-row>
</v-radio-group>
</v-card>

<v-card variant="outlined" class="soft-outline px-2 py-6 my-4 w-100">
<AppLabel>Does your facility's not-for-profit have elected, unpaid board members?</AppLabel>
<v-radio-group v-model="model.boardMembersElected" :readonly="false" :rules="[...rules.required]">
<v-row no-gutters>
<v-col cols="12" sm="2" lg="1">
<v-radio label="Yes" :value="1"></v-radio>
</v-col>
<v-col cols="12" sm="2" lg="1">
<v-radio label="No" :value="0"></v-radio>
</v-col>
</v-row>
</v-radio-group>
</v-card>

<v-card variant="outlined" class="soft-outline px-2 py-6 my-4 w-100">
<AppLabel>Does your facility's not-for-profit have board members selected from the entire membership?</AppLabel>
<v-radio-group v-model="model.boardMembersSelectedMembership" :readonly="false" :rules="[...rules.required]">
<v-row no-gutters>
<v-col cols="12" sm="2" lg="1">
<v-radio label="Yes" :value="1"></v-radio>
</v-col>
<v-col cols="12" sm="2" lg="1">
<v-radio label="No" :value="0"></v-radio>
</v-col>
</v-row>
</v-radio-group>
</v-card>

<v-card variant="outlined" class="soft-outline px-2 py-6 my-4 w-100">
<AppLabel>Are the majority of the elected board members full time BC residents?</AppLabel>
<v-radio-group v-model="model.boardMembersResidentsOfBC" :readonly="false" :rules="[...rules.required]">
<v-row no-gutters>
<v-col cols="12" sm="2" lg="1">
<v-radio label="Yes" :value="1"></v-radio>
</v-col>
<v-col cols="12" sm="2" lg="1">
<v-radio label="No" :value="0"></v-radio>
</v-col>
</v-row>
</v-radio-group>
</v-card>
</v-container>
</v-card>
</template>

<script>
import AppLabel from '@/components/ui/AppLabel.vue'
import AppDateInput from '@/components/ui/AppDateInput.vue'
import AppMissingInfoError from '@/components/ui/AppMissingInfoError.vue'
import alertMixin from '@/mixins/alertMixin'
import rules from '@/utils/rules'
import AppDocumentUpload from '@/components/ui/AppDocumentUpload.vue'
import moment from 'moment'
import { DOCUMENT_TYPES, DOCUMENT_LABELS, APPLICATION_ERROR_MESSAGES } from '@/utils/constants'
import { isEmpty, cloneDeep } from 'lodash'
export default {
components: { AppLabel, AppDateInput, AppDocumentUpload, AppMissingInfoError },
mixins: [alertMixin],
props: {
organization: {
type: Object,
required: true,
default: () => {
return {}
},
},
loading: {
type: Boolean,
default: false,
},
},
emits: ['update', 'deleteDocument', 'documentsComplete'],
data() {
return {
choice: undefined,
selectedDate: undefined,
model: undefined,
todayDate: new Date().toISOString().slice(0, 10),
}
},
computed: {
isReferenceLetterRequired() {
const pastDate = moment().subtract(4, 'years').startOf('day')
const modelDate = moment(this.model?.dateOfIncorporation).startOf('day')
return pastDate < modelDate
},
areDocumentsComplete() {
if (this.isReferenceLetterRequired) {
return !isEmpty(this.model.documentsToUpload) || !isEmpty(this.model.uploadedDocuments)
}
return true
},
},
watch: {
model: {
handler(value) {
this.$emit('update', value)
this.$emit('documentsComplete', this.areDocumentsComplete)
},
deep: true,
},
},
async created() {
this.rules = rules
this.DOCUMENT_TYPES = DOCUMENT_TYPES
this.DOCUMENT_LABELS = DOCUMENT_LABELS
this.APPLICATION_ERROR_MESSAGES = APPLICATION_ERROR_MESSAGES
this.model = cloneDeep(this.organization)
},
methods: {
deleteUploadedDocument(documentId) {
const foundDoc = this.model.uploadedDocuments.findIndex((el) => el.documentId === documentId)
if (foundDoc > -1) {
this.model.uploadedDocuments.splice(foundDoc, 1)
this.$emit('update', this.model)
this.$emit('deleteDocument', documentId)
}
},
},
}
</script>
18 changes: 7 additions & 11 deletions frontend/src/components/organizations/OrganizationInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<v-container fluid class="pa-0">
<v-row no-gutters class="mb-4">
<v-col cols="12" md="6" lg="6">
<v-card variant="outlined" class="card-outline fill-height">
<v-card variant="outlined" class="soft-outline fill-height">
<v-row no-gutters>
<v-col cols="12" sm="3" md="3" lg="3" class="ma-2">
<AppLabel>Organization legal name:</AppLabel>
Expand Down Expand Up @@ -48,7 +48,7 @@
</v-card>
</v-col>
<v-col cols="12" md="6" lg="6" class="mt-3 mt-md-0 pl-md-3">
<v-card variant="outlined" class="card-outline fill-height">
<v-card variant="outlined" class="soft-outline fill-height">
<v-row no-gutters>
<v-col cols="12" sm="3" md="3" lg="3" class="ma-2">
<AppLabel>Mailing Address:</AppLabel>
Expand Down Expand Up @@ -136,14 +136,14 @@
</v-col>
</v-row>
<v-skeleton-loader :loading="loadingInclusionPolicy" type="table-tbody">
<v-card variant="outlined" class="card-outline pa-2 w-100">
<v-card variant="outlined" class="soft-outline pa-2 w-100">
<div class="w-100">
<v-row no-gutters>
<v-col class="">
<AppLabel>Does your organization have an inclusion policy?</AppLabel>
</v-col>
<v-col class="mt-2">
<v-row v-if="editable && !editMode" justify="end">
<v-col v-if="editable && !editMode" class="mt-2">
<v-row justify="end">
<AppButton id="edit-button" variant="text" :disabled="loading" @click="toggleEditMode()">
<v-icon icon="fa:fa-regular fa-edit" class="transaction-icon"></v-icon>
</AppButton>
Expand All @@ -154,10 +154,10 @@
<v-col>
<v-radio-group v-model="organizationEdit.hasInclusionPolicy" :readonly="!editMode" hide-details>
<v-row no-gutters>
<v-col cols="12" sm="2" md="1">
<v-col cols="12" sm="2" lg="1">
<v-radio :class="{ 'no-hover': !editMode }" label="Yes" :value="true"></v-radio>
</v-col>
<v-col cols="12" sm="2" md="1">
<v-col cols="12" sm="2" lg="1">
<v-radio :class="{ 'no-hover': !editMode }" label="No" :value="false"></v-radio>
</v-col>
</v-row>
Expand Down Expand Up @@ -308,10 +308,6 @@ export default {
</script>
<style scoped>
.card-outline {
border: 1px solid #dee2e6 !important;
}
.no-hover {
pointer-events: none;
}
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export const APPLICATION_ERROR_MESSAGES = Object.freeze({
LICENCE_INFO: 'Licence information required',
LICENCE_CONFIRMATION: 'Confirmation of licence information required',
DOCUMENT_UPLOAD: 'Document upload required',
DOCUMENT_UPLOAD_COMMUNITY_LETTER: 'Document upload required of your Community Support Letter required',
DOCUMENT_FINANCIAL_UPLOAD: 'Document upload for Income Statement and Balance Sheet required',
DOCUMENT_SUPPORTING_UPLOAD: 'Document upload of your Rent/Lease Agreement under Supporting Documents required',
DOCUMENT_LICENCE_UPLOAD: 'Document upload of your current licence required',
Expand Down Expand Up @@ -242,12 +243,14 @@ export const DOCUMENT_TYPES = Object.freeze({
INCOME_STATEMENT: 'Income Statement',
BALANCE_SHEET: 'Balance Sheet',
SUPPORTING_DOCS: 'Supporting Documents',
COMMUNITY_LETTER: 'Community Support Letter',
HEALTH_AUTHORITY_REPORT: 'HA Compliance Rpt',
})

export const DOCUMENT_LABELS = Object.freeze({
LICENCE: 'A copy of your current licence',
HEALTH_AUTHORITY_REPORT: 'A copy of your most recent Health Authority compliance report',
COMMUNITY_LETTER: 'Letter of Reference for Community Support',
})

export const YES_NO_CHOICE_CRM_MAPPING = Object.freeze({
Expand Down Expand Up @@ -306,3 +309,11 @@ export const DAYS_OF_WEEK = Object.freeze([
])

export const TIME_ZONE = 'America/Vancouver'

export const BUSINESS_TYPE_CODES = Object.freeze({
CORPORATION: 1,
NON_PROFIT_SOCIETY: 2,
PUBLIC_INSTITUTION: 3,
LOCAL_GOVERNMENT: 4,
SOLE_PROPRIETOR: 5,
})
2 changes: 1 addition & 1 deletion frontend/src/views/applications/ApplicationView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default {
},
disableNext() {
if (this.isSelectFacilityPage) {
return !this.isSelectFacilityComplete
return false
}
if (this.isReviewApplicationPage) {
return !this.isApplicationComplete
Expand Down
Loading

0 comments on commit cc2a118

Please sign in to comment.