Skip to content

Commit

Permalink
updates from Wes
Browse files Browse the repository at this point in the history
  • Loading branch information
jenbeckett committed Dec 2, 2024
1 parent 2a8d8f3 commit 290a8ac
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 47 deletions.
41 changes: 20 additions & 21 deletions backend/src/components/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ async function postPdf(req, buffer) {
}

async function printPdf(req, numOfRetries = 0) {
let url = `${req.headers.referer}/printable`;
const url = `${req.headers.referer}/printable`;

log.info('printPdf :: user is', req.session?.passport?.user?.displayName);
log.verbose('printPdf :: correlationId is', req.session.correlationID);
Expand Down Expand Up @@ -514,7 +514,7 @@ function getFacilityInMap(map, facilityId) {

async function updateStatusForApplicationComponents(req, res) {
const promises = [];
let request = req.body;
const request = req.body;
try {
if (request.organizationId && request.isOrganizationComplete !== null && request.isOrganizationComplete !== undefined) {
let organizationReq = {
Expand All @@ -541,7 +541,7 @@ async function updateStatusForApplicationComponents(req, res) {
}
}
if (request.facilities) {
for (let facility of request.facilities) {
for (const facility of request.facilities) {
if (facility.facilityId && facility.isFacilityComplete !== null && facility.isFacilityComplete !== undefined) {
let facilityReq = {
isFacilityComplete: facility.isFacilityComplete,
Expand All @@ -552,7 +552,7 @@ async function updateStatusForApplicationComponents(req, res) {
}
}
if (request.fundings) {
for (let funding of request.fundings) {
for (const funding of request.fundings) {
if (funding.basefundingId && funding.isCCOFComplete !== null && funding.isCCOFComplete !== undefined) {
let ccofBaseFundingReq = {
isCCOFComplete: funding.isCCOFComplete,
Expand All @@ -563,7 +563,7 @@ async function updateStatusForApplicationComponents(req, res) {
}
}
if (request.ccfris) {
for (let ccfri of request.ccfris) {
for (const ccfri of request.ccfris) {
if (
ccfri.ccfriId &&
((ccfri.isCCFRIComplete !== null && ccfri.isCCFRIComplete !== undefined) ||
Expand Down Expand Up @@ -592,12 +592,12 @@ async function updateStatusForApplicationComponents(req, res) {

async function getApplicationSummary(req, res) {
try {
let operation = `ccof_applications(${req.params.applicationId})?$expand=ccof_applicationccfri_Application_ccof_ap($select=${getMappingString(
const operation = `ccof_applications(${req.params.applicationId})?$expand=ccof_applicationccfri_Application_ccof_ap($select=${getMappingString(
ApplicationSummaryCcfriMappings,
)}),ccof_ccof_application_ccof_applicationecewe_application($select=ccof_name,_ccof_facility_value,ccof_optintoecewe,statuscode,ccof_facilityunionstatus),ccof_application_basefunding_Application`;
let results = await getOperation(operation);
const results = await getOperation(operation);

let applicationSummary = new MappableObjectForFront(results, ApplicationSummaryMappings).data;
const applicationSummary = new MappableObjectForFront(results, ApplicationSummaryMappings).data;
applicationSummary.organizationProviderType = getLabelFromValue(applicationSummary.organizationProviderType, ORGANIZATION_PROVIDER_TYPES);
applicationSummary.applicationType = getLabelFromValue(applicationSummary.applicationType, CCOF_APPLICATION_TYPES);
applicationSummary.ccofStatus = getLabelFromValue(applicationSummary.ccofStatus, CCOF_STATUS_CODES, 'NEW');
Expand All @@ -624,7 +624,7 @@ async function getApplicationSummary(req, res) {
});

//add the change request ID to the facility so we can filter by it on the front end
let allChangeRequests = await getChangeRequestsFromApplicationId(req.params.applicationId);
const allChangeRequests = await getChangeRequestsFromApplicationId(req.params.applicationId);
if (allChangeRequests.length > 0) {
allChangeRequests.forEach((changeRequest) => {
changeRequest.changeActions.forEach((changeAction) => {
Expand All @@ -649,7 +649,7 @@ async function getApplicationSummary(req, res) {

/* Checks if object attrubte name exists in payload */
function checkKey(key, obj) {
for (let name in obj) {
for (const name in obj) {
if (name === key) {
return true;
}
Expand All @@ -663,13 +663,13 @@ function checkKey(key, obj) {
}

async function getFacilityChangeData(changeActionId) {
let mappedData = [];
const mappedData = [];
//also grab some facility data so we can use the CCOF page.We might also be able to grab CCFRI ID from here?
let newFacOperation = `ccof_change_request_new_facilities?$select=_ccof_facility_value,ccof_change_request_new_facilityid&$expand=ccof_facility($select=name,ccof_facilitystatus)&$filter=_ccof_change_action_value eq ${changeActionId}`;
let newFacData = await getOperation(newFacOperation);
const newFacOperation = `ccof_change_request_new_facilities?$select=_ccof_facility_value,ccof_change_request_new_facilityid&$expand=ccof_facility($select=name,ccof_facilitystatus)&$filter=_ccof_change_action_value eq ${changeActionId}`;
const newFacData = await getOperation(newFacOperation);
newFacData.value.forEach((fac) => {
if (fac.ccof_facility) {
let mappedFacility = new MappableObjectForFront(fac, NewFacilityMappings).toJSON();
const mappedFacility = new MappableObjectForFront(fac, NewFacilityMappings).toJSON();
mappedFacility.facilityName = fac.ccof_facility['name'];
mappedFacility.facilityStatus = fac.ccof_facility['[email protected]'];
mappedData.push(mappedFacility);
Expand All @@ -680,7 +680,7 @@ async function getFacilityChangeData(changeActionId) {
}

async function getMTFIChangeData(changeActionId) {
let mtfi = await getChangeActionDetails(changeActionId, 'ccof_change_request_mtfis', MtfiMappings, 'ccof_CCFRI', UserProfileBaseCCFRIMappings);
const mtfi = await getChangeActionDetails(changeActionId, 'ccof_change_request_mtfis', MtfiMappings, 'ccof_CCFRI', UserProfileBaseCCFRIMappings);
mtfi?.forEach((item) => {
item.ccfriStatus = getLabelFromValue(item.ccfriStatus, CCFRI_STATUS_CODES, 'NOT STARTED');
});
Expand All @@ -702,17 +702,16 @@ async function getChangeRequestsFromApplicationId(applicationIds) {
});

try {
let operation = `ccof_change_requests?$expand=ccof_change_action_change_request&$select=${getMappingString(
const operation = `ccof_change_requests?$expand=ccof_change_action_change_request&$select=${getMappingString(
ChangeRequestMappings,
)}&$filter=(Microsoft.Dynamics.CRM.In(PropertyName='ccof_application',PropertyValues=${str}))`;
//let operation = `ccof_change_requests?$expand=ccof_change_action_change_request&$select=${getMappingString(ChangeRequestMappings)}&$filter=_ccof_application_value eq ${applicationId}`;
let changeRequests = await getOperation(operation);
changeRequests = changeRequests.value;

let payload = [];
const payload = [];
await Promise.all(
changeRequests.map(async (request) => {
let req = new MappableObjectForFront(request, ChangeRequestMappings).toJSON();
const req = new MappableObjectForFront(request, ChangeRequestMappings).toJSON();

//go through the array of change ACTIONS and map them. Depending on the type of change action - we might need to load more data.
req.changeActions = await Promise.all(
Expand Down Expand Up @@ -751,8 +750,8 @@ async function getChangeRequest(req, res) {

async function deletePcfApplication(req, res) {
try {
let operation = `ccof_applications(${req.params.applicationId})?$expand=ccof_application_basefunding_Application($select=_ccof_facility_value)`;
let application = await getOperation(operation);
const operation = `ccof_applications(${req.params.applicationId})?$expand=ccof_application_basefunding_Application($select=_ccof_facility_value)`;
const application = await getOperation(operation);

//loop thru to grab facility ID's and delete all of them
await Promise.all(
Expand Down
10 changes: 3 additions & 7 deletions frontend/src/components/eceweApplication/EceweEligibility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ export default {
this.isLoading = false;
}
},
created() {
this.ORGANIZATION_PROVIDER_TYPES = ORGANIZATION_PROVIDER_TYPES;
},
methods: {
...mapActions(useEceweAppStore, [
'loadECEWE',
Expand Down Expand Up @@ -245,7 +241,7 @@ export default {
});
},
/* NOTE: ece-we model and ece-we change request are TWO TOTALLY SEPERATE TABLES.
If you happen to need to update the model with new questions - you have to update the intergration in two places:
If you happen to need to update the model with new questions - you have to update the integration in two places:
backend / application.js - getECEWEApplication
backend / changeRequest.js - getChangeActionNewFacilitityDetails
Expand All @@ -265,7 +261,7 @@ export default {
}
if (this.applicationId) {
try {
let response = await this.loadECEWE();
const response = await this.loadECEWE();
if (this.isChangeRequest) {
await this.getChangeRequest(this.$route.params.changeRecGuid);
if (this.loadedChangeRequest && !isNullOrBlank(this.loadedChangeRequest.optInECEWE)) {
Expand Down Expand Up @@ -343,7 +339,7 @@ export default {
this.facilities.forEach((facility) => {
facility.optInOrOut = this.model?.optInECEWE;
//update the next page navbar checkmark
let fac = this.navBarList.find((f) => f.facilityId === facility.facilityId);
const fac = this.navBarList.find((f) => f.facilityId === facility.facilityId);
if (fac) {
fac.eceweOptInStatus = this.model?.optInECEWE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<template #label>
<div class="radio-label text-left">
Are you a public sector employer, as defined in the
<u><i>Public Sector Employers Act?</i></u>
Public Sector Employers Act?
</div>
</template>
<div class="flex-left">
Expand Down Expand Up @@ -385,7 +385,7 @@ import {
ECEWE_UNION_AGREEMENT_REACHED
} from '@/utils/constants.js';
import rules from '@/utils/rules.js';
import AppAlertBanner from '../guiComponents/AppAlertBanner.vue';
import AppAlertBanner from '@/components/guiComponents/AppAlertBanner.vue';
export default {
components: {AppAlertBanner},
Expand Down
30 changes: 15 additions & 15 deletions frontend/src/components/eceweApplication/EceweFacilities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
Opt-In All Facilities
</v-btn>
<div>
<div v-for="(_facility, index) in uiFacilities" :key="index">
<div v-for="(facility, index) in uiFacilities" :key="index">
<v-row justify="center" class="pa-4">
<v-card elevation="4" class="py-2 px-5 mx-2 rounded-lg col-9" width="75%">
<v-row>
Expand All @@ -68,8 +68,8 @@
<v-col cols="5" class="flex-column">
<strong>Facility Name: {{ navBarList[index].facilityName }}</strong>
</v-col>
<v-col v-if="!uiFacilities[index].update" cols="4" class="flex-column text-center">
<strong> Status: Opt-{{ uiFacilities[index].optInOrOut === 1 ? 'In' : 'Out' }} </strong>
<v-col v-if="!facility.update" cols="4" class="flex-column text-center">
<strong> Status: Opt-{{ getOptInString(facility) }} </strong>
</v-col>

<v-col v-if="organizationProviderType === ORGANIZATION_PROVIDER_TYPES.GROUP" cols="3">
Expand All @@ -78,16 +78,16 @@
color="#003366"
dark
:disabled="isReadOnly"
@click="uiFacilities[index].update = uiFacilities[index].update == false ? true : false"
@click="facility.update = facility.update == false ? true : false"
>
Update
</v-btn>
</v-col>
</v-row>
<template v-if="uiFacilities[index].update">
<template v-if="facility.update">
<v-row class="ml-16">
<v-radio-group
v-model="uiFacilities[index].optInOrOut"
v-model="facility.optInOrOut"
class="justify-space-around"
inline
:disabled="isReadOnly"
Expand All @@ -101,12 +101,9 @@
</v-col>
</v-radio-group>
</v-row>
<v-row
v-if="uiFacilities[index].optInOrOut === ECEWE_OPT_IN_TYPES.OPT_IN && showUnionQuestion"
class="ml-16"
>
<v-row v-if="facility.optInOrOut === ECEWE_OPT_IN_TYPES.OPT_IN && showUnionQuestion" class="ml-16">
<v-radio-group
v-model="uiFacilities[index].facilityUnionStatus"
v-model="facility.facilityUnionStatus"
class=""
inline
:disabled="isReadOnly"
Expand All @@ -122,13 +119,13 @@
</v-row>
</template>

<v-row v-if="uiFacilities[index].optInOrOut === ECEWE_OPT_IN_TYPES.OPT_IN && showUnionQuestion">
<v-row v-if="facility.optInOrOut === ECEWE_OPT_IN_TYPES.OPT_IN && showUnionQuestion">
<v-col cols="12">
<strong>
{{
uiFacilities[index].facilityUnionStatus === ECEWE_FACILITY_UNION_TYPES.UNIONIZED
facility.facilityUnionStatus === ECEWE_FACILITY_UNION_TYPES.UNIONIZED
? 'Unionized'
: uiFacilities[index].facilityUnionStatus === ECEWE_FACILITY_UNION_TYPES.NON_UNIONIZED
: facility.facilityUnionStatus === ECEWE_FACILITY_UNION_TYPES.NON_UNIONIZED
? 'Non-Unionized'
: ''
}}
Expand Down Expand Up @@ -286,6 +283,9 @@ export default {
'setFundingModelTypes',
]),
...mapActions(useNavBarStore, ['refreshNavBarList']),
getOptInString(facility) {
return facility.optInOrOut === ECEWE_OPT_IN_TYPES.OPT_IN ? 'In' : 'Out';
},
showUpdateButton(index) {
if (this.getLanguageYearLabel !== PROGRAM_YEAR_LANGUAGE_TYPES.FY2025_26) {
return (
Expand All @@ -297,7 +297,7 @@ export default {
return !this.uiFacilities?.[index].update && !this.isLoading;
},
setupUiFacilities() {
let copyFacilities = cloneDeep(this.facilities);
const copyFacilities = cloneDeep(this.facilities);
copyFacilities?.forEach((element) => (element.update = element.optInOrOut == null));
this.uiFacilities = copyFacilities;
this.setLoadedFacilities([...this.facilities]);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/summary/group/ECEWESummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<v-col cols="12">
<span class="summary-label pt-3">
I confirm our organization/facilities has reached a local agreement with the union to amend
the collective agreement(s) in order to implement the ECE -WE.
the collective agreement(s) in order to implement the ECE-WE.
</span>
<v-text-field
placeholder="Required"
Expand Down Expand Up @@ -168,7 +168,7 @@
<v-col v-if="ecewe?.applicableSector === ECEWE_SECTOR_TYPES.SOME_FACILITIES_UNIONIZED" cols="12">
<span class="summary-label pt-3">
I confirm our organization/facilities has reached a local agreement with the union to amend the
collective agreement(s) in order to implement the ECE -WE.
collective agreement(s) in order to implement the ECE-WE.
</span>
<v-text-field
placeholder="Required"
Expand Down

0 comments on commit 290a8ac

Please sign in to comment.