Skip to content

Commit

Permalink
Merge pull request #460 from bcgov/release-196-jb3
Browse files Browse the repository at this point in the history
fix ece-we, license upload for NavBar
  • Loading branch information
vietle-cgi authored Oct 27, 2023
2 parents c94d20e + b5c57cd commit 91f3df4
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 35 deletions.
14 changes: 10 additions & 4 deletions frontend/src/components/LandingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,16 @@
</div>
</template>
<template #button>
<v-btn :color='buttonColor(!isRenewEnabled)' dark v-if="ccofRenewStatus === RENEW_STATUS_NEW" @click="renewApplication()">Renew my Funding Agreement</v-btn>
<v-btn :color='buttonColor(!isRenewEnabled)' dark v-else-if="ccofRenewStatus === RENEW_STATUS_CONTINUE" @click="continueRenewal()">Continue Renewal</v-btn>
<v-btn :color='buttonColor(!isRenewEnabled)' dark v-else-if="ccofRenewStatus === RENEW_STATUS_ACTION_REQUIRED" @click="actionRequiredOrganizationRoute()">Update your PCF</v-btn>
<v-btn dark class="blueButton" @click="viewApplication('RENEW')" v-else>View Application</v-btn>
<!-- wait for CR list to be loaded before starting a renewal- to not allow user to start renewal if there is active change request -->
<div v-if="!isLoadingComplete">
<v-skeleton-loader class="ma-0 pa-0" type="chip"></v-skeleton-loader>
</div>
<div v-else>
<v-btn :color='buttonColor(!isRenewEnabled)' dark v-if="ccofRenewStatus === RENEW_STATUS_NEW" @click="renewApplication()">Renew my Funding Agreement</v-btn>
<v-btn :color='buttonColor(!isRenewEnabled)' dark v-else-if="ccofRenewStatus === RENEW_STATUS_CONTINUE" @click="continueRenewal()">Continue Renewal</v-btn>
<v-btn :color='buttonColor(!isRenewEnabled)' dark v-else-if="ccofRenewStatus === RENEW_STATUS_ACTION_REQUIRED" @click="actionRequiredOrganizationRoute()">Update your PCF</v-btn>
<v-btn dark class="blueButton" @click="viewApplication('RENEW')" v-else>View Application</v-btn>
</div>
</template>
</SmallCard>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default {
methods: {
...mapActions('licenseUpload', ['saveLicenseFiles', 'getLicenseFiles', 'deleteLicenseFiles']),
...mapMutations('application', ['setIsLicenseUploadComplete']),
...mapMutations('application', ['setIsLicenseUploadCompleteInMap' , 'setIsLicenseUploadComplete']),
...mapMutations('navBar', ['forceNavBarRefresh']),
...mapMutations('reportChanges', ['setCRIsLicenseComplete']),
previous() {
Expand Down Expand Up @@ -228,6 +228,7 @@ export default {
if (this.isChangeRequest) {
this.setCRIsLicenseComplete({changeRequestId: this.changeRequestId, isComplete: !this.nextButtonDisabled});
} else {
this.setIsLicenseUploadCompleteInMap(!this.nextButtonDisabled);
this.setIsLicenseUploadComplete(!this.nextButtonDisabled);
}
this.forceNavBarRefresh();
Expand Down
18 changes: 7 additions & 11 deletions frontend/src/components/eceweApplication/EceweEligibility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,6 @@ export default {
...mapGetters('navBar', ['previousPath', 'isChangeRequest']),
...mapState('reportChanges', ['loadedChangeRequest']),
...mapGetters('reportChanges',['isEceweUnlocked','changeRequestStatus']),
filteredNavBarList() {
if (this.isChangeRequest) {
return this.navBarList.filter(el => el.changeRequestId === this.$route.params.changeRecGuid);
} else {
return this.navBarList.filter(el => !el.changeRequestId);
}
},
filteredECEWEFacilityList() {
if (this.isChangeRequest) {
return this.$store.state.eceweApp.facilities?.filter(el => el.changeRequestId === this.$route.params.changeRecGuid);
Expand Down Expand Up @@ -353,7 +346,7 @@ export default {
let response = await this.loadData();
if (response) {
this.setIsStarted(true);
this.initECEWEFacilities(this.filteredNavBarList);
this.initECEWEFacilities(this.navBarList);
let copyFacilities = JSON.parse(JSON.stringify(this.facilities));
this.setLoadedFacilities(copyFacilities);
this.model = {...this.eceweModel};
Expand All @@ -372,7 +365,7 @@ export default {
methods: {
...mapActions('eceweApp', ['loadECEWE', 'saveECEWE', 'initECEWEFacilities', 'saveECEWEFacilities', 'loadECEWEModelFromChangeRequest']),
...mapMutations('eceweApp', ['setIsStarted', 'setEceweModel', 'setApplicationId', 'setFundingModelTypes', 'setLoadedFacilities']),
...mapMutations('application', ['setIsEceweComplete']),
...mapMutations('application', ['setIsEceweCompleteInMap', 'setIsEceweComplete']),
...mapMutations('reportChanges', ['setCRIsEceweComplete']),
...mapActions('reportChanges', ['getChangeRequest']),
...mapMutations('navBar', ['forceNavBarRefresh']),
Expand Down Expand Up @@ -474,7 +467,7 @@ export default {
// }
// return facility;
// });
this.filteredNavBarList.forEach(facility => {
this.navBarList.forEach(facility => {
facility.eceweOptInStatus = 0;
});
this.facilities.forEach(facility => {
Expand Down Expand Up @@ -504,8 +497,10 @@ export default {
}
if (this.isChangeRequest) {
this.setCRIsEceweComplete({changeRequestId: this.changeRequestId, isComplete: this.enableButtons});
} else {
}
else {
this.setIsEceweComplete(this.enableButtons);
this.setIsEceweCompleteInMap(this.enableButtons);
}
this.forceNavBarRefresh();
Expand All @@ -529,6 +524,7 @@ export default {
}
} catch (error) {
this.setFailureAlert('An error occurred while saving ECEWE application. Please try again later.');
console.log(error);
} finally {
this.isProcessing = false;
}
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/store/modules/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ export default {
setUnlockSupportingDocuments(state, value) { state.unlockSupportingDocuments = value; },

setIsEceweComplete(state, value) { state.isEceweComplete = value; },
setIsEceweCompleteInMap(state, value){
console.log('set value ', value);
let app = state.applicationMap?.get(state.programYearId);
app.isEceweComplete = value;
},
setIsLicenseUploadComplete(state, value) { state.isLicenseUploadComplete = value; },
setIsLicenseUploadCompleteInMap(state, value) {
let app = state.applicationMap?.get(state.programYearId);
app.isLicenseUploadComplete = value;
},

addApplicationsToMap: (state, applicationList) => {
const map = new Map(state.applicationMap);
Expand Down
69 changes: 50 additions & 19 deletions frontend/src/store/modules/eceweApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ApiRoutes } from '@/utils/constants';
import { checkSession } from '@/utils/session';
import { isEqual } from 'lodash';
import { sortByFacilityId, isNullOrBlank } from '@/utils/common';
import facility from './ccof/facility';

export default {
namespaced: true,
Expand Down Expand Up @@ -62,7 +63,7 @@ export default {
commit('setLoadedModel', eceweModel);
}
},
async saveECEWE({ state, commit }, {isFormComplete, isChangeRequest, changeRequestId}) {
async saveECEWE({ state, commit}, {isFormComplete, isChangeRequest, changeRequestId}) {
try {
if (isEqual(state.eceweModel, state.loadedModel) && state.isStarted) {
return;
Expand All @@ -75,7 +76,6 @@ export default {
let response;
if (isChangeRequest) {
delete payload.applicationId;
console.log('ece we payload', payload);
response = await ApiService.apiAxios.patch(ApiRoutes.CHANGE_REQUEST + '/' + changeRequestId, payload);
} else {
response = await ApiService.apiAxios.patch(ApiRoutes.APPLICATION_ECEWE + '/' + state.applicationId, payload);
Expand Down Expand Up @@ -122,29 +122,60 @@ export default {
}
},
/* Initalizes\creates the facilities payload depending on if ecewe facilities exist or not. */
async initECEWEFacilities({ state, commit }, navBarList) {
async initECEWEFacilities({ state, commit, rootState, rootGetters }, navBarList) {
let facilityPayload;
if (state.facilities?.length == 0) {
console.log(' No facilities payload, create from the narBarList.');
// No facilities payload, create from the narBarList.
facilityPayload = navBarList.map(facility => ({
eceweApplicationId: null,
facilityId: facility.facilityId,
optInOrOut: state.eceweModel.fundingModel === state.fundingModelTypes[0].id ? 0 : null,
changeRequestId: facility.changeRequestId ? facility.changeRequestId : null,
changeRequestNewFacilityId: facility.changeRequestNewFacilityId ? facility.changeRequestNewFacilityId : null
}));
} else {

if(rootGetters['navBar/isChangeRequest']){
console.log('this is a change req, build from newFacilities list');

let newFac = rootState?.reportChanges?.changeRequestMap?.get(rootState?.navBar?.changeRequestId).changeActions[0]?.newFacilities;

facilityPayload = newFac?.map(facility => ({
eceweApplicationId: null,
facilityId: facility.facilityId,
optInOrOut: state.eceweModel.fundingModel === state.fundingModelTypes[0].id ? 0 : null,
changeRequestId: rootState.navBar.changeRequestId ? rootState.navBar.changeRequestId: null,
changeRequestNewFacilityId: facility.changeRequestNewFacilityId ? facility.changeRequestNewFacilityId : null
}));
}
else{

// No facilities payload, create from the narBarList.
facilityPayload = navBarList.map(facility => ({
eceweApplicationId: null,
facilityId: facility.facilityId,
optInOrOut: state.eceweModel.fundingModel === state.fundingModelTypes[0].id ? 0 : null,
}));
}
}

else {
// A payload already exists, recreate to include any new facilities which could have been added to navBarList
// since last creation.
console.log('A payload already exists, recreate');
facilityPayload = navBarList.map(facility => ({
facilityId: facility.facilityId,
eceweApplicationId: getEceweApplicationId(facility.facilityId),
optInOrOut: getOptInOrOut(facility.facilityId),
changeRequestId: facility.changeRequestId ? facility.changeRequestId : null,
changeRequestNewFacilityId: facility.changeRequestNewFacilityId ? facility.changeRequestNewFacilityId : null
}));

if(rootGetters['navBar/isChangeRequest']){
console.log('this is a change req, build from newFacilities list');

let newFac = rootState?.reportChanges?.changeRequestMap?.get(rootState?.navBar?.changeRequestId).changeActions[0]?.newFacilities;

facilityPayload = newFac?.map(facility => ({
eceweApplicationId: getEceweApplicationId(facility.facilityId),
facilityId: facility.facilityId,
optInOrOut: getOptInOrOut(facility.facilityId),
changeRequestId: rootState.navBar.changeRequestId ? rootState.navBar.changeRequestId: null,
changeRequestNewFacilityId: facility.changeRequestNewFacilityId ? facility.changeRequestNewFacilityId : null
}));
}
else{
facilityPayload = navBarList.map(facility => ({
facilityId: facility.facilityId,
eceweApplicationId: getEceweApplicationId(facility.facilityId),
optInOrOut: getOptInOrOut(facility.facilityId),
}));
}
}
commit('setFacilities', facilityPayload);
function getEceweApplicationId(facilityId) {
Expand Down

0 comments on commit 91f3df4

Please sign in to comment.