diff --git a/backend/src/components/application.js b/backend/src/components/application.js index 39bd4cd1f..d96e972ee 100644 --- a/backend/src/components/application.js +++ b/backend/src/components/application.js @@ -16,7 +16,8 @@ const { ORGANIZATION_PROVIDER_TYPES, APPLICATION_STATUS_CODES, CCOF_STATUS_CODES, - CHANGE_REQUEST_TYPES + CHANGE_REQUEST_TYPES, + CCFRI_STATUS_CODES } = require('../util/constants'); const HttpStatus = require('http-status-codes'); const log = require('./logger'); @@ -25,6 +26,7 @@ const { ECEWEApplicationMappings, ECEWEFacilityMappings, DeclarationMappings, + UserProfileBaseCCFRIMappings, UserProfileCCFRIMappings, ApplicationSummaryMappings, ApplicationSummaryCcfriMappings, @@ -38,6 +40,7 @@ const {getCCFRIClosureDates} = require('./facility'); const {mapFundingObjectForFront} = require('./funding'); const puppeteer = require('puppeteer'); const {compress} = require('compress-pdf'); +const { getChangeActionDetails } = require('./changeRequest'); const { ChangeRequestMappings, ChangeActionRequestMappings, NewFacilityMappings, MtfiMappings } = require('../util/mapping/ChangeRequestMappings'); @@ -696,13 +699,11 @@ async function getFacilityChangeData(changeActionId){ } async function getMTFIChangeData(changeActionId) { - let mappedData = []; - let operation = `ccof_change_request_mtfis?$filter=_ccof_change_action_value eq ${changeActionId}`; - let response = await getOperation(operation); - response?.value.forEach(fac => { - mappedData.push( new MappableObjectForFront(fac, MtfiMappings).toJSON()); + 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 mappedData; + return mtfi; } async function getChangeRequestsFromApplicationId(applicationId){ diff --git a/backend/src/components/changeRequest.js b/backend/src/components/changeRequest.js index 9d39bd4ee..94b663de0 100644 --- a/backend/src/components/changeRequest.js +++ b/backend/src/components/changeRequest.js @@ -7,7 +7,7 @@ const { UserProfileBaseCCFRIMappings } = require('../util/mapping/Mappings'); const { mapFacilityObjectForBack } = require('./facility'); const { printPdf } = require('./application'); -const { ACCOUNT_TYPE, CCOF_STATUS_CODES, CHANGE_REQUEST_TYPES, CHANGE_REQUEST_EXTERNAL_STATUS_CODES, ORGANIZATION_PROVIDER_TYPES } = require('../util/constants'); +const { ACCOUNT_TYPE, CCOF_STATUS_CODES, CHANGE_REQUEST_TYPES, CHANGE_REQUEST_EXTERNAL_STATUS_CODES, ORGANIZATION_PROVIDER_TYPES, CCFRI_STATUS_CODES } = require('../util/constants'); const HttpStatus = require('http-status-codes'); @@ -69,7 +69,10 @@ async function mapChangeRequestObjectForFront(data) { await Promise.all( retVal.changeActions?.map(async (el) => { let changeAction = new MappableObjectForFront(el, ChangeActionRequestMappings).toJSON(); if (changeAction.changeType == CHANGE_REQUEST_TYPES.PARENT_FEE_CHANGE) { - const mtfi = await getChangeActionDetails(changeAction.changeActionId, 'ccof_change_request_mtfis', MtfiMappings, 'ccof_CCFRI', UserProfileBaseCCFRIMappings ); + let mtfi = await getChangeActionDetails(changeAction.changeActionId, 'ccof_change_request_mtfis', MtfiMappings, 'ccof_CCFRI', UserProfileBaseCCFRIMappings ); + mtfi?.forEach(item => { + item.ccfriStatus = getLabelFromValue(item.ccfriStatus, CCFRI_STATUS_CODES, 'NOT STARTED'); + }); changeAction.mtfi = mtfi; } else if (changeAction.changeType == CHANGE_REQUEST_TYPES.NEW_FACILITY) { const newFacilities = await getChangeActionDetails(changeAction.changeActionId, 'ccof_change_request_new_facilities', NewFacilityMappings); @@ -358,4 +361,5 @@ module.exports = { deleteChangeAction, getChangeRequestMTFIByCcfriId, deleteChangeRequestMTFI, + getChangeActionDetails }; diff --git a/backend/src/util/constants.js b/backend/src/util/constants.js index 7bcdb2eac..e637a83f1 100644 --- a/backend/src/util/constants.js +++ b/backend/src/util/constants.js @@ -87,7 +87,12 @@ const CCFRI_STATUS_CODES = Object.freeze({ SUBMITTED: 1, NOT_APPROVED: 4, INELIGIBLE: 5, - ACTION_REQUIRED: 6 + ACTION_REQUIRED: 6, + 'Opt-Out': 7, + 'New': 8, + 'MTFI Requested': 9, + 'MTFI Approved': 10, + 'MTFI Action Required': 13, }); const ECEWE_STATUS_CODES = Object.freeze({ diff --git a/frontend/src/components/LandingPage.vue b/frontend/src/components/LandingPage.vue index dee682ead..991e187f7 100644 --- a/frontend/src/components/LandingPage.vue +++ b/frontend/src/components/LandingPage.vue @@ -128,7 +128,8 @@ - + +