diff --git a/backend/src/components/application.js b/backend/src/components/application.js index d96e972ee..02d1f27b9 100644 --- a/backend/src/components/application.js +++ b/backend/src/components/application.js @@ -10,6 +10,7 @@ const { updateChangeRequestNewFacility, postApplicationSummaryDocument, postChangeRequestSummaryDocument, + getChangeActionDetails } = require('./utils'); const { CCOF_APPLICATION_TYPES, @@ -40,7 +41,6 @@ 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'); diff --git a/backend/src/components/changeRequest.js b/backend/src/components/changeRequest.js index 94b663de0..ab69e662a 100644 --- a/backend/src/components/changeRequest.js +++ b/backend/src/components/changeRequest.js @@ -360,6 +360,5 @@ module.exports = { updateChangeRequestMTFI, deleteChangeAction, getChangeRequestMTFIByCcfriId, - deleteChangeRequestMTFI, - getChangeActionDetails + deleteChangeRequestMTFI }; diff --git a/backend/src/components/utils.js b/backend/src/components/utils.js index 7fdf55192..dfe41b24b 100644 --- a/backend/src/components/utils.js +++ b/backend/src/components/utils.js @@ -9,6 +9,7 @@ const {ApiError} = require('./error'); const jsonwebtoken = require('jsonwebtoken'); const {LocalDateTime, DateTimeFormatter} = require('@js-joda/core'); const {Locale} = require('@js-joda/locale_en'); +const { MappableObjectForFront, getMappingString } = require('../util/mapping/MappableObject'); let discovery = null; function sleep(ms) { @@ -330,6 +331,36 @@ async function updateChangeRequestNewFacility(changeRequestNewFacilityId, payloa } } +// get Change Action details. depending on the entity, we may want to get details 2 level below change action +async function getChangeActionDetails(changeActionId, changeDetailEntity, changeDetailMapper, joiningTable, joiningTableMapping) { + if (changeActionId && changeDetailEntity && changeDetailMapper) { + try { + let operation; + if (joiningTable) { + operation = `${changeDetailEntity}?$select=${getMappingString(changeDetailMapper)}&$filter=_ccof_change_action_value eq '${changeActionId}'&$expand=${joiningTable}($select=${getMappingString(joiningTableMapping)})`; + } else { + operation = `${changeDetailEntity}?$select=${getMappingString(changeDetailMapper)}&$filter=_ccof_change_action_value eq '${changeActionId}'`; + } + + let changeActionDetails = await getOperation(operation); + let details = changeActionDetails?.value; + let retVal = []; + details?.forEach(el => { + let data = new MappableObjectForFront(el, changeDetailMapper).toJSON(); + let joinData; + if (joiningTable) { + joinData = new MappableObjectForFront(el[joiningTable], joiningTableMapping).toJSON(); + } + retVal.push({...data, ...joinData}); + }); + return retVal; + } catch (e) { + log.error('Unable to get change action details',e); + } + } else { + return undefined; + } +} function getHttpHeader() { let headers = null; @@ -409,7 +440,8 @@ const utils = { postChangeActionDocument, updateChangeRequestNewFacility, postChangeRequestSummaryDocument, - getSubmissionPDFHistory + getSubmissionPDFHistory, + getChangeActionDetails }; module.exports = utils; diff --git a/backend/src/util/mapping/Mappings.js b/backend/src/util/mapping/Mappings.js index 4b6217317..7b4ac8ddb 100644 --- a/backend/src/util/mapping/Mappings.js +++ b/backend/src/util/mapping/Mappings.js @@ -39,7 +39,6 @@ const FacilityMappings = [ { back: 'ccof_formcomplete', front: 'isFacilityComplete' }, { back: 'accountnumber', front: 'facilityAccountNumber' }, { back: '_ccof_change_request_value', front: 'changeRequestId' }, //likely won't stay here - { back: 'ccof_facilitystatus@OData.Community.Display.V1.FormattedValue', front: 'facilityStatus' }, // XXXXXXXXXXXXX: 'licenseEffectiveDate', // XXXXXXXXXXXXX: 'hasReceivedFunding', @@ -54,6 +53,7 @@ const CCFRIFacilityMappings = [ { back: 'ccof_feecorrectccfri', front: 'existingFeesCorrect' }, { back: 'ccof_chargefeeccfri', front: 'hasClosureFees' }, { back: 'ccof_applicationccfriid', front: 'ccfriApplicationId' }, + { back: 'ccof_unlock_rfi', front: 'unlockRfi'}, // XXXXXXXXXXXXX: 'licenseEffectiveDate', // XXXXXXXXXXXXX: 'hasReceivedFunding', diff --git a/frontend/src/components/LandingPage.vue b/frontend/src/components/LandingPage.vue index 991e187f7..64e739cc1 100644 --- a/frontend/src/components/LandingPage.vue +++ b/frontend/src/components/LandingPage.vue @@ -228,7 +228,8 @@ export default { this.isLoadingComplete = false; this.getAllMessagesVuex(); this.refreshNavBarList(); - await this.getChangeRequestList(); + if (this.applicationId) + await this.getChangeRequestList(); this.isLoadingComplete = true; }, computed: { @@ -238,7 +239,7 @@ export default { ...mapState('navBar', ['navBarList']), ...mapState('organization', ['fundingAgreementNumber', 'organizationAccountNumber', 'organizationProviderType', 'organizationId', 'organizationName', 'organizationAccountNumber']), ...mapState('application', ['applicationType', 'programYearId', 'ccofApplicationStatus', 'unlockBaseFunding', - 'unlockDeclaration', 'unlockEcewe', 'unlockLicenseUpload', 'unlockSupportingDocuments', 'applicationStatus']), + 'unlockDeclaration', 'unlockEcewe', 'unlockLicenseUpload', 'unlockSupportingDocuments', 'applicationStatus', 'applicationId']), ...mapState('reportChanges', ['userProfileChangeRequests', 'changeRequestStore']), filteredList() { if (this.input === '' || this.input === ' ' || this.input === null){ diff --git a/frontend/src/components/SummaryDeclaration.vue b/frontend/src/components/SummaryDeclaration.vue index df955b548..b16e95a87 100644 --- a/frontend/src/components/SummaryDeclaration.vue +++ b/frontend/src/components/SummaryDeclaration.vue @@ -122,7 +122,7 @@ + :documents="facility.documents" + :programYearId="summaryModel?.application?.programYearId">
diff --git a/frontend/src/components/ccfriApplication/group/AddNewFees.vue b/frontend/src/components/ccfriApplication/group/AddNewFees.vue index 32467ed64..26c566165 100644 --- a/frontend/src/components/ccfriApplication/group/AddNewFees.vue +++ b/frontend/src/components/ccfriApplication/group/AddNewFees.vue @@ -410,6 +410,7 @@ import alertMixin from '@/mixins/alertMixin'; import globalMixin from '@/mixins/globalMixin'; import { isEqual, cloneDeep } from 'lodash'; import NavButton from '@/components/util/NavButton'; +import ApiService from '@/common/apiService'; export default { components: { NavButton }, @@ -535,9 +536,18 @@ export default { removeIndex(index){ this.CCFRIFacilityModel.dates.splice(index, 1); }, - toRfi() { - this.setNavBarValue({ facilityId: this.currentFacility.facilityId, property: 'hasRfi', value: true}); - this.$router.push(pcfUrlGuid(PATHS.CCFRI_RFI, this.programYearId, this.$route.params.urlGuid)); + async toRfi() { + try { + this.setNavBarValue({ facilityId: this.currentFacility.facilityId, property: 'hasRfi', value: true}); + if (this.currentFacility?.unlockCcfri) { + this.setNavBarValue({ facilityId: this.currentFacility.facilityId, property: 'unlockRfi', value: true}); + await ApiService.apiAxios.patch(`/api/application/ccfri/${this.$route.params.urlGuid}`, {'unlockRfi': 1}); + } + this.$router.push(pcfUrlGuid(PATHS.CCFRI_RFI, this.programYearId, this.$route.params.urlGuid)); + } catch (error) { + console.log(error); + this.setFailureAlert('An error occured while navigating to RFI.'); + } }, previous() { if (this.isReadOnly){ diff --git a/frontend/src/components/mtfi/CurrentFeeVerification.vue b/frontend/src/components/mtfi/CurrentFeeVerification.vue index ef6e2f709..b2308e1bf 100644 --- a/frontend/src/components/mtfi/CurrentFeeVerification.vue +++ b/frontend/src/components/mtfi/CurrentFeeVerification.vue @@ -397,12 +397,13 @@ import { mapState, mapActions, mapGetters, mapMutations} from 'vuex'; -import { PATHS, changeUrlGuid, CHANGE_TYPES, changeUrl } from '@/utils/constants'; +import { PATHS, changeUrlGuid, CHANGE_TYPES, changeUrl, ApiRoutes } from '@/utils/constants'; import alertMixin from '@/mixins/alertMixin'; import globalMixin from '@/mixins/globalMixin'; import NavButton from '@/components/util/NavButton'; import { deepCloneObject } from '../../utils/common'; import { isEqual } from 'lodash'; +import ApiService from '@/common/apiService'; let model = { }; @@ -442,7 +443,7 @@ export default { ...mapState('application', ['applicationStatus', 'formattedProgramYear', 'programYearId', 'applicationId']), ...mapState('app', ['isRenewal', 'ccfriOptInComplete', 'programYearList']), ...mapState('application', ['programYearId']), - ...mapState('navBar', ['navBarList', 'userProfileList']), + ...mapState('navBar', ['navBarList', 'userProfileList', 'changeRequestMap']), ...mapGetters('navBar', ['previousPath', 'nextPath','getNavByCCFRIId']), ...mapGetters('reportChanges',['changeRequestStatus']), areFeesCorrect() { @@ -589,9 +590,28 @@ export default { isFormComplete(){ return this.isValidForm; //false makes button clickable, true disables button }, - toRfi() { - this.setNavBarValue({ facilityId: this.currentFacility.facilityId, property: 'hasRfi', value: true}); - this.$router.push(changeUrlGuid(PATHS.CCFRI_RFI, this.$route.params.changeRecGuid, this.$route.params.urlGuid, CHANGE_TYPES.MTFI)); + getMtfiFacility(facilityId) { + let mtfiFacility; + const changeRequest = this.changeRequestMap?.get(this.$route.params.changeRecGuid); + if (changeRequest?.changeActions?.length > 0) { + const mtfiDetails = changeRequest?.changeActions[0].mtfi; + mtfiFacility = mtfiDetails?.find(item => item.facilityId === facilityId); + } + return mtfiFacility; + }, + async toRfi() { + try { + this.setNavBarValue({ facilityId: this.currentFacility.facilityId, property: 'hasRfi', value: true}); + if (this.getCurrentFacility.unlockCcfri) { + this.setNavBarValue({ facilityId: this.currentFacility.facilityId, property: 'unlockRfi', value: true}); + const mtfiFacility = this.getMtfiFacility(this.currentFacility.facilityId); + await ApiService.apiAxios.patch(ApiRoutes.CHANGE_REQUEST + '/mtfi/' + mtfiFacility?.changeRequestMtfiId, {'ccof_unlock_rfi': true}); + } + this.$router.push(changeUrlGuid(PATHS.CCFRI_RFI, this.$route.params.changeRecGuid, this.$route.params.urlGuid, CHANGE_TYPES.MTFI)); + } catch (error) { + console.log(error); + this.setFailureAlert('An error occured while navigating to RFI.'); + } }, async next() { // this.rfi3percentCategories = await this.getCcfriOver3percent(this.currentPcfCcfri); diff --git a/frontend/src/components/summary/group/ECEWESummary.vue b/frontend/src/components/summary/group/ECEWESummary.vue index f89e366b4..4e2869cf1 100644 --- a/frontend/src/components/summary/group/ECEWESummary.vue +++ b/frontend/src/components/summary/group/ECEWESummary.vue @@ -165,12 +165,16 @@ export default { return !!(this.eceweFacility); }, getRoutingPath(){ - if(this.isChangeRequest){ - return changeUrl(PATHS.ECEWE_ELIGIBILITY, this.$route.params?.changeRecGuid); + if (this.isChangeRequest) { + if (!this.eceweFacility) { + return changeUrl(PATHS.ECEWE_ELIGIBILITY, this.$route.params?.changeRecGuid); + } + return changeUrl(PATHS.ECEWE_FACILITITES, this.$route.params?.changeRecGuid); } - else if(this.eceweFacility){ - return pcfUrl(PATHS.ECEWE_ELIGIBILITY, this.programYearId); - }else { + else { + if (!this.eceweFacility) { + return pcfUrl(PATHS.ECEWE_ELIGIBILITY, this.programYearId); + } return pcfUrl(PATHS.ECEWE_FACILITITES, this.programYearId); } }, diff --git a/frontend/src/components/summary/group/UploadedDocumentsSummary.vue b/frontend/src/components/summary/group/UploadedDocumentsSummary.vue index 0ff4b1bc2..170b28fe6 100644 --- a/frontend/src/components/summary/group/UploadedDocumentsSummary.vue +++ b/frontend/src/components/summary/group/UploadedDocumentsSummary.vue @@ -52,14 +52,15 @@