From 7e8b6c405efe644c9837e51e02fa0f9fdc6be95b Mon Sep 17 00:00:00 2001 From: Le Date: Mon, 4 Nov 2024 11:14:08 -0800 Subject: [PATCH 1/9] ccfri-3752 - initial setup --- .../AFS/ApprovableFeeSchedule.vue | 88 +++++++++ .../AFS/ApprovableParentFeesCards.vue | 170 ++++++++++++++++++ frontend/src/components/util/NavBar.vue | 15 ++ frontend/src/router.js | 13 ++ frontend/src/utils/constants.js | 1 + 5 files changed, 287 insertions(+) create mode 100644 frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue create mode 100644 frontend/src/components/ccfriApplication/AFS/ApprovableParentFeesCards.vue diff --git a/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue b/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue new file mode 100644 index 000000000..ec08add84 --- /dev/null +++ b/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue @@ -0,0 +1,88 @@ + + + diff --git a/frontend/src/components/ccfriApplication/AFS/ApprovableParentFeesCards.vue b/frontend/src/components/ccfriApplication/AFS/ApprovableParentFeesCards.vue new file mode 100644 index 000000000..f2d0f5d81 --- /dev/null +++ b/frontend/src/components/ccfriApplication/AFS/ApprovableParentFeesCards.vue @@ -0,0 +1,170 @@ + + + + diff --git a/frontend/src/components/util/NavBar.vue b/frontend/src/components/util/NavBar.vue index cf258b6d1..fcc371fe3 100644 --- a/frontend/src/components/util/NavBar.vue +++ b/frontend/src/components/util/NavBar.vue @@ -568,6 +568,21 @@ export default { navBarId: navBarId++, }); } + if (true) { + // if (item.enableAfs) { + items.push({ + title: 'Approvable Fee Schedule', + subTitle: item.facilityName, + subTitle2: item.facilityAccountNumber, + id: item.facilityId, + link: { name: 'ccfri-afs', params: { urlGuid: item.ccfriApplicationId } }, + isAccessible: true, + icon: this.getCheckbox(item.isAfsComplete), + isActive: this.$route.params.urlGuid === item.ccfriApplicationId && 'ccfri-afs' === this.$route.name, + position: positionIndex++, + navBarId: navBarId++, + }); + } } }); } diff --git a/frontend/src/router.js b/frontend/src/router.js index b1917661e..5991bc567 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -18,6 +18,7 @@ import SessionExpired from '@/components/SessionExpired.vue'; import SubmissionHistory from '@/components/SubmissionHistory.vue'; import SummaryDeclaration from '@/components/SummaryDeclaration.vue'; import SupportingDocumentUpload from '@/components/SupportingDocumentUpload.vue'; +import ApprovableFeeSchedule from '@/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue'; import AddNewFees from '@/components/ccfriApplication/group/AddNewFees.vue'; import CcfriEceLandingPage from '@/components/ccfriApplication/group/CcfriEceLanding.vue'; import currentFees from '@/components/ccfriApplication/group/ExistingFacilityFees.vue'; @@ -450,6 +451,18 @@ const router = createRouter({ subtitleBanner: Subtitle_Banners.APPLICATION, }, }, + { + path: pcfUrl(PATHS.CCFRI_AFS), + name: 'ccfri-afs', + component: ApprovableFeeSchedule, + meta: { + pageTitle: 'Approvable Fee Schedule', + showNavBar: true, + navBarGroup: NAV_BAR_GROUPS.CCFRI, + requiresAuth: true, + subtitleBanner: Subtitle_Banners.APPLICATION, + }, + }, { path: '/login', name: 'login', diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index be4eb43b4..1177192a1 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -110,6 +110,7 @@ export const PATHS = { CCOF_FAMILY_FUNDING: '/family/funding', CCFRI_HOME: '/ccfri', + CCFRI_AFS: '/ccfri/afs', CCFRI_CURRENT_FEES: '/ccfri/current-fees', CCFRI_NEW_FEES: '/ccfri/new-fees', CCFRI_RFI: '/ccfri/req-info', From 795b8481391a67a84230c0065e73004cbd22e73d Mon Sep 17 00:00:00 2001 From: Le Date: Thu, 7 Nov 2024 16:25:40 -0800 Subject: [PATCH 2/9] ccfri-3752, ccfri-3754, ccfri-3813 - add AFS page to Application --- backend/src/components/application.js | 410 +++++++++--------- backend/src/routes/application.js | 234 ++++++---- backend/src/util/mapping/Mappings.js | 221 +++++----- frontend/src/components/LandingPage.vue | 31 +- .../AFS/ApprovableFeeSchedule.vue | 185 ++++++-- .../AFS/ApprovableParentFeesCards.vue | 168 ++----- .../ccofApplication/family/Eligibility.vue | 6 + .../guiComponents/FacilityHeader.vue | 6 +- frontend/src/components/util/NavBar.vue | 5 +- frontend/src/router.js | 2 +- frontend/src/store/app.js | 24 + frontend/src/store/application.js | 12 +- frontend/src/store/ccfriApp.js | 10 + frontend/src/utils/common.js | 13 +- frontend/src/utils/constants.js | 13 + 15 files changed, 766 insertions(+), 574 deletions(-) diff --git a/backend/src/components/application.js b/backend/src/components/application.js index 842cd299a..476ed8a6f 100644 --- a/backend/src/components/application.js +++ b/backend/src/components/application.js @@ -11,19 +11,12 @@ const { updateChangeRequestNewFacility, postApplicationSummaryDocument, postChangeRequestSummaryDocument, - getChangeActionDetails + getChangeActionDetails, } = require('./utils'); -const { - CCOF_APPLICATION_TYPES, - ORGANIZATION_PROVIDER_TYPES, - APPLICATION_STATUS_CODES, - CCOF_STATUS_CODES, - CHANGE_REQUEST_TYPES, - CCFRI_STATUS_CODES -} = require('../util/constants'); +const { CCOF_APPLICATION_TYPES, ORGANIZATION_PROVIDER_TYPES, APPLICATION_STATUS_CODES, CCOF_STATUS_CODES, CHANGE_REQUEST_TYPES, CCFRI_STATUS_CODES } = require('../util/constants'); const HttpStatus = require('http-status-codes'); const log = require('./logger'); -const {MappableObjectForFront, MappableObjectForBack, getMappingString} = require('../util/mapping/MappableObject'); +const { MappableObjectForFront, MappableObjectForBack, getMappingString } = require('../util/mapping/MappableObject'); const { ECEWEApplicationMappings, ECEWEFacilityMappings, @@ -35,58 +28,56 @@ const { OrganizationFacilityMappings, CCOFApplicationFundingMapping, OrganizationMappings, - CCFRIFacilityMappings + CCFRIApprovableFeeSchedulesMappings, + CCFRIFacilityMappings, //ChangeRequestMappings } = require('../util/mapping/Mappings'); -const {getCCFRIClosureDates} = require('./facility'); -const {mapFundingObjectForFront} = require('./funding'); +const { getCCFRIClosureDates } = require('./facility'); +const { mapFundingObjectForFront } = require('./funding'); const { getBrowserContext, closeBrowser } = require('../util/browser'); const { ChangeRequestMappings, ChangeActionRequestMappings, NewFacilityMappings, MtfiMappings } = require('../util/mapping/ChangeRequestMappings'); - async function renewCCOFApplication(req, res) { log.info('renew CCOF application called'); try { const application = req.body; let payload = { - 'ccof_providertype': application.providerType == 'GROUP' ? ORGANIZATION_PROVIDER_TYPES.GROUP : ORGANIZATION_PROVIDER_TYPES.FAMILY, - 'ccof_applicationtype': CCOF_APPLICATION_TYPES.RENEW, + ccof_providertype: application.providerType == 'GROUP' ? ORGANIZATION_PROVIDER_TYPES.GROUP : ORGANIZATION_PROVIDER_TYPES.FAMILY, + ccof_applicationtype: CCOF_APPLICATION_TYPES.RENEW, 'ccof_ProgramYear@odata.bind': `/ccof_program_years(${application.programYearId})`, - 'ccof_Organization@odata.bind': `/ccof_program_years(${application.organizationId})` + 'ccof_Organization@odata.bind': `/ccof_program_years(${application.organizationId})`, }; log.info('Payload for renew is: ', payload.toJSON); let applicationGuid = await postOperation('ccof_applications', payload); //After the application is created, get the application guid - return res.status(HttpStatus.CREATED).json({applicationId: applicationGuid}); + return res.status(HttpStatus.CREATED).json({ applicationId: applicationGuid }); } catch (e) { log.error('error', e); return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); } } -async function patchCCFRIApplication(req, res){ +async function patchCCFRIApplication(req, res) { let payload = req.body; payload = new MappableObjectForBack(payload, CCFRIFacilityMappings); payload = payload.toJSON(); - try{ + try { await patchOperationWithObjectId('ccof_applicationccfris', req.params.ccfriId, payload); - } - catch (e){ + } catch (e) { log.error(e); return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); } return res.status(HttpStatus.OK).json(payload); } -async function deleteCCFRIApplication(req, res){ - try{ +async function deleteCCFRIApplication(req, res) { + try { log.info('deleteCCFRIApplication - ccfriId: ', req.params.ccfriId); await deleteOperationWithObjectId('ccof_applicationccfris', req.params.ccfriId); return res.status(HttpStatus.OK).json(); - } - catch (e){ + } catch (e) { log.error(e); return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); } @@ -97,59 +88,61 @@ async function updateCCFRIApplication(req, res) { let body = req.body; let retVal = []; try { - await Promise.all(body.map(async (facility) => { - let payload = { - 'ccof_ccfrioptin': facility.optInResponse, - 'ccof_Facility@odata.bind': `/accounts(${facility.facilityID})`, - 'ccof_Application@odata.bind': `/ccof_applications(${facility.applicationID})`, - }; - - // if there is Change Action ID in request body -> creating new Change Action MTFI - if (facility.changeActionId) { - delete payload['ccof_Application@odata.bind']; - payload['ccof_change_request_mtfi_application_ccfri'] = [ - { - "ccof_facility@odata.bind": `/accounts(${facility.facilityID})`, - "ccof_Change_Action@odata.bind": `/ccof_change_actions(${facility.changeActionId})`, - 'ccof_Organization@odata.bind': `/accounts(${facility.organizationId})`, - 'ccof_ProgramYear@odata.bind': `/ccof_program_years(${facility.programYearId})`, - } - ]; - } - - //only bind CCFRI application to main application if this facility is completed during a new application - //ccfri application for change request should only bind to their respective changeAction (done below) - //requirements changed so now we DO bind to main app... leaving this here for now just in case it changes again. - // if (!facility.changeRequestNewFacilityId){ - // payload = {...payload, 'ccof_Application@odata.bind': `/ccof_applications(${facility.applicationID})`}; - // } - log.info('patch ccfri payload' , payload); - - let response = undefined; - if (facility.ccfriApplicationId) { - response = await patchOperationWithObjectId('ccof_applicationccfris', facility.ccfriApplicationId, payload); - log.info('CCFRI RESP!!!!!!!' , response); - retVal.push(response); - } else { - response = await postOperation('ccof_applicationccfris', payload); - retVal.push({ - facilityId: facility.facilityID, - applicationId: facility.applicationID, - ccfriApplicationId: response, + await Promise.all( + body.map(async (facility) => { + let payload = { ccof_ccfrioptin: facility.optInResponse, - }); - } + 'ccof_Facility@odata.bind': `/accounts(${facility.facilityID})`, + 'ccof_Application@odata.bind': `/ccof_applications(${facility.applicationID})`, + }; + + // if there is Change Action ID in request body -> creating new Change Action MTFI + if (facility.changeActionId) { + delete payload['ccof_Application@odata.bind']; + payload['ccof_change_request_mtfi_application_ccfri'] = [ + { + 'ccof_facility@odata.bind': `/accounts(${facility.facilityID})`, + 'ccof_Change_Action@odata.bind': `/ccof_change_actions(${facility.changeActionId})`, + 'ccof_Organization@odata.bind': `/accounts(${facility.organizationId})`, + 'ccof_ProgramYear@odata.bind': `/ccof_program_years(${facility.programYearId})`, + }, + ]; + } - //if this ccfri application is linked to a new facility change request, add the linkage to the New Facility Change Request - if(facility.changeRequestNewFacilityId){ - let resp = await updateChangeRequestNewFacility(facility.changeRequestNewFacilityId, - {"ccof_ccfri@odata.bind": `/ccof_applicationccfris(${facility.ccfriApplicationId? facility.ccfriApplicationId : response})`} - ); - retVal.push(resp); - } - await sleep(100); //slow down the hits to dynamics. - //log.info('res data:' , response); - })); //end for each + //only bind CCFRI application to main application if this facility is completed during a new application + //ccfri application for change request should only bind to their respective changeAction (done below) + //requirements changed so now we DO bind to main app... leaving this here for now just in case it changes again. + // if (!facility.changeRequestNewFacilityId){ + // payload = {...payload, 'ccof_Application@odata.bind': `/ccof_applications(${facility.applicationID})`}; + // } + log.info('patch ccfri payload', payload); + + let response = undefined; + if (facility.ccfriApplicationId) { + response = await patchOperationWithObjectId('ccof_applicationccfris', facility.ccfriApplicationId, payload); + log.info('CCFRI RESP!!!!!!!', response); + retVal.push(response); + } else { + response = await postOperation('ccof_applicationccfris', payload); + retVal.push({ + facilityId: facility.facilityID, + applicationId: facility.applicationID, + ccfriApplicationId: response, + ccof_ccfrioptin: facility.optInResponse, + }); + } + + //if this ccfri application is linked to a new facility change request, add the linkage to the New Facility Change Request + if (facility.changeRequestNewFacilityId) { + let resp = await updateChangeRequestNewFacility(facility.changeRequestNewFacilityId, { + 'ccof_ccfri@odata.bind': `/ccof_applicationccfris(${facility.ccfriApplicationId ? facility.ccfriApplicationId : response})`, + }); + retVal.push(resp); + } + await sleep(100); //slow down the hits to dynamics. + //log.info('res data:' , response); + }), + ); //end for each } catch (e) { log.error(e); return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); @@ -158,6 +151,17 @@ async function updateCCFRIApplication(req, res) { return res.status(HttpStatus.OK).json(retVal); } +async function getApprovableFeeSchedules(req, res) { + try { + const response = await getOperation(`ccof_applicationccfris(${req.params.ccfriId})?$select=ccof_afs_status&$expand=ccof_afs_applicationccfri`); + const afs = new MappableObjectForFront(response, ApplicationSummaryCcfriMappings).toJSON(); + afs.approvableFeeSchedules = afs.approvableFeeSchedules?.map((item) => new MappableObjectForFront(item, CCFRIApprovableFeeSchedulesMappings).toJSON()); + return res.status(HttpStatus.OK).json(afs); + } catch (e) { + log.error('An error occurred while getting CCFRI AFS', e); + return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); + } +} /* child care and program year GUIDs are looked up in AddNewFees.vue */ @@ -171,10 +175,8 @@ async function upsertParentFees(req, res) { //the front end sends over an array of objects. This loops through the array and sends a dynamics API request //for each object. body.forEach(async (feeGroup) => { - //only call the delete API if there is a GUID acossciated to that child care category fee group if (feeGroup?.deleteMe && feeGroup?.parentFeeGUID) { - try { let response = await deleteOperationWithObjectId('ccof_application_ccfri_childcarecategories', feeGroup.parentFeeGUID); log.info('delete feeGroup res:', response); @@ -186,7 +188,6 @@ async function upsertParentFees(req, res) { //theResponse.push( res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data? e.data : e?.status )); } } else if (feeGroup?.feeFrequency) { - let childCareCategory = `/ccof_childcare_categories(${feeGroup.childCareCategory})`; let programYear = `/ccof_program_years(${feeGroup.programYear})`; @@ -194,27 +195,25 @@ async function upsertParentFees(req, res) { // log.info(feeGroup.ccfriApplicationGuid); let payload = { - 'ccof_frequency': feeGroup.feeFrequency, + ccof_frequency: feeGroup.feeFrequency, 'ccof_ChildcareCategory@odata.bind': childCareCategory, 'ccof_ProgramYear@odata.bind': programYear, }; - Object.assign(payload, - { - 'ccof_apr': feeGroup.aprFee, - 'ccof_may': feeGroup.mayFee, - 'ccof_jun': feeGroup.junFee, - 'ccof_jul': feeGroup.julFee, - 'ccof_aug': feeGroup.augFee, - 'ccof_sep': feeGroup.sepFee, - 'ccof_oct': feeGroup.octFee, - 'ccof_nov': feeGroup.novFee, - 'ccof_dec': feeGroup.decFee, - 'ccof_jan': feeGroup.janFee, - 'ccof_feb': feeGroup.febFee, - 'ccof_mar': feeGroup.marFee, - } - ); + Object.assign(payload, { + ccof_apr: feeGroup.aprFee, + ccof_may: feeGroup.mayFee, + ccof_jun: feeGroup.junFee, + ccof_jul: feeGroup.julFee, + ccof_aug: feeGroup.augFee, + ccof_sep: feeGroup.sepFee, + ccof_oct: feeGroup.octFee, + ccof_nov: feeGroup.novFee, + ccof_dec: feeGroup.decFee, + ccof_jan: feeGroup.janFee, + ccof_feb: feeGroup.febFee, + ccof_mar: feeGroup.marFee, + }); let url = `_ccof_applicationccfri_value=${feeGroup.ccfriApplicationGuid},_ccof_childcarecategory_value=${feeGroup.childCareCategory},_ccof_programyear_value=${feeGroup.programYear} `; try { let response = await patchOperationWithObjectId('ccof_application_ccfri_childcarecategories', url, payload); @@ -227,16 +226,15 @@ async function upsertParentFees(req, res) { } }); //end forEach - //if no notes, don't bother sending any requests. Even if left blank, front end will send over an empty string //so body[0].notes will always exist let payload = { - 'ccof_informationccfri': body[0].notes, - 'ccof_formcomplete': body[0].ccof_formcomplete, - 'ccof_has_rfi': body[0].ccof_has_rfi, - 'ccof_feecorrectccfri': body[0].existingFeesCorrect, - 'ccof_chargefeeccfri': body[0].hasClosureFees + ccof_informationccfri: body[0].notes, + ccof_formcomplete: body[0].ccof_formcomplete, + ccof_has_rfi: body[0].ccof_has_rfi, + ccof_feecorrectccfri: body[0].existingFeesCorrect, + ccof_chargefeeccfri: body[0].hasClosureFees, }; log.info(body[0].hasClosureFees); @@ -275,7 +273,6 @@ function formatTimeForBack(timeString) { return timeString; } - async function postClosureDates(dates, ccfriApplicationGuid, res) { let retVal = []; @@ -285,10 +282,12 @@ async function postClosureDates(dates, ccfriApplicationGuid, res) { //don't bother trying to delete if there are no dates saved if (dynamicsClosureDates.length > 0) { try { - await Promise.all(dynamicsClosureDates.map(async (date) => { - await deleteOperationWithObjectId('ccof_application_ccfri_closures', date.closureDateId); - //log.info(response); - })); + await Promise.all( + dynamicsClosureDates.map(async (date) => { + await deleteOperationWithObjectId('ccof_application_ccfri_closures', date.closureDateId); + //log.info(response); + }), + ); } catch (e) { log.info('something broke when deleting existing closure dates.'); log.info(e); @@ -298,19 +297,19 @@ async function postClosureDates(dates, ccfriApplicationGuid, res) { try { //if the user selects an end date, create a start and end date. else, use the only date for start and end. - await Promise.all(dates.map(async (date) => { - - let payload = { - 'ccof_startdate': formatTimeForBack(date.formattedStartDate), - 'ccof_paidclosure': date.feesPaidWhileClosed, - 'ccof_enddate': date.formattedEndDate ? formatTimeForBack(date.formattedEndDate) : formatTimeForBack(date.formattedStartDate), - 'ccof_comment': date.closureReason, - 'ccof_ApplicationCCFRI@odata.bind': `/ccof_applicationccfris(${ccfriApplicationGuid})` - }; - let response = await postOperation('ccof_application_ccfri_closures', payload); - retVal.push(response); - - })); + await Promise.all( + dates.map(async (date) => { + let payload = { + ccof_startdate: formatTimeForBack(date.formattedStartDate), + ccof_paidclosure: date.feesPaidWhileClosed, + ccof_enddate: date.formattedEndDate ? formatTimeForBack(date.formattedEndDate) : formatTimeForBack(date.formattedStartDate), + ccof_comment: date.closureReason, + 'ccof_ApplicationCCFRI@odata.bind': `/ccof_applicationccfris(${ccfriApplicationGuid})`, + }; + let response = await postOperation('ccof_application_ccfri_closures', payload); + retVal.push(response); + }), + ); return retVal; } catch (e) { log.info(e); @@ -318,14 +317,16 @@ async function postClosureDates(dates, ccfriApplicationGuid, res) { } } - async function getECEWEApplication(req, res) { try { - let operation = 'ccof_applications(' + req.params.applicationId + ')?$select=ccof_ecewe_optin,ccof_ecewe_employeeunion,ccof_ecewe_selecttheapplicablefundingmodel,ccof_ecewe_selecttheapplicablesector,ccof_public_sector_employer,ccof_ecewe_confirmation&$expand=ccof_ccof_application_ccof_applicationecewe_application($select=ccof_name,_ccof_facility_value,ccof_optintoecewe,statuscode)'; + let operation = + 'ccof_applications(' + + req.params.applicationId + + ')?$select=ccof_ecewe_optin,ccof_ecewe_employeeunion,ccof_ecewe_selecttheapplicablefundingmodel,ccof_ecewe_selecttheapplicablesector,ccof_public_sector_employer,ccof_ecewe_confirmation&$expand=ccof_ccof_application_ccof_applicationecewe_application($select=ccof_name,_ccof_facility_value,ccof_optintoecewe,statuscode)'; let eceweApp = await getOperation(operation); eceweApp = new MappableObjectForFront(eceweApp, ECEWEApplicationMappings); let forFrontFacilities = []; - Object.values(eceweApp.data.facilities).forEach(value => forFrontFacilities.push(new MappableObjectForFront(value, ECEWEFacilityMappings).data)); + Object.values(eceweApp.data.facilities).forEach((value) => forFrontFacilities.push(new MappableObjectForFront(value, ECEWEFacilityMappings).data)); eceweApp.data.facilities = forFrontFacilities; return res.status(HttpStatus.OK).json(eceweApp); } catch (e) { @@ -338,7 +339,7 @@ async function updateECEWEApplication(req, res) { let application = req.body; application = new MappableObjectForBack(application, ECEWEApplicationMappings); application = application.toJSON(); - application.ccof_ecewe_employeeunion = (application.ccof_ecewe_optin == 0) ? null : application.ccof_ecewe_employeeunion; + application.ccof_ecewe_employeeunion = application.ccof_ecewe_optin == 0 ? null : application.ccof_ecewe_employeeunion; try { log.verbose('updateECEWEApplication: payload', application); let response = await patchOperationWithObjectId('ccof_applications', req.params.applicationId, application); @@ -352,7 +353,7 @@ async function updateECEWEFacilityApplication(req, res) { let facilities = req.body; let forBackFacilities = []; let response; - Object.values(facilities).forEach(value => forBackFacilities.push(new MappableObjectForBack(value, ECEWEFacilityMappings).data)); + Object.values(facilities).forEach((value) => forBackFacilities.push(new MappableObjectForBack(value, ECEWEFacilityMappings).data)); let eceweApplicationId; try { for (let key in forBackFacilities) { @@ -377,13 +378,11 @@ async function updateECEWEFacilityApplication(req, res) { facilities[key].eceweApplicationId = response; //if this is a new facility change request, link ECEWE application to the New Facility Change Request if (changeRequestNewFacilityId) { - await updateChangeRequestNewFacility(changeRequestNewFacilityId, - {"ccof_ecewe@odata.bind": `/ccof_applicationecewes(${facilities[key].eceweApplicationId})`} - ); + await updateChangeRequestNewFacility(changeRequestNewFacilityId, { 'ccof_ecewe@odata.bind': `/ccof_applicationecewes(${facilities[key].eceweApplicationId})` }); } } } - return res.status(HttpStatus.OK).json({facilities: facilities}); + return res.status(HttpStatus.OK).json({ facilities: facilities }); } catch (e) { return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); } @@ -417,7 +416,7 @@ async function submitApplication(req, res) { if (checkKey('facilities', ccfriFacilitiesToLock)) { let ccof_applicationccfriid; for (let facility of ccfriFacilitiesToLock.facilities) { - facility = (new MappableObjectForBack(facility, UserProfileCCFRIMappings)).toJSON(); + facility = new MappableObjectForBack(facility, UserProfileCCFRIMappings).toJSON(); ccof_applicationccfriid = facility.ccof_applicationccfriid; delete facility.ccof_applicationccfriid; response = await patchOperationWithObjectId('ccof_applicationccfris', ccof_applicationccfriid, facility); @@ -439,7 +438,7 @@ async function postPdf(req, buffer) { filename: `${req.body.summaryDeclarationApplicationName}_Summary_Declaration_${getCurrentDateForPdfFileName()}.pdf`, filesize: buffer.byteLength, subject: 'APPLICATION SUMMARY', - documentbody: buffer.toString('base64') + documentbody: buffer.toString('base64'), }; await postApplicationSummaryDocument(payload); @@ -449,7 +448,7 @@ async function postPdf(req, buffer) { filename: `Change_Request_Summary_Declaration_${getCurrentDateForPdfFileName()}.pdf`, filesize: buffer.byteLength, subject: 'CHANGE REQUEST SUMMARY', - documentbody: buffer.toString('base64') + documentbody: buffer.toString('base64'), }; await postChangeRequestSummaryDocument(payload); @@ -460,7 +459,7 @@ async function postPdf(req, buffer) { async function printPdf(req, numOfRetries = 0) { let url = `${req.headers.referer}/printable`; - log.info('printPdf :: user is',req.session?.passport?.user?.displayName); + log.info('printPdf :: user is', req.session?.passport?.user?.displayName); log.verbose('printPdf :: correlationId is', req.session.correlationID); log.info('printPdf :: applicationId is', req.params.applicationId); log.verbose('printPdf :: url path is', url); @@ -490,14 +489,13 @@ async function printPdf(req, numOfRetries = 0) { displayHeaderFooter: false, printBackground: true, timeout: 300000, - width: 1280 + width: 1280, }); log.info('printPdf :: pdf buffer created starting compression'); const compressedPdfBuffer = await compress(pdfBuffer, { - gsModule: process.env.GHOSTSCRIPT_PATH // this is set in dockerfile to fix ghostscript error on deploy - } - ); + gsModule: process.env.GHOSTSCRIPT_PATH, // this is set in dockerfile to fix ghostscript error on deploy + }); log.info('printPdf :: compression completed for applicationId', req.params.applicationId); const payload = await postPdf(req, compressedPdfBuffer); @@ -537,7 +535,7 @@ function getCurrentDateForPdfFileName() { function getFacilityInMap(map, facilityId) { let facility = map.get(facilityId); if (!facility) { - facility = {facilityId: facilityId}; + facility = { facilityId: facilityId }; map.set(facilityId, facility); } return facility; @@ -549,22 +547,25 @@ async function updateStatusForApplicationComponents(req, res) { try { if (request.organizationId && request.isOrganizationComplete !== null && request.isOrganizationComplete !== undefined) { let organizationReq = { - isOrganizationComplete: request.isOrganizationComplete + isOrganizationComplete: request.isOrganizationComplete, }; - organizationReq = (new MappableObjectForBack(organizationReq, OrganizationMappings)).toJSON(); + organizationReq = new MappableObjectForBack(organizationReq, OrganizationMappings).toJSON(); promises.push(patchOperationWithObjectId('accounts', request.organizationId, organizationReq)); } - if (request.applicationId && ((request.isEceweComplete !== null && request.isEceweComplete !== undefined ) || ( request.isLicenseUploadComplete !== null && request.isLicenseUploadComplete !== undefined))) { + if ( + request.applicationId && + ((request.isEceweComplete !== null && request.isEceweComplete !== undefined) || (request.isLicenseUploadComplete !== null && request.isLicenseUploadComplete !== undefined)) + ) { let applicationReq = { isEceweComplete: request.isEceweComplete, - isLicenseUploadComplete: request.isLicenseUploadComplete + isLicenseUploadComplete: request.isLicenseUploadComplete, }; if (request.changeRequestId) { - applicationReq = (new MappableObjectForBack(applicationReq, ChangeRequestMappings)).toJSON(); + applicationReq = new MappableObjectForBack(applicationReq, ChangeRequestMappings).toJSON(); promises.push(patchOperationWithObjectId('ccof_change_requests', request.changeRequestId, applicationReq)); } else { - applicationReq = (new MappableObjectForBack(applicationReq, ECEWEApplicationMappings)).toJSON(); + applicationReq = new MappableObjectForBack(applicationReq, ECEWEApplicationMappings).toJSON(); promises.push(patchOperationWithObjectId('ccof_applications', req.params.applicationId, applicationReq)); } } @@ -572,9 +573,9 @@ async function updateStatusForApplicationComponents(req, res) { for (let facility of request.facilities) { if (facility.facilityId && facility.isFacilityComplete !== null && facility.isFacilityComplete !== undefined) { let facilityReq = { - isFacilityComplete: facility.isFacilityComplete + isFacilityComplete: facility.isFacilityComplete, }; - facilityReq = (new MappableObjectForBack(facilityReq, OrganizationFacilityMappings)).toJSON(); + facilityReq = new MappableObjectForBack(facilityReq, OrganizationFacilityMappings).toJSON(); promises.push(patchOperationWithObjectId('accounts', facility.facilityId, facilityReq)); } } @@ -583,22 +584,27 @@ async function updateStatusForApplicationComponents(req, res) { for (let funding of request.fundings) { if (funding.basefundingId && funding.isCCOFComplete !== null && funding.isCCOFComplete !== undefined) { let ccofBaseFundingReq = { - isCCOFComplete: funding.isCCOFComplete + isCCOFComplete: funding.isCCOFComplete, }; - ccofBaseFundingReq = (new MappableObjectForBack(ccofBaseFundingReq, CCOFApplicationFundingMapping)).toJSON(); + ccofBaseFundingReq = new MappableObjectForBack(ccofBaseFundingReq, CCOFApplicationFundingMapping).toJSON(); promises.push(patchOperationWithObjectId('ccof_application_basefundings', funding.basefundingId, ccofBaseFundingReq)); } } } if (request.ccfris) { for (let ccfri of request.ccfris) { - if (ccfri.ccfriId && ((ccfri.isCCFRIComplete !== null && ccfri.isCCFRIComplete !== undefined) || (ccfri.isNmfComplete !== null && ccfri.isNmfComplete !== undefined) || (ccfri.isRfiComplete !== null && ccfri.isRfiComplete !== undefined))) { + if ( + ccfri.ccfriId && + ((ccfri.isCCFRIComplete !== null && ccfri.isCCFRIComplete !== undefined) || + (ccfri.isNmfComplete !== null && ccfri.isNmfComplete !== undefined) || + (ccfri.isRfiComplete !== null && ccfri.isRfiComplete !== undefined)) + ) { let ccfriApplicationReq = { isCCFRIComplete: ccfri.isCCFRIComplete, isNmfComplete: ccfri.isNmfComplete, - isRfiComplete: ccfri.isRfiComplete + isRfiComplete: ccfri.isRfiComplete, }; - ccfriApplicationReq = (new MappableObjectForBack(ccfriApplicationReq, UserProfileCCFRIMappings)).toJSON(); + ccfriApplicationReq = new MappableObjectForBack(ccfriApplicationReq, UserProfileCCFRIMappings).toJSON(); promises.push(await patchOperationWithObjectId('ccof_applicationccfris', ccfri.ccfriId, ccfriApplicationReq)); } } @@ -608,15 +614,16 @@ async function updateStatusForApplicationComponents(req, res) { result.status === 'rejected' ? console.error(result.reason) : console.info(result.value); } return res.sendStatus(HttpStatus.OK); - }catch (e){ + } catch (e) { return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); } } - async function getApplicationSummary(req, res) { try { - let 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_application_basefunding_Application`; + let 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_application_basefunding_Application`; let results = await getOperation(operation); let applicationSummary = new MappableObjectForFront(results, ApplicationSummaryMappings).data; @@ -628,19 +635,19 @@ async function getApplicationSummary(req, res) { //setup the Facility map const facilityMap = new Map(); //map CCFRI - results.ccof_applicationccfri_Application_ccof_ap?.forEach(ccfri => { + results.ccof_applicationccfri_Application_ccof_ap?.forEach((ccfri) => { const mappedCCFRI = new MappableObjectForFront(ccfri, ApplicationSummaryCcfriMappings).data; getFacilityInMap(facilityMap, mappedCCFRI.facilityId).ccfri = mappedCCFRI; }); //map ECE-WE - results.ccof_ccof_application_ccof_applicationecewe_application?.forEach(ecewe => { + results.ccof_ccof_application_ccof_applicationecewe_application?.forEach((ecewe) => { const mappedEcewe = new MappableObjectForFront(ecewe, ECEWEFacilityMappings).data; getFacilityInMap(facilityMap, mappedEcewe.facilityId).ecewe = mappedEcewe; }); //map CCOF Base funding if it exists - results.ccof_application_basefunding_Application?.forEach(baseFunding => { + results.ccof_application_basefunding_Application?.forEach((baseFunding) => { const mappedBaseFunding = mapFundingObjectForFront(baseFunding); getFacilityInMap(facilityMap, mappedBaseFunding.facilityId).funding = mappedBaseFunding; }); @@ -648,10 +655,10 @@ 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); if (allChangeRequests.length > 0) { - allChangeRequests.forEach(changeRequest => { + allChangeRequests.forEach((changeRequest) => { changeRequest.changeActions.forEach((changeAction) => { - if (changeAction.changeType == "NEW_FACILITY"){ - changeAction.facilities.forEach(newFac => { + if (changeAction.changeType == 'NEW_FACILITY') { + changeAction.facilities.forEach((newFac) => { getFacilityInMap(facilityMap, newFac.facilityId).changeRequestId = changeAction.changeRequestId; }); } @@ -661,7 +668,7 @@ async function getApplicationSummary(req, res) { return res.status(HttpStatus.OK).json({ application: applicationSummary, - facilities: Array.from(facilityMap.values()) + facilities: Array.from(facilityMap.values()), }); } catch (e) { log.error('An error occurred while getting getApplicationSummary', e); @@ -684,14 +691,14 @@ function checkKey(key, obj) { return false; } -async function getFacilityChangeData(changeActionId){ +async function getFacilityChangeData(changeActionId) { let 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); log.info(newFacData, 'new fac data before mapping'); - newFacData.value.forEach(fac => { + newFacData.value.forEach((fac) => { if (fac.ccof_facility) { let mappedFacility = new MappableObjectForFront(fac, NewFacilityMappings).toJSON(); mappedFacility.facilityName = fac.ccof_facility['name']; @@ -705,25 +712,23 @@ async function getFacilityChangeData(changeActionId){ } async function getMTFIChangeData(changeActionId) { - let mtfi = await getChangeActionDetails(changeActionId, 'ccof_change_request_mtfis', MtfiMappings, 'ccof_CCFRI', UserProfileBaseCCFRIMappings ); - mtfi?.forEach(item => { + let 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'); }); return mtfi; } //and Microsoft.Dynamics.CRM.In(PropertyName='_ccof_application_value',PropertyValues=[${applicationId}])); -async function getChangeRequestsFromApplicationId(applicationIds){ - +async function getChangeRequestsFromApplicationId(applicationIds) { let str = '['; - const regex = new RegExp('([^,]+)' , 'g'); + const regex = new RegExp('([^,]+)', 'g'); const found = applicationIds.match(regex); found.forEach((app, index) => { str = str + `'${app}'`; - if (index != found.length -1 ){ + if (index != found.length - 1) { str = str + ','; - } - else{ + } else { str = str + ']'; } }); @@ -731,7 +736,9 @@ async function getChangeRequestsFromApplicationId(applicationIds){ log.info(str); try { - let 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=(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; @@ -742,25 +749,27 @@ async function getChangeRequestsFromApplicationId(applicationIds){ let payload = []; //log.verbose(changeRequests); - await Promise.all(changeRequests.map(async (request) => { - - let 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(request.ccof_change_action_change_request.map(async (changeAction) => { - let mappedChangeAction = new MappableObjectForFront(changeAction, ChangeActionRequestMappings).toJSON(); - if (mappedChangeAction.changeType === CHANGE_REQUEST_TYPES.NEW_FACILITY) { - mappedChangeAction = {...mappedChangeAction, facilities: await getFacilityChangeData(mappedChangeAction.changeActionId)}; - } - else if (mappedChangeAction.changeType === CHANGE_REQUEST_TYPES.PARENT_FEE_CHANGE) { - mappedChangeAction = {...mappedChangeAction, mtfiFacilities: await getMTFIChangeData(mappedChangeAction.changeActionId)}; - } - mappedChangeAction.changeType = getLabelFromValue(mappedChangeAction.changeType, CHANGE_REQUEST_TYPES); - return mappedChangeAction; - })); + await Promise.all( + changeRequests.map(async (request) => { + let 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( + request.ccof_change_action_change_request.map(async (changeAction) => { + let mappedChangeAction = new MappableObjectForFront(changeAction, ChangeActionRequestMappings).toJSON(); + if (mappedChangeAction.changeType === CHANGE_REQUEST_TYPES.NEW_FACILITY) { + mappedChangeAction = { ...mappedChangeAction, facilities: await getFacilityChangeData(mappedChangeAction.changeActionId) }; + } else if (mappedChangeAction.changeType === CHANGE_REQUEST_TYPES.PARENT_FEE_CHANGE) { + mappedChangeAction = { ...mappedChangeAction, mtfiFacilities: await getMTFIChangeData(mappedChangeAction.changeActionId) }; + } + mappedChangeAction.changeType = getLabelFromValue(mappedChangeAction.changeType, CHANGE_REQUEST_TYPES); + return mappedChangeAction; + }), + ); - payload.push(req); - })); + payload.push(req); + }), + ); //log.info('final payload', payload); return payload; @@ -768,10 +777,9 @@ async function getChangeRequestsFromApplicationId(applicationIds){ log.error('An error occurred while getting change request', e); throw e; } - } -async function getChangeRequest(req, res){ +async function getChangeRequest(req, res) { try { //pulled the logic out into a seperate function so it can be called from somewhere else const payload = await getChangeRequestsFromApplicationId(req.params.applicationId); @@ -782,19 +790,20 @@ async function getChangeRequest(req, res){ log.error('An error occurred while getting change request', e); return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); } - } -async function deletePcfApplication(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); //loop thru to grab facility ID's and delete all of them - await Promise.all(application['ccof_application_basefunding_Application'].map(async (facility) => { - await deleteOperationWithObjectId('accounts', facility['_ccof_facility_value']); - //log.info(response); - })); + await Promise.all( + application['ccof_application_basefunding_Application'].map(async (facility) => { + await deleteOperationWithObjectId('accounts', facility['_ccof_facility_value']); + //log.info(response); + }), + ); //delete the application await deleteOperationWithObjectId('ccof_applications', req.params.applicationId); @@ -821,8 +830,9 @@ module.exports = { getApplicationSummary, updateStatusForApplicationComponents, getChangeRequest, + getApprovableFeeSchedules, patchCCFRIApplication, deleteCCFRIApplication, printPdf, - deletePcfApplication + deletePcfApplication, }; diff --git a/backend/src/routes/application.js b/backend/src/routes/application.js index 2494df63b..0b9d3d599 100644 --- a/backend/src/routes/application.js +++ b/backend/src/routes/application.js @@ -2,155 +2,201 @@ const express = require('express'); const passport = require('passport'); const router = express.Router(); const auth = require('../components/auth'); -const isValidBackendToken= auth.isValidBackendToken(); -const { deleteRfiApplication, getRFIMedian, getRFIApplication, createRFIApplication, updateRFIApplication} = require('../components/rfiApplication'); +const isValidBackendToken = auth.isValidBackendToken(); +const { deleteRfiApplication, getRFIMedian, getRFIApplication, createRFIApplication, updateRFIApplication } = require('../components/rfiApplication'); const { upsertParentFees, updateCCFRIApplication, deleteCCFRIApplication, renewCCOFApplication, getApplicationSummary, getChangeRequest, deletePcfApplication } = require('../components/application'); -const { patchCCFRIApplication,getECEWEApplication, updateECEWEApplication, updateECEWEFacilityApplication, getCCFRIApplication, getDeclaration, submitApplication,updateStatusForApplicationComponents} = require('../components/application'); +const { + patchCCFRIApplication, + getECEWEApplication, + updateECEWEApplication, + updateECEWEFacilityApplication, + getApprovableFeeSchedules, + getCCFRIApplication, + getDeclaration, + submitApplication, + updateStatusForApplicationComponents, +} = require('../components/application'); const { getNMFApplication, updateNMFApplication, createNMFApplication } = require('../components/nmfApplication'); const { param, validationResult } = require('express-validator'); -router.post('/renew-ccof', passport.authenticate('jwt', {session: false}),isValidBackendToken, [], (req, res) => { +router.post('/renew-ccof', passport.authenticate('jwt', { session: false }), isValidBackendToken, [], (req, res) => { return renewCCOFApplication(req, res); }); /* CREATE or UPDATE an existing CCFRI application for opt-in and out CCOF application guid and facility guid are defined in the payload */ -router.get('/ccfri/:ccfriId', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('ccfriId', 'URL param: [ccfriId] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return getCCFRIApplication(req, res); - }); +router.get('/ccfri/:ccfriId', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return getCCFRIApplication(req, res); +}); -router.get('/ccfri/:ccfriId/rfi', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('ccfriId', 'URL param: [ccfriId] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return getRFIApplication(req, res); - }); +router.get('/ccfri/:ccfriId/afs', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return getApprovableFeeSchedules(req, res); +}); -router.post('/ccfri/:ccfriId/rfi', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('ccfriId', 'URL param: [ccfriId] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return createRFIApplication(req, res); - }); +router.get('/ccfri/:ccfriId/rfi', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return getRFIApplication(req, res); +}); -router.put('/ccfri/rfi/:rfipfiid', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('rfipfiid', 'URL param: [rfipfiid] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return updateRFIApplication(req, res); - }); +router.post('/ccfri/:ccfriId/rfi', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return createRFIApplication(req, res); +}); -router.get('/ccfri/:ccfriId/median', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('ccfriId', 'URL param: [ccfriId] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return getRFIMedian(req, res); - }); +router.put('/ccfri/rfi/:rfipfiid', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('rfipfiid', 'URL param: [rfipfiid] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return updateRFIApplication(req, res); +}); -router.delete('/ccfri/:ccfriId/rfi', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('ccfriId', 'URL param: [ccfriId] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return deleteRfiApplication(req, res); - }); +router.get('/ccfri/:ccfriId/median', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return getRFIMedian(req, res); +}); -router.patch('/ccfri', passport.authenticate('jwt', {session: false}),isValidBackendToken, [], (req, res) => { +router.delete('/ccfri/:ccfriId/rfi', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return deleteRfiApplication(req, res); +}); + +router.patch('/ccfri', passport.authenticate('jwt', { session: false }), isValidBackendToken, [], (req, res) => { //validationResult(req).throw(); - //console.log(req.bpdy); return updateCCFRIApplication(req, res); }); -router.patch('/ccfri/:ccfriId/', passport.authenticate('jwt', {session: false}),isValidBackendToken, [], (req, res) => { +router.patch('/ccfri/:ccfriId/', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { //validationResult(req).throw(); return patchCCFRIApplication(req, res); }); -router.delete('/ccfri/:ccfriId/', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('ccfriId', 'URL param: [ccfriId] is required').not().isEmpty()], (req, res) => { - return deleteCCFRIApplication(req, res); +router.delete('/ccfri/:ccfriId/', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + return deleteCCFRIApplication(req, res); }); -router.get('/ccfri/:ccfriId/nmf', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('ccfriId', 'URL param: [ccfriId] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return getNMFApplication(req, res); - }); +router.get('/ccfri/:ccfriId/nmf', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return getNMFApplication(req, res); +}); -router.post('/ccfri/:ccfriId/nmf', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('ccfriId', 'URL param: [ccfriId] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return createNMFApplication(req, res); - }); +router.post('/ccfri/:ccfriId/nmf', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('ccfriId', 'URL param: [ccfriId] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return createNMFApplication(req, res); +}); -router.put('/ccfri/nmf/:nmfpfiid', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('nmfpfiid', 'URL param: [nmfpfiid] is required').not().isEmpty()], (req, res) => { - validationResult(req).throw(); - return updateNMFApplication(req, res); - }); +router.put('/ccfri/nmf/:nmfpfiid', passport.authenticate('jwt', { session: false }), isValidBackendToken, [param('nmfpfiid', 'URL param: [nmfpfiid] is required').notEmpty().isUUID()], (req, res) => { + validationResult(req).throw(); + return updateNMFApplication(req, res); +}); /* CREATE or UPDATE parent fees for a specified age group and year. age group and year are defined in the payload */ -router.patch('/parentfee', passport.authenticate('jwt', {session: false}),isValidBackendToken, [], (req, res) => { +router.patch('/parentfee', passport.authenticate('jwt', { session: false }), isValidBackendToken, [], (req, res) => { //validationResult(req).throw(); - //console.log(req.bpdy); return upsertParentFees(req, res); }); - /* Retrieve an ECEWE application for an application id. */ -router.get('/ecewe/:applicationId', passport.authenticate('jwt', {session: false}),isValidBackendToken, (req, res) => { - return getECEWEApplication(req, res); -}); +router.get( + '/ecewe/:applicationId', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { + return getECEWEApplication(req, res); + }, +); /* Update an ECEWE applciation for an application id. */ -router.patch('/ecewe/:applicationId', passport.authenticate('jwt', {session: false}),isValidBackendToken, [ - param('applicationId', 'URL param: [applicationId] is required').not().isEmpty()], (req, res) => { - return updateECEWEApplication(req, res); -}); +router.patch( + '/ecewe/:applicationId', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { + return updateECEWEApplication(req, res); + }, +); /* Update an ECEWE facility applciation for an ecewe application id. */ -router.post('/ecewe/facilities/:applicationId', passport.authenticate('jwt', {session: false}),isValidBackendToken, [ - param('applicationId', 'URL param: [applicationId] is required').not().isEmpty()], (req, res) => { - return updateECEWEFacilityApplication(req, res); -}); +router.post( + '/ecewe/facilities/:applicationId', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { + return updateECEWEFacilityApplication(req, res); + }, +); /* Get the user declaration for a given application id. */ -router.get('/declaration/:applicationId', passport.authenticate('jwt', {session: false}),isValidBackendToken, (req, res) => { - return getDeclaration(req, res); -}); +router.get( + '/declaration/:applicationId', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { + return getDeclaration(req, res); + }, +); /* Update Declaration for an CCOF/CCFRI/ECEWE application given an application id. */ -router.patch('/declaration/submit/:applicationId', passport.authenticate('jwt', {session: false}),isValidBackendToken, [ - param('applicationId', 'URL param: [applicationId] is required').not().isEmpty()], (req, res) => { - return submitApplication(req, res); -}); +router.patch( + '/declaration/submit/:applicationId', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { + return submitApplication(req, res); + }, +); /* Get the full summary of the application */ -router.get('/summary/:applicationId', passport.authenticate('jwt', {session: false}),isValidBackendToken, [ - param('applicationId', 'URL param: [applicationId] is required').not().isEmpty()], (req, res) => { - return getApplicationSummary(req, res); -}); - -router.put('/status/:applicationId', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('applicationId', 'URL param: [applicationId] is required').not().isEmpty()], (req, res) => { +router.get( + '/summary/:applicationId', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { + return getApplicationSummary(req, res); + }, +); + +router.put( + '/status/:applicationId', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { validationResult(req).throw(); return updateStatusForApplicationComponents(req, res); - }); + }, +); /* Get existing change requests for an application */ -router.get('/changeRequest/:applicationId', passport.authenticate('jwt', {session: false}),isValidBackendToken, [ - param('applicationId', 'URL param: [applicationId] is required').not().isEmpty()], (req, res) => { - return getChangeRequest(req, res); -}); - +router.get( + '/changeRequest/:applicationId', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { + return getChangeRequest(req, res); + }, +); /* DELETE an existing PCF -- new PCF ONLY */ -router.delete('/:applicationId/', passport.authenticate('jwt', {session: false}),isValidBackendToken, - [param('applicationId', 'URL param: [applicationId] is required').not().isEmpty()], (req, res) => { +router.delete( + '/:applicationId/', + passport.authenticate('jwt', { session: false }), + isValidBackendToken, + [param('applicationId', 'URL param: [applicationId] is required').notEmpty().isUUID()], + (req, res) => { return deletePcfApplication(req, res); - }); - + }, +); module.exports = router; - diff --git a/backend/src/util/mapping/Mappings.js b/backend/src/util/mapping/Mappings.js index 6da3d2fc2..473e7c3ae 100644 --- a/backend/src/util/mapping/Mappings.js +++ b/backend/src/util/mapping/Mappings.js @@ -14,12 +14,12 @@ const OrganizationMappings = [ { back: 'telephone1', front: 'phone' }, // { back: 'businessBCeID', front: 'businessId'}, { back: 'emailaddress1', front: 'email' }, - { back: 'ccof_instructionnumber', front: 'incNumber' },//incorporation number + { back: 'ccof_instructionnumber', front: 'incNumber' }, //incorporation number { back: 'ccof_typeoforganization', front: 'organizationType' }, // { back: 'ccof_typeoforganization@OData.Community.Display.V1.FormattedValue', front: 'organizationTypeDesc' }, { back: 'ccof_formcomplete', front: 'isOrganizationComplete' }, - { back: 'ccof_is_mailing_address_same', front: 'isSameAsMailing'}, - { back: 'ccof_is_mailing_address_same', front: 'isSameAsMailing'}, + { back: 'ccof_is_mailing_address_same', front: 'isSameAsMailing' }, + { back: 'ccof_is_mailing_address_same', front: 'isSameAsMailing' }, { back: 'ccof_providername', front: 'nameOfCareProvider' }, // { back: 'QQQQQQQQ', front: 'nameOfCareProvider' }, // { back: 'QQQQQQQQ', front: 'facilityName' }, @@ -50,95 +50,95 @@ const FacilityMappings = [ const CCFRIFacilityMappings = [ { back: '_ccof_facility_value', front: 'facilityId' }, { back: 'ccof_ccfrioptin', front: 'ccfriOptInStatus' }, - { back: 'ccof_informationccfri', front: 'ccfriApplicationNotes'}, + { back: 'ccof_informationccfri', front: 'ccfriApplicationNotes' }, { back: '_ccof_previousccfri_value', front: 'previousCcfriId' }, { back: 'ccof_formcomplete', front: 'ccof_formcomplete' }, { back: 'ccof_feecorrectccfri', front: 'existingFeesCorrect' }, { back: 'ccof_chargefeeccfri', front: 'hasClosureFees' }, { back: 'ccof_applicationccfriid', front: 'ccfriApplicationId' }, - { back: 'ccof_unlock_rfi', front: 'unlockRfi'}, + { back: 'ccof_unlock_rfi', front: 'unlockRfi' }, // XXXXXXXXXXXXX: 'licenseEffectiveDate', // XXXXXXXXXXXXX: 'hasReceivedFunding', ]; const RFIApplicationMappings = [ - { back: 'ccof_isthereanythingelseaboutyourchangeinhours', front: 'notes2'}, // "is there anything else about your change in hours", - { back: 'ccof_rfipfiid', front: 'rfiId'}, // "df27e229-0b88-ed11-81ac-000d3af48db8", + { back: 'ccof_isthereanythingelseaboutyourchangeinhours', front: 'notes2' }, // "is there anything else about your change in hours", + { back: 'ccof_rfipfiid', front: 'rfiId' }, // "df27e229-0b88-ed11-81ac-000d3af48db8", { back: 'ccof_feeincreasedduetoaincreasedconnection', front: 'IndigenousConnection' }, // 1 or 0 { back: 'ccof_appliedforanyothersources', front: 'q3' }, // 1 or 0 - { back: 'ccof_howwillyourfeeincreasecontributetotheover', front: 'orgsustainability'}, // "how will your fee increase contribute to the overall?", + { back: 'ccof_howwillyourfeeincreasecontributetotheover', front: 'orgsustainability' }, // "how will your fee increase contribute to the overall?", { back: 'ccof_feeincreasedduetoaincreaseinhoursdays', front: 'feeIncreaseExtendedHours' }, // 1 or 0 - { back: 'ccof_describewhetherparentsoutofpocketmonthlyc', front: 'outOfPocketFees'}, // "describe whether parents out of pocket monthly", + { back: 'ccof_describewhetherparentsoutofpocketmonthlyc', front: 'outOfPocketFees' }, // "describe whether parents out of pocket monthly", { back: 'ccof_meetalloftheabovecriteria', front: 'underservedPop' }, // 1 or 0 { back: 'statuscode', front: 'status' }, // 1 or 0 - { back: 'ccof_feeincreasedduetoanexceptionalcircumstance', front: 'exceptionalCircumstances'}, // 0, - { back: 'ccof_expenseinformation_reasonforincreasedfinancial', front: 'expenseInformationNote'}, // "Please explain why you have incurred or will incur", - { back: 'ccof_serviceexpansiondetails_reasonforincreasedfin', front: 'serviceExpansionDetailsNote'}, - { back: 'ccof_indigenouscommunityexpense_reasonforincreased', front: 'iCEIDetailsNote'}, - { back: 'ccof_name', front: 'xxx3'}, // "RFI-22000025", - { back: 'ccof_pleasedescribehowthemajorityofchildrenyou', front: 'underservedChildCareTypes'}, // "please describe how the majority of children you provide", - { back: '_ccof_applicationccfri_value', front: 'ccfriApplicationId'}, // "1d261039-0e7c-ed11-81ad-000d3af4f277", + { back: 'ccof_feeincreasedduetoanexceptionalcircumstance', front: 'exceptionalCircumstances' }, // 0, + { back: 'ccof_expenseinformation_reasonforincreasedfinancial', front: 'expenseInformationNote' }, // "Please explain why you have incurred or will incur", + { back: 'ccof_serviceexpansiondetails_reasonforincreasedfin', front: 'serviceExpansionDetailsNote' }, + { back: 'ccof_indigenouscommunityexpense_reasonforincreased', front: 'iCEIDetailsNote' }, + { back: 'ccof_name', front: 'xxx3' }, // "RFI-22000025", + { back: 'ccof_pleasedescribehowthemajorityofchildrenyou', front: 'underservedChildCareTypes' }, // "please describe how the majority of children you provide", + { back: '_ccof_applicationccfri_value', front: 'ccfriApplicationId' }, // "1d261039-0e7c-ed11-81ad-000d3af4f277", { back: 'ccof_increasedparentfeesbefore', front: 'xxx6' }, // 1 or 0 - { back: 'ccof_exceptionalcircumstanceoccurwithin6m', front: 'circumstanceOccurWithin6Month'}, // null, + { back: 'ccof_exceptionalcircumstanceoccurwithin6m', front: 'circumstanceOccurWithin6Month' }, // null, //Direct Care Staff Wage Increase { back: 'ccof_feeincreasedduetoawageincrease', front: 'feeIncreaseDueToWage' }, // 1 or 0,//Is your fee increase due to a wage increase for Direct Care Staff? - {back:'ccof_wageincreasecommittedinwriting', front: 'increaseInWriting'}, //Was the wage increase committed to (in writing) before the January 2022 release of the Funding Guidelines? - {back:'ccof_wageincreaestipulatedincollectivebargaining', front: 'isBargainingAgreement'}, //Is the wage increase stipulated in a collective bargaining agreement for unionized staff at the facility? - {back:'ccof_facilitycurrentwagesresultedinlossofdcs', front: 'lossOfCareStaff'},//Has the facility's current wage(s) resulted in loss of Direct Care Staff or an inability to hire sufficient Direct Care Staff? - {back:'ccof_creatingimmediatehealthandsafetyconcerns', front: 'healthAndSafetyConcerns'},//Is this creating immediate health and safety concerns for the facility under the requirements of the Child Care Licensing Regulation (CCLR)? - - { back: 'ccof_facilitysrecruitmentandretentionchallenges', front: 'textbox1'}, - { back: 'ccof_howmanydirectcarestaffhaveleftyourfacility', front: 'textbox2'}, - { back: 'ccof_whathaveyoudonetotrytorecruitstaff', front: 'textbox3'}, - { back: 'ccof_adjustyourhoursdaysofoperation', front: 'textbox4'}, - { back: 'ccof_facilityunabletofillspaces', front: 'textbox5'}, - { back: 'ccof_isthereanythingelseaboutyourexpensesyouw', front: 'textbox6'}, // "is there anything else about your expenses", - - -]; - -const ServiceExpansionDetailsMappings = [//ccof_ccof_rfipfi_ccof_rfipfiserviceexpansiondetail_rfipfi. - { back: 'ccof_facilitysprevioushoursofoperationto', front: 'timeto'}, - { back: 'ccof_facilitysprevioushoursofoperation', front: 'timefrom'}, - { back: 'ccof_facilitysnewhoursofoperation', front: 'newtimefrom'}, + { back: 'ccof_wageincreasecommittedinwriting', front: 'increaseInWriting' }, //Was the wage increase committed to (in writing) before the January 2022 release of the Funding Guidelines? + { back: 'ccof_wageincreaestipulatedincollectivebargaining', front: 'isBargainingAgreement' }, //Is the wage increase stipulated in a collective bargaining agreement for unionized staff at the facility? + { back: 'ccof_facilitycurrentwagesresultedinlossofdcs', front: 'lossOfCareStaff' }, //Has the facility's current wage(s) resulted in loss of Direct Care Staff or an inability to hire sufficient Direct Care Staff? + { back: 'ccof_creatingimmediatehealthandsafetyconcerns', front: 'healthAndSafetyConcerns' }, //Is this creating immediate health and safety concerns for the facility under the requirements of the Child Care Licensing Regulation (CCLR)? + + { back: 'ccof_facilitysrecruitmentandretentionchallenges', front: 'textbox1' }, + { back: 'ccof_howmanydirectcarestaffhaveleftyourfacility', front: 'textbox2' }, + { back: 'ccof_whathaveyoudonetotrytorecruitstaff', front: 'textbox3' }, + { back: 'ccof_adjustyourhoursdaysofoperation', front: 'textbox4' }, + { back: 'ccof_facilityunabletofillspaces', front: 'textbox5' }, + { back: 'ccof_isthereanythingelseaboutyourexpensesyouw', front: 'textbox6' }, // "is there anything else about your expenses", +]; + +const ServiceExpansionDetailsMappings = [ + //ccof_ccof_rfipfi_ccof_rfipfiserviceexpansiondetail_rfipfi. + { back: 'ccof_facilitysprevioushoursofoperationto', front: 'timeto' }, + { back: 'ccof_facilitysprevioushoursofoperation', front: 'timefrom' }, + { back: 'ccof_facilitysnewhoursofoperation', front: 'newtimefrom' }, { back: 'ccof_facilitysnewhoursofoperationto', front: 'newtimeto' }, - { back: 'ccof_paymentfrequencydetails', front: 'frequency'}, - { back: 'ccof_dateofchange', front: 'date'}, - { back: 'ccof_amountofexpense', front: 'expense'}, + { back: 'ccof_paymentfrequencydetails', front: 'frequency' }, + { back: 'ccof_dateofchange', front: 'date' }, + { back: 'ccof_amountofexpense', front: 'expense' }, ]; -const DCSWageIncreaseMappings = [ //ccof_rfi_pfi_dcs_wi_detail_RFI_PFI_Detail - { back: 'ccof_numberofstaff', front: 'staffNumber'}, - { back: 'ccof_dcsrole', front: 'staffRole'}, - { back: 'ccof_wagebeforeincrease', front: 'wageBeforeIncrease'}, - { back: 'ccof_wageafterincrease', front: 'wageAfterIncrease'}, - { back: 'ccof_averagehoursperweek', front: 'averageHours'}, - { back: 'ccof_wageincreasedate', front: 'wageDate'}, +const DCSWageIncreaseMappings = [ + //ccof_rfi_pfi_dcs_wi_detail_RFI_PFI_Detail + { back: 'ccof_numberofstaff', front: 'staffNumber' }, + { back: 'ccof_dcsrole', front: 'staffRole' }, + { back: 'ccof_wagebeforeincrease', front: 'wageBeforeIncrease' }, + { back: 'ccof_wageafterincrease', front: 'wageAfterIncrease' }, + { back: 'ccof_averagehoursperweek', front: 'averageHours' }, + { back: 'ccof_wageincreasedate', front: 'wageDate' }, ]; const ExpenseInformationMappings = [ - { back: 'ccof_expensedescription', front: 'description'}, - { back: 'ccof_dateofexpense', front: 'date'}, - { back: 'ccof_paymentfrequencydetails', front: 'frequency'}, - { back: 'ccof_expenseamountt', front: 'expense'}, + { back: 'ccof_expensedescription', front: 'description' }, + { back: 'ccof_dateofexpense', front: 'date' }, + { back: 'ccof_paymentfrequencydetails', front: 'frequency' }, + { back: 'ccof_expenseamountt', front: 'expense' }, ]; const OtherFundingProgramMappings = [ - { back: 'ccof_name', front: 'fundingProgram'}, - { back: 'ccof_applicationdate', front: 'date'}, - { back: 'ccof_statusofapplication', front: 'status'}, - { back: 'ccof_amountreceived', front: 'amount'}, - { back: 'ccof_expense', front: 'expenses'}, + { back: 'ccof_name', front: 'fundingProgram' }, + { back: 'ccof_applicationdate', front: 'date' }, + { back: 'ccof_statusofapplication', front: 'status' }, + { back: 'ccof_amountreceived', front: 'amount' }, + { back: 'ccof_expense', front: 'expenses' }, ]; const IndigenousExpenseMappings = [ - { back: 'ccof_expensedescription', front: 'description'}, - { back: 'ccof_date', front: 'date'}, - { back: 'ccof_paymentfrequency', front: 'frequency'}, - { back: 'ccof_amount', front: 'expense'}, + { back: 'ccof_expensedescription', front: 'description' }, + { back: 'ccof_date', front: 'date' }, + { back: 'ccof_paymentfrequency', front: 'frequency' }, + { back: 'ccof_amount', front: 'expense' }, ]; const NMFApplicationMappings = [ @@ -171,7 +171,7 @@ const CCOFApplicationMappings = [ { back: '_ccof_programyear_value', front: 'programYearId' }, //guid { back: 'ccof_multiagechildcare', front: 'isMultiAgeChildCare' }, //false, { back: 'ccof_providertype', front: 'providerTypeId' }, //100000000 Group - { back: 'ccof_consent', front: 'hasConsent' }, // 1 + { back: 'ccof_consent', front: 'hasConsent' }, // 1 ]; const CCOFApplicationFundingMapping = [ @@ -207,7 +207,7 @@ const CCOFApplicationFundingMapping = [ { back: 'ccof_preschoolsessionwed', front: 'wednesday' }, { back: 'ccof_preschoolsessionthurs', front: 'thursday' }, { back: 'ccof_preschoolsessionfri', front: 'friday' }, - { back: 'ccof_isthefacilitylocatedonschoolproperty', front: 'isSchoolProperty', }, + { back: 'ccof_isthefacilitylocatedonschoolproperty', front: 'isSchoolProperty' }, { back: 'ccof_beforeschool', front: 'beforeSchool' }, { back: 'ccof_beforekindergarten', front: 'beforeKindergarten' }, { back: 'ccof_afterkindergarten', front: 'afterKindergarten' }, @@ -217,7 +217,6 @@ const CCOFApplicationFundingMapping = [ { back: 'ccof_maxnoofdaysperweekextendedhoursoffered', front: 'maxDaysPerWeekExtended' }, { back: 'ccof_maxnoofweeksperyearextendedhoursoffered', front: 'maxWeeksPerYearExtended' }, - { back: 'ccof_under36months4hoursoflessextendedcc', front: 'extendedChildCareUnder36Months4OrLess' }, { back: 'ccof_30monthtoschoolage4hoursoflessextendedcc', front: 'extendedChildCare36MonthsToSchoolAge4OrLess' }, { back: 'ccof_schoolageonground4hoursoflessextendedcc', front: 'extendedChildCareSchoolAge4OrLess' }, @@ -232,7 +231,6 @@ const CCOFApplicationFundingMapping = [ { back: 'ccof_formcomplete', front: 'isCCOFComplete' }, { back: '_ccof_facility_value', front: 'facilityId' }, { back: 'ccof_application_basefundingid', front: 'ccofBaseFundingId' }, - ]; const ECEWEApplicationMappings = [ @@ -260,10 +258,11 @@ const UserProfileOrganizationMappings = [ { back: 'organization_accountid', front: 'organizationId' }, { back: 'organization_ccof_formcomplete', front: 'isOrganizationComplete' }, { back: 'organization_accountnumber', front: 'organizationAccountNumber' }, - { back: 'organization_ccof_fundingagreementnumber', front: 'fundingAgreementNumber' } + { back: 'organization_ccof_fundingagreementnumber', front: 'fundingAgreementNumber' }, ]; -const UserProfileApplicationMappings = [ //application +const UserProfileApplicationMappings = [ + //application { back: 'ccof_applicationid', front: 'applicationId' }, { back: 'statuscode', front: 'applicationStatus' }, { back: 'ccof_providertype', front: 'organizationProviderType' }, // group or family @@ -283,9 +282,8 @@ const UserProfileFacilityMappings = [ { back: 'name', front: 'facilityName' }, { back: 'accountnumber', front: 'facilityAccountNumber' }, { back: 'ccof_formcomplete', front: 'isFacilityComplete' }, - { back: 'ccof_facilitylicencenumber', front: 'licenseNumber'}, - { back: 'ccof_facilitystatus_formatted', front: 'facilityStatus'}, - + { back: 'ccof_facilitylicencenumber', front: 'licenseNumber' }, + { back: 'ccof_facilitystatus_formatted', front: 'facilityStatus' }, ]; const UserProfileBaseFundingMappings = [ //base funding @@ -300,7 +298,7 @@ const OrganizationFacilityMappings = [ { back: 'name', front: 'facilityName' }, { back: 'accountnumber', front: 'facilityAccountNumber' }, { back: 'ccof_formcomplete', front: 'isFacilityComplete' }, - { back: 'ccof_facilitylicencenumber', front: 'licenseNumber'}, + { back: 'ccof_facilitylicencenumber', front: 'licenseNumber' }, ]; const UserProfileBaseCCFRIMappings = [ @@ -309,17 +307,19 @@ const UserProfileBaseCCFRIMappings = [ { back: 'ccof_applicationccfriid', front: 'ccfriApplicationId' }, { back: '_ccof_facility_value', front: 'ccfriFacilityId' }, { back: 'ccof_formcomplete', front: 'isCCFRIComplete' }, - { back: 'ccof_has_nmf', front: 'hasNmf'}, - { back: 'ccof_has_rfi', front: 'hasRfi'}, - { back: 'ccof_nmf_formcomplete', front: 'isNmfComplete'}, - { back: 'ccof_rfi_formcomplete', front: 'isRfiComplete'}, + { back: 'ccof_has_nmf', front: 'hasNmf' }, + { back: 'ccof_has_rfi', front: 'hasRfi' }, + { back: 'ccof_nmf_formcomplete', front: 'isNmfComplete' }, + { back: 'ccof_rfi_formcomplete', front: 'isRfiComplete' }, ]; const UserProfileCCFRIMappings = [ - { back: 'ccof_unlock_rfi', front: 'unlockRfi'}, - { back: 'ccof_unlock_ccfri', front: 'unlockCcfri'}, - { back: 'ccof_unlock_nmf_rfi', front: 'unlockNmf'}, - ...UserProfileBaseCCFRIMappings + { back: 'ccof_unlock_rfi', front: 'unlockRfi' }, + { back: 'ccof_unlock_ccfri', front: 'unlockCcfri' }, + { back: 'ccof_unlock_nmf_rfi', front: 'unlockNmf' }, + { back: 'ccof_unlock_afs', front: 'unlockAfs' }, + { back: 'ccof_unlock_afsenable', front: 'enableAfs' }, + ...UserProfileBaseCCFRIMappings, ]; const UserProfileECEWEMappings = [ { back: 'statuscode', front: 'eceweStatus' }, @@ -352,7 +352,7 @@ const ProgramYearMappings = [ const MessageMappings = [ { back: 'activityid', front: 'messageId' }, { back: 'createdon', front: 'dateReceived' }, - { back: 'ccof_program_year', front: 'programYearValue'}, + { back: 'ccof_program_year', front: 'programYearValue' }, { back: 'description', front: 'messageContent' }, { back: 'lastopenedtime', front: 'lastOpenedTime' }, { back: 'subject', front: 'subject' }, @@ -371,14 +371,14 @@ const DeclarationMappings = [ { back: 'ccof_unlock_supportingdocument', front: 'unlockSupportingDocuments' }, { back: 'ccof_unlock_ccof', front: 'unlockBaseFunding' }, { back: 'ccof_unlock_ecewe', front: 'unlockEcewe' }, - { back: 'facilities', front: 'facilities'} + { back: 'facilities', front: 'facilities' }, ]; const SystemMessagesMappings = [ { back: 'ccof_systemmessageid', front: 'messageID' }, { back: 'ccof_startdate', front: 'startDate' }, { back: 'ccof_enddate', front: 'endDate' }, - { back: 'ccof_message', front: 'message' } + { back: 'ccof_message', front: 'message' }, ]; const ApplicationSummaryMappings = [ @@ -421,35 +421,57 @@ const ApplicationSummaryMappings = [ const ApplicationSummaryCcfriMappings = [ ...CCFRIFacilityMappings, - { back: 'ccof_applicationccfriid', front: 'ccfriId'}, // null, - { back: 'ccof_unlock_ccfri', front: 'unlockCcfri'}, // null, - { back: 'ccof_has_nmf', front: 'hasNmf'}, // false, - { back: 'ccof_unlock_nmf_rfi', front: 'unlockNmf'}, // null, - { back: 'ccof_nmf_formcomplete', front: 'isNmfComplete'}, // false, - { back: 'ccof_has_rfi', front: 'hasRfi'}, // false, - { back: 'ccof_unlock_rfi', front: 'unlockRfi'}, // null, - { back: 'ccof_rfi_formcomplete', front: 'isRfiComplete'}, // false, + { back: 'ccof_applicationccfriid', front: 'ccfriId' }, // null, + { back: 'ccof_unlock_ccfri', front: 'unlockCcfri' }, // null, + { back: 'ccof_has_nmf', front: 'hasNmf' }, // false, + { back: 'ccof_unlock_nmf_rfi', front: 'unlockNmf' }, // null, + { back: 'ccof_nmf_formcomplete', front: 'isNmfComplete' }, // false, + { back: 'ccof_has_rfi', front: 'hasRfi' }, // false, + { back: 'ccof_unlock_rfi', front: 'unlockRfi' }, // null, + { back: 'ccof_rfi_formcomplete', front: 'isRfiComplete' }, // false, + { back: 'ccof_afs_status', front: 'afsStatus' }, + { back: 'ccof_afs_applicationccfri', front: 'approvableFeeSchedules' }, +]; + +const CCFRIApprovableFeeSchedulesMappings = [ + { back: 'ccof_approvable_fee_scheduleid', front: 'approvableFeeScheduleId' }, + { back: '_ccof_program_year_value', front: 'programYearId' }, + { back: '_ccof_applicationccfri_value', front: 'ccfriId' }, + { back: 'ccof_frequency', front: 'feeFrequency' }, + { back: '_ccof_category_value', front: 'childCareCategoryId' }, + { back: 'ccof_apr', front: 'approvedFeeApr' }, + { back: 'ccof_may', front: 'approvedFeeMay' }, + { back: 'ccof_jun', front: 'approvedFeeJun' }, + { back: 'ccof_jul', front: 'approvedFeeJul' }, + { back: 'ccof_aug', front: 'approvedFeeAug' }, + { back: 'ccof_sep', front: 'approvedFeeSep' }, + { back: 'ccof_oct', front: 'approvedFeeOct' }, + { back: 'ccof_nov', front: 'approvedFeeNov' }, + { back: 'ccof_dec', front: 'approvedFeeDec' }, + { back: 'ccof_jan', front: 'approvedFeeJan' }, + { back: 'ccof_feb', front: 'approvedFeeFeb' }, + { back: 'ccof_mar', front: 'approvedFeeMar' }, ]; //DONT USE THIS below for most change rec things- there is a seperate file for change request mappings const ChangeRequestMappings = [ - { back: 'ccof_change_requestid', front: 'changeRequestId'}, // null, + { back: 'ccof_change_requestid', front: 'changeRequestId' }, // null, //{ back: '', front: ''}, // null, ]; const PdfDocumentMappings = [ - {back: 'annotationid', front: 'annotationId'}, - {back: 'filename', front: 'fileName'}, - {back: 'type', front: 'type'}, - {back: 'submissiondate', front: 'submissionDate'}, - {back: 'fiscalyear', front: 'fiscalYear'}, - {back: 'id', front: 'appId'}, - {back: 'filesize', front: 'fileSize'}, + { back: 'annotationid', front: 'annotationId' }, + { back: 'filename', front: 'fileName' }, + { back: 'type', front: 'type' }, + { back: 'submissiondate', front: 'submissionDate' }, + { back: 'fiscalyear', front: 'fiscalYear' }, + { back: 'id', front: 'appId' }, + { back: 'filesize', front: 'fileSize' }, ]; const fundingAgreementMappings = [ - { back: 'ccof_version', front: 'fundingAgreementOrderNumber'}, // null, - { back: 'ccof_name', front: 'fundingAgreementNumber'}, // null, + { back: 'ccof_version', front: 'fundingAgreementOrderNumber' }, // null, + { back: 'ccof_name', front: 'fundingAgreementNumber' }, // null, ]; module.exports = { @@ -468,6 +490,7 @@ module.exports = { UserProfileECEWEMappings, ProgramYearMappings, MessageMappings, + CCFRIApprovableFeeSchedulesMappings, CCFRIFacilityMappings, CCFRIClosureDateMappings, OrganizationFacilityMappings, @@ -485,5 +508,5 @@ module.exports = { ChangeRequestMappings, UserProfileChangeRequestNewFacilityMappings, PdfDocumentMappings, - fundingAgreementMappings + fundingAgreementMappings, }; diff --git a/frontend/src/components/LandingPage.vue b/frontend/src/components/LandingPage.vue index 9427bd0b9..12280b417 100644 --- a/frontend/src/components/LandingPage.vue +++ b/frontend/src/components/LandingPage.vue @@ -540,7 +540,8 @@ export default { this.unlockSupportingDocuments || this.unlockCCFRIList.length > 0 || this.unlockNMFList.length > 0 || - this.unlockRFIList.length > 0 + this.unlockRFIList.length > 0 || + this.unlockAFSList.length > 0 ); }, unlockCCFRIList() { @@ -564,6 +565,13 @@ export default { }); return unlockList; }, + unlockAFSList() { + const unlockList = []; + this.navBarList?.forEach((facility) => { + if (facility.unlockAfs && facility.enableAfs) unlockList.push(facility.ccfriApplicationId); + }); + return unlockList; + }, isCCOFApproved() { return this.applicationType === 'RENEW' || this.ccofStatus === this.CCOF_STATUS_APPROVED; }, @@ -704,6 +712,9 @@ export default { goToRFI(ccfriApplicationId, programYearId) { this.$router.push(pcfUrlGuid(PATHS.CCFRI_RFI, programYearId, ccfriApplicationId)); }, + goToAFS(ccfriApplicationId, programYearId) { + this.$router.push(pcfUrlGuid(PATHS.CCFRI_AFS, programYearId, ccfriApplicationId)); + }, goToECEWE(programYearId) { this.$router.push(pcfUrl(PATHS.ECEWE_ELIGIBILITY, programYearId)); }, @@ -744,6 +755,7 @@ export default { const unlockCCFRIList = this.getUnlockCCFRIList(facilityList); const unlockRFIList = this.getUnlockRFIList(facilityList); const unlockNMFList = this.getUnlockNMFList(facilityList); + const unlockAFSList = this.getUnlockAFSList(facilityList); if (application?.unlockLicenseUpload) this.goToLicenseUpload(programYearId); else if (application?.unlockBaseFunding && application?.applicationType === 'NEW') this.goToCCOFFunding(programYearId, facilityList); @@ -752,6 +764,7 @@ export default { else if (unlockCCFRIList?.length > 0) this.goToCCFRI(unlockCCFRIList[0], application); else if (unlockNMFList?.length > 0) this.goToNMF(unlockNMFList[0], programYearId); else if (unlockRFIList?.length > 0) this.goToRFI(unlockRFIList[0], programYearId); + else if (unlockAFSList?.length > 0) this.goToAFS(unlockAFSList[0], programYearId); else if (application?.unlockDeclaration) this.goToSummaryDeclaration(programYearId); }, actionRequiredFacilityRoute(ccfriApplicationId) { @@ -762,6 +775,7 @@ export default { if (this.isCCFRIUnlock(ccfriApplicationId, application)) this.goToCCFRI(ccfriApplicationId, application); else if (this.isNMFUnlock(ccfriApplicationId, application)) this.goToNMF(ccfriApplicationId, programYearId); else if (this.isRFIUnlock(ccfriApplicationId, application)) this.goToRFI(ccfriApplicationId, programYearId); + else if (this.isAFSUnlock(ccfriApplicationId, application)) this.goToAFS(ccfriApplicationId, programYearId); }, buttonColor(isDisabled) { return isDisabled ? 'disabledButton' : 'blueButton'; @@ -774,7 +788,8 @@ export default { return ( this.isCCFRIUnlock(ccfriApplicationId, application) || this.isNMFUnlock(ccfriApplicationId, application) || - this.isRFIUnlock(ccfriApplicationId, application) + this.isRFIUnlock(ccfriApplicationId, application) || + this.isAFSUnlock(ccfriApplicationId, application) ); }, isCCFRIUnlock(ccfriApplicationId, application) { @@ -792,6 +807,11 @@ export default { const unlockRFIList = this.getUnlockRFIList(facilityList); return application?.applicationStatus === 'SUBMITTED' && unlockRFIList.includes(ccfriApplicationId); }, + isAFSUnlock(ccfriApplicationId, application) { + const facilityList = this.getFacilityListForPCFByProgramYearId(application?.ccofProgramYearId); + const unlockAFSList = this.getUnlockAFSList(facilityList); + return application?.applicationStatus === 'SUBMITTED' && unlockAFSList?.includes(ccfriApplicationId); + }, getUnlockCCFRIList(facilityList) { let unlockList = []; facilityList?.forEach((facility) => { @@ -813,6 +833,13 @@ export default { }); return unlockList; }, + getUnlockAFSList(facilityList) { + let unlockList = []; + facilityList?.forEach((facility) => { + if (facility.unlockAfs && facility.enableAfs) unlockList.push(facility.ccfriApplicationId); + }); + return unlockList; + }, selectProgramYear(programYear) { this.selectedProgramYear = programYear; }, diff --git a/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue b/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue index ec08add84..59c6797c2 100644 --- a/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue +++ b/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue @@ -1,36 +1,92 @@ + diff --git a/frontend/src/components/ccfriApplication/AFS/ApprovableParentFeesCards.vue b/frontend/src/components/ccfriApplication/AFS/ApprovableParentFeesCards.vue index f2d0f5d81..7903a89a1 100644 --- a/frontend/src/components/ccfriApplication/AFS/ApprovableParentFeesCards.vue +++ b/frontend/src/components/ccfriApplication/AFS/ApprovableParentFeesCards.vue @@ -1,170 +1,92 @@ - diff --git a/frontend/src/components/ccofApplication/family/Eligibility.vue b/frontend/src/components/ccofApplication/family/Eligibility.vue index 706737d7f..ca5673175 100644 --- a/frontend/src/components/ccofApplication/family/Eligibility.vue +++ b/frontend/src/components/ccofApplication/family/Eligibility.vue @@ -100,6 +100,12 @@ export default { name: 'EligibilityComponent', components: { AppDateInput }, mixins: [facilityMixin], + async beforeRouteLeave(_to, _from, next) { + if (!this.isModelEmpty) { + await this.save(false); + } + next(); + }, data() { return { providerType: ORGANIZATION_PROVIDER_TYPES.FAMILY, diff --git a/frontend/src/components/guiComponents/FacilityHeader.vue b/frontend/src/components/guiComponents/FacilityHeader.vue index fe293b6e7..7481bd979 100644 --- a/frontend/src/components/guiComponents/FacilityHeader.vue +++ b/frontend/src/components/guiComponents/FacilityHeader.vue @@ -14,9 +14,9 @@ export default { name: 'FacilityHeader', props: { - facilityAccountNumber: { type: String, required: true }, - facilityName: { type: String, required: true }, - licenseNumber: { type: String, required: true }, + facilityAccountNumber: { type: String, default: '' }, + facilityName: { type: String, default: '' }, + licenseNumber: { type: String, default: '' }, }, }; diff --git a/frontend/src/components/util/NavBar.vue b/frontend/src/components/util/NavBar.vue index fcc371fe3..86a691ae6 100644 --- a/frontend/src/components/util/NavBar.vue +++ b/frontend/src/components/util/NavBar.vue @@ -568,8 +568,7 @@ export default { navBarId: navBarId++, }); } - if (true) { - // if (item.enableAfs) { + if (item.enableAfs) { items.push({ title: 'Approvable Fee Schedule', subTitle: item.facilityName, @@ -577,7 +576,7 @@ export default { id: item.facilityId, link: { name: 'ccfri-afs', params: { urlGuid: item.ccfriApplicationId } }, isAccessible: true, - icon: this.getCheckbox(item.isAfsComplete), + icon: this.getCheckbox(item.isAfsComplete), // TODO (vietle-cgi) - CCFRI-3756 - work in progress isActive: this.$route.params.urlGuid === item.ccfriApplicationId && 'ccfri-afs' === this.$route.name, position: positionIndex++, navBarId: navBarId++, diff --git a/frontend/src/router.js b/frontend/src/router.js index 5991bc567..bece46188 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -452,7 +452,7 @@ const router = createRouter({ }, }, { - path: pcfUrl(PATHS.CCFRI_AFS), + path: pcfUrlGuid(PATHS.CCFRI_AFS), name: 'ccfri-afs', component: ApprovableFeeSchedule, meta: { diff --git a/frontend/src/store/app.js b/frontend/src/store/app.js index ea0f42602..30fa0cc26 100644 --- a/frontend/src/store/app.js +++ b/frontend/src/store/app.js @@ -134,5 +134,29 @@ export const useAppStore = defineStore('app', { return PROGRAM_YEAR_LANGUAGE_TYPES.FY2024_25; } }, + getProgramYearNameById: (state) => { + return (id) => { + const programYear = state.programYearList?.list?.find((item) => item.programYearId === id); + return programYear?.name; + }; + }, + getProgramYearOrderById: (state) => { + return (id) => { + const programYear = state.programYearList?.list?.find((item) => item.programYearId === id); + return programYear?.order; + }; + }, + getChildCareCategoryNameById: (state) => { + return (id) => { + const childCareCategory = state.childCareCategoryList?.find((item) => item.ccof_childcare_categoryid === id); + return childCareCategory?.ccof_description; + }; + }, + getChildCareCategoryNumberById: (state) => { + return (id) => { + const childCareCategory = state.childCareCategoryList?.find((item) => item.ccof_childcare_categoryid === id); + return childCareCategory?.ccof_childcarecategorynumber; + }; + }, }, }); diff --git a/frontend/src/store/application.js b/frontend/src/store/application.js index 3d10145e9..fe650fccf 100644 --- a/frontend/src/store/application.js +++ b/frontend/src/store/application.js @@ -1,10 +1,10 @@ import { defineStore } from 'pinia'; -import { useAppStore } from './app.js'; -import { useNavBarStore } from './navBar.js'; -import { filterFacilityListForPCF, checkApplicationUnlocked } from '../utils/common.js'; -import ApiService from '../common/apiService.js'; -import { ApiRoutes } from '../utils/constants.js'; +import ApiService from '@/common/apiService.js'; +import { useAppStore } from '@/store/app.js'; +import { useNavBarStore } from '@/store/navBar.js'; +import { checkApplicationUnlocked, filterFacilityListForPCF } from '@/utils/common.js'; +import { ApiRoutes } from '@/utils/constants.js'; export const useApplicationStore = defineStore('application', { state: () => ({ @@ -140,7 +140,7 @@ export const useApplicationStore = defineStore('application', { }, }, getters: { - formattedProgramYear: (state) => state.programYearLabel?.replace(/[^\d/]/g, ''), + formattedProgramYear: (state) => state.programYearLabel?.replace(/[^\d-]/g, ''), fiscalStartAndEndDates: (state) => { //set fiscal year dates to prevent user from choosing dates outside the current FY //ASSUMPTION that fiscal year start / end dates will not move from April / March diff --git a/frontend/src/store/ccfriApp.js b/frontend/src/store/ccfriApp.js index 7832abfd7..e5d087e25 100644 --- a/frontend/src/store/ccfriApp.js +++ b/frontend/src/store/ccfriApp.js @@ -570,5 +570,15 @@ export const useCcfriAppStore = defineStore('ccfriApp', { console.log('error', e); } }, + + async getApprovableFeeSchedules(ccfriId) { + try { + const response = await ApiService.apiAxios.get(`${ApiRoutes.APPLICATION_CCFRI}/${ccfriId}/afs`); + return response?.data; + } catch (e) { + console.log(`Failed to get existing approvable parent fees with error - ${e}`); + throw e; + } + }, }, }); diff --git a/frontend/src/utils/common.js b/frontend/src/utils/common.js index 33983aae9..4c84c3b9a 100644 --- a/frontend/src/utils/common.js +++ b/frontend/src/utils/common.js @@ -1,11 +1,12 @@ 'use strict'; -import { getDateFormatter } from './format.js'; -import { LocalDate } from '@js-joda/core'; import { isPlainObject, sortBy } from 'lodash'; -import { PATHS } from './constants.js'; import useRfdc from 'rfdc'; +import { PATHS } from '@/utils/constants.js'; +import { getDateFormatter } from '@/utils/format.js'; +import { LocalDate } from '@js-joda/core'; + const clone = useRfdc(); export const getLocalDateFromString = (date, pattern = 'uuuu-MM-dd') => { const formatter = getDateFormatter(pattern); @@ -91,6 +92,9 @@ export function checkApplicationUnlocked(application) { facilityList?.findIndex((facility) => isFacilityAvailable(facility) && facility.unlockCcfri) > -1; const isNMFUnlocked = facilityList?.findIndex((facility) => isFacilityAvailable(facility) && facility.unlockNmf) > -1; const isRFIUnlocked = facilityList?.findIndex((facility) => isFacilityAvailable(facility) && facility.unlockRfi) > -1; + const isAFSUnlocked = + facilityList?.findIndex((facility) => isFacilityAvailable(facility) && facility.unlockAfs && facility.enableAfs) > + -1; const isApplicationUnlocked = (application?.unlockBaseFunding && application?.applicationType === 'NEW') || application?.unlockLicenseUpload || @@ -99,7 +103,8 @@ export function checkApplicationUnlocked(application) { application?.unlockDeclaration || isCCFRIUnlocked || isNMFUnlocked || - isRFIUnlocked; + isRFIUnlocked || + isAFSUnlocked; return isApplicationUnlocked; } diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index 1177192a1..20d357968 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -36,6 +36,7 @@ export const ApiRoutes = Object.freeze({ APPLICATION_ECEWE: baseRoot + '/application/ecewe', APPLICATION_ECEWE_FACILITY: baseRoot + '/application/ecewe/facilities', APPLICATION_RENEW: baseRoot + '/application/renew-ccof', + APPLICATION_CCFRI: baseRoot + '/application/ccfri', APPLICATION_RFI: baseRoot + '/application/ccfri', APPLICATION_NMF: baseRoot + '/application/ccfri', APPLICATION_CHANGE_REQUEST: baseRoot + '/application/changeRequest', @@ -270,3 +271,15 @@ export const PROVINCES = Object.freeze([ value: 'YT', }, ]); + +export const AFS_STATUSES = Object.freeze({ + ACCEPT: 1, + UPLOAD_DOCUMENTS: 2, + DECLINE: 3, +}); + +export const PARENT_FEE_FREQUENCIES = Object.freeze({ + MONTHLY: 100000000, + WEEKLY: 100000001, + DAILY: 100000002, +}); From 0b2985268c8aeb71ec2a2f9e7e8e6a4abc4787b8 Mon Sep 17 00:00:00 2001 From: Le Date: Fri, 8 Nov 2024 11:58:16 -0800 Subject: [PATCH 3/9] ccfri-3752, ccfri-3754, ccfri-3813 - bug fix and make the Approvable Fee Schedule to reload when moving to a new CCFRI AFS page --- backend/src/components/application.js | 2 +- backend/src/util/mapping/Mappings.js | 1 - .../ccfriApplication/AFS/ApprovableFeeSchedule.vue | 13 ++++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/backend/src/components/application.js b/backend/src/components/application.js index 476ed8a6f..c63750fa8 100644 --- a/backend/src/components/application.js +++ b/backend/src/components/application.js @@ -155,7 +155,7 @@ async function getApprovableFeeSchedules(req, res) { try { const response = await getOperation(`ccof_applicationccfris(${req.params.ccfriId})?$select=ccof_afs_status&$expand=ccof_afs_applicationccfri`); const afs = new MappableObjectForFront(response, ApplicationSummaryCcfriMappings).toJSON(); - afs.approvableFeeSchedules = afs.approvableFeeSchedules?.map((item) => new MappableObjectForFront(item, CCFRIApprovableFeeSchedulesMappings).toJSON()); + afs.approvableFeeSchedules = response?.ccof_afs_applicationccfri?.map((item) => new MappableObjectForFront(item, CCFRIApprovableFeeSchedulesMappings).toJSON()); return res.status(HttpStatus.OK).json(afs); } catch (e) { log.error('An error occurred while getting CCFRI AFS', e); diff --git a/backend/src/util/mapping/Mappings.js b/backend/src/util/mapping/Mappings.js index 473e7c3ae..c73c74a37 100644 --- a/backend/src/util/mapping/Mappings.js +++ b/backend/src/util/mapping/Mappings.js @@ -430,7 +430,6 @@ const ApplicationSummaryCcfriMappings = [ { back: 'ccof_unlock_rfi', front: 'unlockRfi' }, // null, { back: 'ccof_rfi_formcomplete', front: 'isRfiComplete' }, // false, { back: 'ccof_afs_status', front: 'afsStatus' }, - { back: 'ccof_afs_applicationccfri', front: 'approvableFeeSchedules' }, ]; const CCFRIApprovableFeeSchedulesMappings = [ diff --git a/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue b/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue index 59c6797c2..c880114a4 100644 --- a/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue +++ b/frontend/src/components/ccfriApplication/AFS/ApprovableFeeSchedule.vue @@ -34,7 +34,11 @@ , we can approve the following parent fee schedule: - +
Next steps: