Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull main into release-196 #441

Merged
merged 6 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions backend/src/components/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,12 +680,15 @@ function checkKey(key, obj) {
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&$filter=_ccof_change_action_value eq ${changeActionId}`;
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 => {
mappedData.push( new MappableObjectForFront(fac, NewFacilityMappings).toJSON());
let mappedFacility = new MappableObjectForFront(fac, NewFacilityMappings).toJSON();
mappedFacility.facilityName = fac.ccof_facility['name'];
mappedFacility.facilityStatus = fac.ccof_facility['[email protected]'];
mappedData.push(mappedFacility);
});

log.info('faccccc data post mapping', mappedData);
Expand Down
9 changes: 3 additions & 6 deletions backend/src/components/facility.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function mapCCFRIObjectForFront(data) {
async function getFacility(req, res) {
try {
//,_ccof_change_request_value
let operation = 'accounts('+req.params.facilityId+')?$select=ccof_accounttype,name,ccof_facilitystartdate,address1_line1,address1_city,address1_postalcode,ccof_position,emailaddress1,address1_primarycontactname,telephone1,ccof_facilitylicencenumber,ccof_licensestartdate,ccof_formcomplete,ccof_everreceivedfundingundertheccofprogram,ccof_facilityreceived_ccof_funding,accountnumber'; //+ getMappingString(FacilityMappings);
let operation = 'accounts('+req.params.facilityId+')?$select=ccof_accounttype,name,ccof_facilitystartdate,address1_line1,address1_city,address1_postalcode,ccof_position,emailaddress1,address1_primarycontactname,telephone1,ccof_facilitylicencenumber,ccof_licensestartdate,ccof_formcomplete,ccof_everreceivedfundingundertheccofprogram,ccof_facilityreceived_ccof_funding,accountnumber,ccof_facilitystatus'; //+ getMappingString(FacilityMappings);
log.info('operation: ', operation);
let facility = await getOperation(operation);

Expand Down Expand Up @@ -180,11 +180,8 @@ async function getCCFRIClosureDates(ccfriId){

data.forEach((date) => {

let formattedStartDate = new Date(date.ccof_startdate).toISOString().slice(0, 10);
// formattedStartDate.

let formattedEndDate = new Date(date.ccof_enddate).toISOString().slice(0, 10);
// formattedEndDate.toISOString().slice(0, 10);
let formattedStartDate = date.ccof_startdate ? new Date(date.ccof_startdate).toISOString().slice(0, 10) : date.ccof_startdate;
let formattedEndDate = date.ccof_enddate ? new Date(date.ccof_enddate).toISOString().slice(0, 10) : date.ccof_enddate;

closureDates.push({
'closureDateId' : date.ccof_application_ccfri_closureid,
Expand Down
1 change: 1 addition & 0 deletions backend/src/util/mapping/Mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const FacilityMappings = [
{ back: 'ccof_formcomplete', front: 'isFacilityComplete' },
{ back: 'accountnumber', front: 'facilityAccountNumber' },
{ back: '_ccof_change_request_value', front: 'changeRequestId' }, //likely won't stay here
{ back: '[email protected]', front: 'facilityStatus' },

// XXXXXXXXXXXXX: 'licenseEffectiveDate',
// XXXXXXXXXXXXX: 'hasReceivedFunding',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/CcfriEstimator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</v-img>
</v-col>
</v-row>
<v-row justify="center">
<v-row v-show="false" justify="center">
<v-col cols="12" class="pt-1" align="center">
<v-card class="elevation-0" max-width="1448">
<v-col class="py-2">
Expand Down
11 changes: 2 additions & 9 deletions frontend/src/components/SupportingDocumentUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,6 @@ export default {
return this.isValidForm;
return this.isValidForm && this.canSubmit;
},
filteredNavBarList() {
if (this.isChangeRequest) {
return this.navBarList.filter(el => el.changeRequestId === this.$route.params.changeRecGuid);
} else {
return this.navBarList.filter(el => !el.changeRequestId);
}
},
},

async mounted() {
Expand Down Expand Up @@ -470,7 +463,7 @@ export default {
this.isLoading = true;
try {
await this.getDocuments(this.applicationId);
this.uploadedDocuments = this.getUploadedDocuments.filter(document => this.filteredNavBarList.findIndex(item => item.facilityId == document.ccof_facility) > -1);
this.uploadedDocuments = this.getUploadedDocuments.filter(document => this.navBarList.findIndex(item => item.facilityId == document.ccof_facility) > -1);
} catch (e) {
console.error(e);
} finally {
Expand Down Expand Up @@ -511,7 +504,7 @@ export default {
this.uploadedDocuments[index].description = item.description;
},
async mapFacilityData() {
for (let facilityInfo of this.filteredNavBarList) {
for (let facilityInfo of this.navBarList) {
const facility = {};
facility.facilityId = facilityInfo.facilityId;
facility.facilityName = facilityInfo.facilityName;
Expand Down
11 changes: 2 additions & 9 deletions frontend/src/components/ccofApplication/group/LicenseUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</v-row>
<v-data-table v-if="!isLoading"
:headers="headers"
:items="filteredLicenseUploadData"
:items="licenseUploadData"
class="elevation-1"
hide-default-header
hide-default-footer
Expand Down Expand Up @@ -83,13 +83,6 @@ export default {
...mapGetters('licenseUpload', ['getUploadedLicenses']),
...mapGetters('navBar', ['nextPath', 'previousPath', 'isChangeRequest']),
...mapGetters('reportChanges',['isLicenseUploadUnlocked','changeRequestStatus']),
filteredLicenseUploadData() {
if (this.isChangeRequest) {
return this.licenseUploadData.filter(el => el.changeRequestId === this.changeRequestId);
} else {
return this.licenseUploadData.filter(el => !el.changeRequestId);
}
},
isLocked() {
if(this.isChangeRequest){
if(this.isLicenseUploadUnlocked||!this.changeRequestStatus){
Expand Down Expand Up @@ -122,7 +115,7 @@ export default {
for (let navBarItem of facilityList) {
const facilityId = navBarItem.facilityId;
const uploadedLicenceCount = this.getUploadedLicenses.filter(uploadedDocsInServer => uploadedDocsInServer.ccof_facility === facilityId).length;
const deletedLicenceCount = this.filteredLicenseUploadData.filter(element => (element.deletedDocument && element.deletedDocument.annotationid && (element.facilityId === facilityId))).length;
const deletedLicenceCount = this.licenseUploadData.filter(element => (element.deletedDocument && element.deletedDocument.annotationid && (element.facilityId === facilityId))).length;
let fileMapLicencePerFacilityCount = 0;
if(this.fileMap.size > 0 && this.fileMap.get(facilityId)){
fileMapLicencePerFacilityCount = this.fileMap.get(facilityId)?.length;
Expand Down
11 changes: 1 addition & 10 deletions frontend/src/components/eceweApplication/EceweFacilities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,8 @@ export default {
isSaveBtnDisabled() {
return this.model.fundingModel === this.fundingModelTypeList[0].id;
},
filteredECEWEFacilityList() {
if (isChangeRequest(this)) {
console.log('filteredECEWEFacilityList = this.$store.state.eceweApp.facilities');
console.log(this.$store.state.eceweApp.facilities);
return this.$store.state.eceweApp.facilities?.filter(el => el.changeRequestId === this.$route.params.changeRecGuid);
} else {
return this.$store.state.eceweApp.facilities?.filter(el => !el.changeRequestId);
}
},
facilities: {
get() { return this.filteredECEWEFacilityList; },
get() { return this.$store.state.eceweApp.facilities; },
set(value) { this.$store.commit('eceweApp/setFacilities', value); }
},
isReadOnly() {
Expand Down
32 changes: 22 additions & 10 deletions frontend/src/components/mtfi/MtfiSelectFacility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@
<span class="text-h6 font-weight-bold blueText">{{this.organizationName}}</span>
</div>
<v-row no-gutters class="justify-center align-center pt-12">
<v-icon
x-large
class="pr-5 noticeInfoIcon">
mdi-help-circle
</v-icon>
<v-tooltip top color="#003366">
<template v-slot:activator="{ on, attrs }">
<v-icon
x-large
v-bind="attrs" v-on="on"
class="pr-5 noticeInfoIcon"
>
mdi-help-circle
</v-icon>
</template>
<span>You can request a Mid-term Fee Increase after the facility has been approved for the fiscal year.</span>
</v-tooltip>
<div class="text-h5">
Please select which facility you would like to update
</div>
Expand Down Expand Up @@ -59,7 +66,7 @@ import LargeButtonContainer from '../guiComponents/LargeButtonContainer.vue';
import { PATHS, changeUrlGuid, CHANGE_TYPES } from '@/utils/constants';
import alertMixin from '@/mixins/alertMixin';
import NavButton from '@/components/util/NavButton';
import { isChangeRequest } from '@/utils/common';
import { isFacilityAvailable } from '@/utils/common';

let ccfriOptInOrOut = {};
let textInput = '' ;
Expand Down Expand Up @@ -92,18 +99,19 @@ export default {
...mapState('reportChanges', ['changeActionId','mtfiFacilities', 'userProfileChangeRequests']),
...mapGetters('navBar', ['previousPath']),
...mapGetters('reportChanges',['changeRequestStatus']),

isReadOnly() {
return (this.changeRequestStatus != 'INCOMPLETE');
},
isNextButtonDisabled() {
return (!this.checkbox?.includes(true));
},
// CCFRI-2584 - All facilties displayed in the PCF should be shown on the MTFI Select Facility page -> same logic as filterNavBar() in navBar.js
filteredUserProfileList() {
if (this.isRenewal) {
return this.userProfileList.filter(el => !el.changeRequestId && el.facilityAccountNumber);
return this.userProfileList.filter(el => el.facilityAccountNumber && (isFacilityAvailable(el) || this.isMtfiCreated(el)));
}
return this.userProfileList.filter(el => !el.changeRequestId);
return this.userProfileList.filter(el => (!el.changeRequestId || el.facilityAccountNumber) && (isFacilityAvailable(el) || this.isMtfiCreated(el)));
}
},
async beforeMount() {
Expand All @@ -128,6 +136,10 @@ export default {
isFacilityDisabled(ccfriOptInStatus, ccfriStatus) {
return (ccfriOptInStatus == 0 || ccfriStatus != 'APPROVED');
},
isMtfiCreated(facility) {
let index = this.mtfiFacilities?.findIndex(item => item.facilityId === facility?.facilityId);
return index > -1;
},
previous() {
this.$router.push(PATHS.ROOT.CHANGE_LANDING);
},
Expand Down Expand Up @@ -200,7 +212,7 @@ export default {
} catch (error) {
console.log(error);
this.setFailureAlert('An error occurred while saving. Please try again later.');
}
}
},
},
mounted() {
Expand Down
11 changes: 3 additions & 8 deletions frontend/src/components/requestChanges/ReportChanges.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ import { PATHS, CHANGE_TYPES, changeUrlGuid , changeUrl } from '@/utils/constant
import alertMixin from '@/mixins/alertMixin';
import SmallCard from '../guiComponents/SmallCard.vue';
import NavButton from '../util/NavButton.vue';

import { isFacilityAvailable } from '@/utils/common';


export default {
Expand Down Expand Up @@ -353,12 +353,7 @@ export default {
//change in backend, only returns 1 at a time rn
let action = changeActions.find(el => el.changeType == "NEW_FACILITY");
if (action?.facilities) {
action.facilities.forEach(fac => {
const facilityUserProfileList = this.userProfileList?.find(item => item.facilityId === fac.facilityId);
if (facilityUserProfileList?.facilityName) {
str = str + `${facilityUserProfileList?.facilityName}, `;
}
});
action.facilities.forEach(fac => str = str + `${fac.facilityName}, `);
}
return str.slice(0, -2);
},
Expand Down Expand Up @@ -608,7 +603,7 @@ export default {
// At least 1 Facility has CCFRI status to be Approved.
isMtfiEnabled(){
let foundCRNotInEndStateStatus = this.allChangeRequests.find(el => el.changeType == 'PARENT_FEE_CHANGE' && !this.endStateStatusesCR.includes(el.externalStatus));
let foundFacilityWithApprovedCCFRI = this.userProfileList.find(el => el.ccfriStatus == 'APPROVED');
let foundFacilityWithApprovedCCFRI = this.userProfileList.find(el => el.ccfriStatus == 'APPROVED' && isFacilityAvailable(el));
return (!foundCRNotInEndStateStatus && foundFacilityWithApprovedCCFRI);
},
buttonColor(isDisabled) {
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/summary/group/CCFRISummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@

<v-col class="col-md-3 col-12">
<v-text-field placeholder="Required" readonly dense flat solo hide-details
:value="obj.feesPaidWhileClosed === 1 ? 'Yes' : 'No'" :rules="rules.required"></v-text-field>
:value="getYesNoValue(obj.feesPaidWhileClosed)" :rules="rules.required"></v-text-field>
</v-col>
</v-row> <!-- end v for-->
</v-row> <!-- end v if -->
Expand Down Expand Up @@ -161,7 +161,7 @@ import { isChangeRequest } from '@/utils/common';
import { PATHS, pcfUrlGuid, pcfUrl, changeUrl, changeUrlGuid } from '@/utils/constants';
import rules from '@/utils/rules';
import {mapState} from 'vuex';

import globalMixin from '@/mixins/globalMixin';


export default {
Expand All @@ -183,6 +183,7 @@ export default {
required: false
}
},
mixins: [globalMixin],
data() {
return {
PATHS,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/util/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default {
let linkName;
if (this.isChangeRequest) {
const currentCR = this.userProfileChangeRequests.find(item => item.changeRequestId === this.changeRequestId);
checkbox = this.changeRequestStatus === 'SUBMITTED' && !currentCR?.unlockDeclaration;
checkbox = ['SUBMITTED','APPROVED'].includes(this.changeRequestStatus) && !currentCR?.unlockDeclaration;
if(this.changeType===CHANGE_TYPES.NEW_FACILITY){
linkName = 'Summary and Declaration New Facility';
}
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/mixins/globalMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export default {
methods: {
convertBlankNumberToNull(object, key) {
object[key] = !isNullOrBlank(object[key]) ? object[key] : null;
},
getYesNoValue(value) {
if (isNullOrBlank(value))
return value;
return value === 1 ? 'Yes' : 'No';
}
}
};
1 change: 1 addition & 0 deletions frontend/src/store/modules/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default {
commit('application/setFromUserInfo', userInfoRes.data, { root: true });
commit('navBar/setUserProfileList', userInfoRes.data.facilityList, { root: true });
commit('navBar/setIsRenewal', (userInfoRes.data.applicationType === 'RENEW'), { root: true });
commit('navBar/setApplicationStatus', [userInfoRes.data.applicationStatus, userInfoRes.data.ccofApplicationStatus], { root: true });
commit('app/setIsRenewal', (userInfoRes.data.applicationType === 'RENEW'), { root: true });
commit('organization/setOrganizationId', userInfoRes.data.organizationId, { root: true });
commit('organization/setOrganizationProviderType', userInfoRes.data.organizationProviderType, { root: true });
Expand Down
25 changes: 22 additions & 3 deletions frontend/src/store/modules/navBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { PATHS, CHANGE_REQUEST_TYPES } from '@/utils/constants';
import {checkSession} from '@/utils/session';
import ApiService from '@/common/apiService';
import {ApiRoutes} from '@/utils/constants';
import { isFacilityAvailable } from '@/utils/common';

function getActiveIndex(items) {
let foundIndex = -1;
Expand Down Expand Up @@ -66,12 +67,27 @@ function filterNavBar(state) {
state.navBarList = null;
}
// PCF
// CCFRI-2682
// If the PCF is RENEW and NOT SUBMITTED, the PCF will display all facilities having Facility ID and facility status is NOT in (“Closed”, “Cancelled”, Blank).
// If the PCF is RENEW and ALREADY SUBMITTED, the PCF will display all facilities having Facility ID and active in that Submitted application.
// If the PCF is NEW and APPROVED, the PCF will display all facilities added from that PCF or having Facility ID.
// If the PCF is NEW and NOT APPROVED, the PCF will display all facilities added from that PCF.
} else {
state.navBarList = state.userProfileList.filter(el => {
const isFacilityActive = el.ccofBaseFundingId || el.ccfriApplicationId || el.eceweApplicationId;
if (state.isRenewal) {
return (el.facilityAccountNumber && (el.facilityStatus === 'CCFRI Complete'));
if (state.applicationStatus === 'DRAFT') {
return (el.facilityAccountNumber && isFacilityAvailable(el));
} else {
return (el.facilityAccountNumber && isFacilityActive);
}
} else {
if (state.applicationStatus === 'APPROVED') {
return ((!el.changeRequestId || el.facilityAccountNumber) && isFacilityActive);
} else {
return (!el.changeRequestId);
}
}
return (!el.changeRequestId || (el.facilityAccountNumber && (el.facilityStatus === 'CCFRI Complete')));
});
}
}
Expand All @@ -91,12 +107,15 @@ export default {
currentUrl: null,
navBarGroup: '', //defines which nav bar group is opened (CCOF, CCFRI, ECEWE)
isRenewal: false,
applicationStatus: null,
},
mutations: {
setNavBarItems: (state, value) => { state.navBarItems = value; },
setCanSubmit: (state, value) => { state.canSubmit = value; },
setIsRenewal(state, value) { state.isRenewal = value; },

setApplicationStatus(state, [applicationStatus, ccofApplicationStatus]) {
state.applicationStatus = (applicationStatus === 'SUBMITTED' && ccofApplicationStatus === 'ACTIVE') ? 'APPROVED' : applicationStatus;
},
setChangeRequestId: (state, value) => {
state.programYearId = null;
state.changeRequestId = value;
Expand Down
15 changes: 3 additions & 12 deletions frontend/src/store/modules/summaryDeclaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,10 @@ export default {
facilities: payload.facilities,
ecewe:undefined
};
// filter out all facilities that are part of the change request --- Rob made the below code, when I pulled it in, it broke mine so commenting out for now
// const changeRequestList = rootState.app.navBarList.map( el => { if (el.changeRequestId) return el.facilityId;}).filter(el => el);
// console.log('change request List: ', changeRequestList);

// summaryModel.facilities = summaryModel.facilities?.filter(el => !changeRequestList.includes(el.facilityId));

//filter all facilites and only show the new ones associated with the changeRecGuid on the page
if (changeRecGuid){
summaryModel.facilities = summaryModel.facilities.filter(fac => {return fac.changeRequestId == changeRecGuid;});
}
else {
summaryModel.facilities = summaryModel.facilities.filter(fac => {return !fac.changeRequestId;});
}
summaryModel.facilities = summaryModel.facilities?.filter(fac => {
return rootState.navBar.navBarList?.findIndex(item => item.facilityId === fac.facilityId) > -1;
});

commit('summaryModel', summaryModel);
commit('isMainLoading', false);
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ export function sortByFacilityId(value) {
export async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

export function isFacilityAvailable(facility) {
return (facility?.facilityStatus && !['Closed','Cancelled'].includes(facility?.facilityStatus));
}
Loading