Skip to content

Commit

Permalink
Merge pull request #289 from bcgov/ofmcc-5049-ccsea-union-questions
Browse files Browse the repository at this point in the history
Ofmcc 5049 ccsea union questions
  • Loading branch information
vietle-cgi authored Jul 17, 2024
2 parents 2efb4ac + 1e438bf commit 441f986
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 52 deletions.
2 changes: 2 additions & 0 deletions backend/src/util/mapping/Mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ const ApplicationMappings = [
{ back: 'ofm_application_review_complete', front: 'applicationReviewComplete' },
{ back: 'ofm_unionized', front: 'isUnionized' },
{ back: 'ofm_union_list', front: 'unions' },
{ back: 'ofm_union_description', front: 'unionDescription' },
{ back: 'ofm_union_cssea', front: 'cssea' },
{ back: 'ofm_fiscal_year_end', front: 'fiscalYearEndDate' },
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:to="{ name: APPLICATION_ROUTES.SERVICE_DELIVERY, hash: '#confirmation', params: { applicationGuid: $route.params.applicationGuid } }">
{{ APPLICATION_ERROR_MESSAGES.LICENCE_CONFIRMATION }}
</AppMissingInfoError>
<AppMissingInfoError v-else-if="!isServiceDeliveryComplete" :to="{ name: APPLICATION_ROUTES.SERVICE_DELIVERY, hash: '#top', params: { applicationGuid: $route.params.applicationGuid } }">
<AppMissingInfoError v-else-if="!isServiceDeliveryComplete" :to="{ name: APPLICATION_ROUTES.SERVICE_DELIVERY, params: { applicationGuid: $route.params.applicationGuid } }">
{{ !allCCOFMissingDetailComplete ? APPLICATION_ERROR_MESSAGES.LICENCE_INFO : APPLICATION_ERROR_MESSAGES.SPLIT_CLASSROOM_INFO }}
</AppMissingInfoError>
</template>
Expand Down
29 changes: 24 additions & 5 deletions frontend/src/components/applications/review/StaffingSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,47 @@
<AppLabel class="mr-2">Is your facility unionized?</AppLabel>
<div>{{ currentApplication?.isUnionized ? 'Yes' : 'No' }}</div>
</v-row>
<v-row v-if="currentApplication?.isUnionized" no-gutters>
<v-row v-if="currentApplication?.isUnionized" no-gutters class="mb-2">
<AppLabel class="mr-2">Which Union(s) do your staff belong to?</AppLabel>
<div>{{ unionsNames }}</div>
</v-row>
<v-row v-if="isOtherUnionSelected(currentApplication)" no-gutters class="mb-2">
<AppLabel class="mr-2">Please specify your other union(s):</AppLabel>
<div>{{ currentApplication?.unionDescription }}</div>
</v-row>
</div>
</v-card>
<v-card class="my-4 pa-4">
<AppMissingInfoError v-if="!readonly && !isCSSEASectionComplete(currentApplication)" :to="{ name: APPLICATION_ROUTES.STAFFING, params: { applicationGuid: $route.params.applicationGuid } }">
{{ APPLICATION_ERROR_MESSAGES.CSSEA }}
</AppMissingInfoError>
<div v-else>
<v-row no-gutters>
<AppLabel class="mr-2">Does your facility belong to CSSEA?</AppLabel>
<div>{{ currentApplication?.cssea ? 'Yes' : 'No' }}</div>
</v-row>
</div>
</v-card>
<v-card class="pa-4">
<div v-if="!readonly && !isEmployeeInformationComplete">
<AppMissingInfoError v-if="!isThereAtLeastOneEmployee(currentApplication)" :to="{ name: APPLICATION_ROUTES.STAFFING, params: { applicationGuid: $route.params.applicationGuid } }">
<AppMissingInfoError
v-if="!isThereAtLeastOneEmployee(currentApplication)"
:to="{ name: APPLICATION_ROUTES.STAFFING, hash: '#employee-section', params: { applicationGuid: $route.params.applicationGuid } }">
{{ APPLICATION_ERROR_MESSAGES.STAFFING }}
</AppMissingInfoError>
<AppMissingInfoError
v-if="!areAllEmployeeCertificatesEntered(currentApplication?.providerEmployees, currentApplication)"
:to="{ name: APPLICATION_ROUTES.STAFFING, params: { applicationGuid: $route.params.applicationGuid } }">
:to="{ name: APPLICATION_ROUTES.STAFFING, hash: '#employee-section', params: { applicationGuid: $route.params.applicationGuid } }">
{{ APPLICATION_ERROR_MESSAGES.MISMATCH_NUMBER_STAFF_CERTIFICATE }}
</AppMissingInfoError>
<AppMissingInfoError
v-if="!areAllCertificateInitialsUnique(currentApplication?.providerEmployees)"
:to="{ name: APPLICATION_ROUTES.STAFFING, params: { applicationGuid: $route.params.applicationGuid } }">
:to="{ name: APPLICATION_ROUTES.STAFFING, hash: '#employee-section', params: { applicationGuid: $route.params.applicationGuid } }">
{{ APPLICATION_ERROR_MESSAGES.DUPLICATE_CERTIFICATE_INITIALS }}
</AppMissingInfoError>
<AppMissingInfoError
v-if="!areAllCertificateNumbersUnique(currentApplication?.providerEmployees)"
:to="{ name: APPLICATION_ROUTES.STAFFING, params: { applicationGuid: $route.params.applicationGuid } }">
:to="{ name: APPLICATION_ROUTES.STAFFING, hash: '#employee-section', params: { applicationGuid: $route.params.applicationGuid } }">
{{ APPLICATION_ERROR_MESSAGES.DUPLICATE_CERTIFICATE_NUMBERS }}
</AppMissingInfoError>
</div>
Expand Down Expand Up @@ -208,6 +225,8 @@ export default {
methods: {
...mapActions(useApplicationsStore, [
'isUnionSectionComplete',
'isOtherUnionSelected',
'isCSSEASectionComplete',
'isThereAtLeastOneEmployee',
'areAllEmployeeCertificatesEntered',
'areAllCertificateInitialsUnique',
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/licences/LicenceDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,12 @@
</v-row>
</v-col>
</v-row>
<v-row no-gutters :class="editable ? 'mt-2' : 'mt-lg-6 mt-xl-0'">
<v-row no-gutters :class="editable ? 'mt-2' : 'mt-0'">
<div>
<AppLabel class="mr-1">Requires split classrooms</AppLabel>
<v-tooltip
content-class="tooltip"
max-width="300px"
text="A situation where children are divided into different rooms due to physical limitations of the building and child-to-staff ratio requirements. This can affect the staffing ratio compared to keeping the group together in one room."
top>
<template v-slot:activator="{ props }">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
</v-row>
</div>
<AppAlertBanner v-else type="warning">
You must have an inclusion policy to apply for Support Needs Funding. Your organization account manager can update inclusion policy details in
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>
</template>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { PERMISSIONS } from '@/utils/constants/permissions.js'
import BackendSessionExpiredView from '@/views/BackendSessionExpiredView.vue'
import DocumentsView from '@/views/DocumentsView.vue'
import ErrorView from '@/views/ErrorView.vue'
import HelpView from '@/views/HelpView.vue'
import HomeView from '@/views/HomeView.vue'
import ImpersonateView from '@/views/ImpersonateView.vue'
import LoginView from '@/views/LoginView.vue'
import LogoutView from '@/views/LogoutView.vue'
import MessagingView from '@/views/MessagingView.vue'
import MinistryLoginView from '@/views/MinistryLoginView.vue'
import HelpView from '@/views/HelpView.vue'
import SessionExpiredView from '@/views/SessionExpiredView.vue'
import UnauthorizedView from '@/views/UnauthorizedView.vue'
import AccountMgmtHomeView from '@/views/account-mgmt/AccountMgmtHomeView.vue'
Expand Down Expand Up @@ -45,7 +45,7 @@ import SupplementarySubmitView from '@/views/supp-allowances/SupplementarySubmit
const router = createRouter({
history: createWebHistory(),
base: import.meta.env.BASE_URL,
scrollBehavior: function (to, from, savedPosition) {
scrollBehavior(to, from, savedPosition) {
if (to.hash) {
return new Promise((resolve, reject) => {
setTimeout(() => {
Expand All @@ -56,7 +56,7 @@ const router = createRouter({
}, 700)
})
} else {
return { x: 0, y: 0 }
return { left: 0, top: 0 }
}
},
routes: [
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/services/applicationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,13 @@ export default {

checkApplicationStatus(application) {
const isActive = application?.stateCode === CRM_STATE_CODES.ACTIVE
const hasCorrectStatus = [APPLICATION_STATUS_CODES.SUBMITTED, APPLICATION_STATUS_CODES.IN_REVIEW, APPLICATION_STATUS_CODES.APPROVED, APPLICATION_STATUS_CODES.AWAITING_PROVIDER].includes(
application?.statusCode,
)
const hasCorrectStatus = [
APPLICATION_STATUS_CODES.SUBMITTED,
APPLICATION_STATUS_CODES.IN_REVIEW,
APPLICATION_STATUS_CODES.APPROVED,
APPLICATION_STATUS_CODES.AWAITING_PROVIDER,
APPLICATION_STATUS_CODES.VERIFIED,
].includes(application?.statusCode)
return isActive && hasCorrectStatus
},

Expand Down
6 changes: 6 additions & 0 deletions frontend/src/stores/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ export const useAppStore = defineStore('app', {
return union?.description
}
},
getUnionIdByName: (state) => {
return (name) => {
const union = state.unions?.find((item) => item.description === name)
return union?.id
}
},
},
actions: {
async getLookupInfo() {
Expand Down
15 changes: 13 additions & 2 deletions frontend/src/stores/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { defineStore } from 'pinia'
import ApplicationService from '@/services/applicationService'
import DocumentService from '@/services/documentService'
import LicenceService from '@/services/licenceService'
import { useAppStore } from '@/stores/app'
import { APPLICATION_STATUS_CODES, DOCUMENT_TYPES, FACILITY_TYPES, YES_NO_CHOICE_CRM_MAPPING } from '@/utils/constants'

/*
Expand Down Expand Up @@ -82,7 +83,8 @@ export const useApplicationsStore = defineStore('applications', {
this.isStaffingComplete =
this.isThereAtLeastOneEmployee(this.currentApplication) &&
this.areEmployeeCertificatesComplete(this.currentApplication?.providerEmployees, this.currentApplication) &&
this.isUnionSectionComplete(this.currentApplication)
this.isUnionSectionComplete(this.currentApplication) &&
this.isCSSEASectionComplete(this.currentApplication)
this.isDeclareSubmitComplete = checkDeclareSubmitComplete(this.currentApplication)
},

Expand Down Expand Up @@ -139,8 +141,17 @@ export const useApplicationsStore = defineStore('applications', {
return allCertificateNumbers?.length === uniqueCertificateNumbers?.length
},

isOtherUnionSelected(application) {
const appStore = useAppStore()
return application?.unions?.includes(appStore.getUnionIdByName('Other'))
},

isUnionSectionComplete(application) {
return application?.isUnionized === 0 || !isEmpty(application?.unions)
return application?.isUnionized === 0 || (!isEmpty(application?.unions) && (!this.isOtherUnionSelected(application) || !isEmpty(application?.unionDescription)))
},

isCSSEASectionComplete(application) {
return application?.cssea != null
},
},
})
1 change: 1 addition & 0 deletions frontend/src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export const APPLICATION_ERROR_MESSAGES = Object.freeze({
OPERATIONAL_COST: 'Operating costs required -or- Facility costs required',
STAFFING: 'Staffing information required',
UNION: 'Union information required',
CSSEA: 'CSSEA information required',
MISMATCH_NUMBER_STAFF_CERTIFICATE: 'The total of staff and total of certificates must match',
DUPLICATE_CERTIFICATE_NUMBERS: 'Certificate number already exists, duplicate certificates are not permitted',
DUPLICATE_CERTIFICATE_INITIALS: 'Initials already exists, please ensure staff are entered only once on this page.',
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/utils/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ function formatDateToUTC(date) {
return new Date(date).toLocaleString('en-CA', { timeZone: 'UTC', dateStyle: 'full' })
}

function formatDateInputToCRMFormat(date) {
let formattedDate = new Date(date)
formattedDate.setHours(0, 0, 0, 0)
return formattedDate.toISOString().split('.')[0] + 'Z'
}

function formatTime12to24(time12h) {
if (isEmpty(time12h) || !is12hFormat(time12h)) return time12h
const [time, modifier] = time12h.split(' ')
Expand Down Expand Up @@ -59,6 +65,7 @@ export default {
formatDateTime,
formatDecimalNumber,
formatDateToUTC,
formatDateInputToCRMFormat,
formatTime12to24,
formatTime24to12,
}
2 changes: 1 addition & 1 deletion frontend/src/utils/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const rules = {
email: (v) => !v || /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(v) || 'A valid email is required', // https://emailregex.com/
required: [
function (v) {
if (v === 0) {
if (v === 0 || typeof v === 'boolean') {
return true
} else if (Array.isArray(v)) {
return v.length > 0 || REQUIRED_MSG
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/views/applications/DeclareSubmitView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
</li>
</ul>
<p class="my-5">
Intentionally supplying information that is false or misleading with respect to a material fact in order to obtain a child care grant may lead to action being taken under Section 9 of the
Child Care BC Act. If you are convicted of an offence under section 9, a court may order you imprisoned for up to six months, fine you not more than $2,000.00, or order you to pay the
government all or part of any amount received under the child care grant.
Intentionally supplying information that is false or misleading with respect to a material fact in order to obtain a child care grant may lead to action being taken under Section 24(2) of
the
<i>Early Learning and Child Care Act</i>
(ELCCA). If you are convicted of an offence under Section 24(2), a court may order you imprisoned for up to six months, fine you not more than $2,000.00, or order you to pay the government
all or part of any amount received under the child care grant.
</p>
<p>I consent to the Ministry contacting other branches within the Ministry and other Province ministries to validate the accuracy of any information that I have provided.</p>
</div>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/applications/FacilityDetailsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
</template>

<script>
import moment from 'moment'
import { mapState, mapWritableState, mapActions } from 'pinia'

import AppLabel from '@/components/ui/AppLabel.vue'
Expand All @@ -120,6 +119,7 @@ import ContactInfo from '@/components/applications/ContactInfo.vue'
import ApplicationService from '@/services/applicationService'
import { useApplicationsStore } from '@/stores/applications'
import { APPLICATION_ROUTES } from '@/utils/constants'
import format from '@/utils/format'
import rules from '@/utils/rules'
import alertMixin from '@/mixins/alertMixin'

Expand Down Expand Up @@ -221,7 +221,7 @@ export default {

async mounted() {
this.$emit('process', false)
this.fiscalYearEndDate = this.currentApplication?.fiscalYearEndDate ? moment(this.currentApplication?.fiscalYearEndDate).toDate() : null
this.fiscalYearEndDate = this.currentApplication?.fiscalYearEndDate ? new Date(this.currentApplication?.fiscalYearEndDate) : null
this.primaryContact = this.contacts?.find((contact) => contact.contactId === this.currentApplication?.primaryContactId)
this.secondaryContact = this.contacts?.find((contact) => contact.contactId === this.currentApplication?.secondaryContactId)
this.expenseAuthority = this.contacts?.find((contact) => contact.contactId === this.currentApplication?.expenseAuthorityId)
Expand All @@ -241,7 +241,7 @@ export default {
primaryContactId: this.primaryContact?.contactId ? this.primaryContact?.contactId : null,
secondaryContactId: this.secondaryContact?.contactId ? this.secondaryContact?.contactId : null,
expenseAuthorityId: this.expenseAuthority?.contactId ? this.expenseAuthority?.contactId : null,
fiscalYearEndDate: this.fiscalYearEndDate ? moment(this.fiscalYearEndDate).startOf('day') : null,
fiscalYearEndDate: this.fiscalYearEndDate ? format.formatDateInputToCRMFormat(this.fiscalYearEndDate) : null,
}
if (ApplicationService.isApplicationUpdated(payload)) {
await ApplicationService.updateApplication(this.$route.params.applicationGuid, payload)
Expand Down
Loading

0 comments on commit 441f986

Please sign in to comment.