-
Notifications
You must be signed in to change notification settings - Fork 0
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 #330 from bcgov/ofmcc-5285-non-profit-questions
Ofmcc 5285 non profit questions
- Loading branch information
Showing
7 changed files
with
301 additions
and
22 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
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) { | ||
|
@@ -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)) | ||
|
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 |
---|---|---|
|
@@ -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' }, | ||
|
@@ -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 = [ | ||
|
174 changes: 174 additions & 0 deletions
174
frontend/src/components/organizations/NotForProfitQuestions.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,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> |
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
Oops, something went wrong.