Skip to content

Commit

Permalink
Merge pull request #486 from bcgov/release-196-jb5
Browse files Browse the repository at this point in the history
Release 196 jb5
  • Loading branch information
roblo-cgi authored Dec 6, 2023
2 parents 7ddf0a9 + 2eba475 commit 1e4197a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 58 deletions.
4 changes: 2 additions & 2 deletions backend/src/components/facility.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function mapFacilityObjectForBack(data) {
}

if (data.hasReceivedFunding === 'no') {
facilityForBack.ccof_everreceivedfundingundertheccofprogram = 100000000;
} else if (data.hasReceivedFunding === 'yes') {
facilityForBack.ccof_everreceivedfundingundertheccofprogram = 100000001;
} else if (data.hasReceivedFunding === 'yes') {
facilityForBack.ccof_everreceivedfundingundertheccofprogram = 100000000;
} else if (data.hasReceivedFunding === 'yesFacility') {
facilityForBack.ccof_everreceivedfundingundertheccofprogram = 100000002;
} else if (data.hasReceivedFunding) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/LandingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</div>
</div>
<div v-else>
<p class="text-h5 blueText mb-0" v-if="ccofStatus === CCOF_STATUS_APPROVED">Status of your funding agreement for the current fiscal year: Approved</p>
<p class="text-h5 blueText mb-0" v-if="ccofStatus === CCOF_STATUS_APPROVED">Status of your funding agreement for the current fiscal year: Active</p>
<p class="text-h5 blueText mb-0" v-else>Status: Submitted</p>
<v-btn dark class="blueButton mt-4" @click="viewApplication('NEW')" v-if="applicationType === 'NEW'">View Application</v-btn>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<script>
//userInfo.ccofProgramYearId;
import { PATHS, pcfUrlGuid, PROGRAM_YEAR_LANGUAGE_TYPES } from '@/utils/constants';
import { PATHS, pcfUrlGuid } from '@/utils/constants';
import { sleep, deepCloneObject } from '@/utils/common';
import { mapState, mapActions, mapGetters, mapMutations} from 'vuex';
import alertMixin from '@/mixins/alertMixin';
Expand Down Expand Up @@ -148,8 +148,7 @@ export default {
computed: {
...mapGetters('auth', ['userInfo']),
...mapGetters('navBar', ['previousPath', 'getNavByCCFRIId']),
...mapState('app', ['programYearList', 'childCareCategoryList']),
...mapGetters('app', [ 'getFundingUrl', 'getLanguageYearLabel']),
...mapState('app', ['programYearList']),
...mapState('navBar', ['navBarList']),
...mapState('application', ['formattedProgramYear', 'programYearId', 'applicationId']),
...mapState('ccfriApp', ['CCFRIFacilityModel']),
Expand All @@ -167,13 +166,7 @@ export default {
//if no RegEx match is found, this will return whatever the name is in full. Might look weird if the user set field is changed to something different.
return programYear?.name.replace(/^.*\b(\d{4})\b.*$/, '$1');
},
languageYearLabel(){
return this.getLanguageYearLabel;
},
programYearTypes(){
return PROGRAM_YEAR_LANGUAGE_TYPES;
},
}
},
watch: {
//get facilityID from here and then set it !
Expand All @@ -194,18 +187,8 @@ export default {
const prevFees = await this.getPreviousApprovedFees({facilityId: this.CCFRIFacilityModel.facilityId, programYearId: this.previousProgramYearGuid});
//only display last years child care fees
const prevYearGuid = this.previousProgramYearGuid;
const ooscK = this.childCareCategoryList?.find(el => el.ccof_name=="OOSC-K");
const ooscG = this.childCareCategoryList?.find(el => el.ccof_name=="OOSC-G");
prevFees?.childCareTypes?.forEach(item => {
if (item.programYearId == prevYearGuid ){
if(this.languageYearLabel != this.programYearTypes.HISTORICAL){
if (item.childCareCategoryId == ooscK.ccof_childcare_categoryid){
item.childCareCategory = 'Kindergarten';
}
else if (item.childCareCategoryId == ooscG.ccof_childcare_categoryid){
item.childCareCategory = 'Grade 1 to Age 12';
}
}
this.feeList.push(item);
}
});
Expand Down
47 changes: 28 additions & 19 deletions frontend/src/store/modules/ccfriApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ import { checkSession } from '@/utils/session';
import { deepCloneObject, sleep } from '../../utils/common';
import { isEqual } from 'lodash';

function replaceChildCareLabel(currentYearLanguageLabel, childCareCategoryList, childCareTypes){

if (currentYearLanguageLabel != PROGRAM_YEAR_LANGUAGE_TYPES.HISTORICAL){
const ooscK = childCareCategoryList?.find(el => el.ccof_name=="OOSC-K");
const ooscG = childCareCategoryList?.find(el => el.ccof_name=="OOSC-G");

//OOSC and OOSK always exist together - so we just have to find one of them in the array
let schoolAgeFound = childCareTypes.find(el => el.childCareCategoryId == ooscK.ccof_childcare_categoryid);
if (schoolAgeFound){
childCareTypes.forEach(category => {

if (category.childCareCategoryId == ooscK.ccof_childcare_categoryid){
category.childCareCategory = 'Kindergarten';
}
else if (category.childCareCategoryId == ooscG.ccof_childcare_categoryid){
category.childCareCategory = 'Grade 1 to Age 12';
}
});
}
}
}

function isLocked(applicationStatus, navBarList, facilityId){

//console.log(facilityId, 'faccccc');
Expand Down Expand Up @@ -320,13 +342,16 @@ export default {
}
}
},
async getPreviousApprovedFees({commit, state}, {facilityId, programYearId}) {
async getPreviousApprovedFees({commit, state, rootGetters, rootState}, {facilityId, programYearId}) {
const prevFees = state.previousFeeStore[`${facilityId}-${programYearId}`];
if (prevFees) {
return prevFees;
} else {
try {
const response = await ApiService.apiAxios.get(`${ApiRoutes.CCFRI_FEES}/${facilityId}/year/${programYearId}`);
console.log('feeee response', response);
//if year is 2024/25 or above, change child care cat label to reflect new naming by the buisness.
replaceChildCareLabel(rootGetters['app/getLanguageYearLabel'], rootState?.app?.childCareCategoryList, response.data.childCareTypes );
commit('addPreviousApprovedParentFees', {facilityId: facilityId, programYearId: programYearId, parentFeeModel: response.data});
return response.data;
} catch(e) {
Expand Down Expand Up @@ -467,24 +492,8 @@ export default {
//IF not historical year - find Kindergarten & Out of school care in child cat lookup
//then check if they are in the CCFRI fac model. If so - rename them
console.log(rootGetters['app/getLanguageYearLabel']);
if (rootGetters['app/getLanguageYearLabel'] != PROGRAM_YEAR_LANGUAGE_TYPES.HISTORICAL){
const ooscK = rootState?.app?.childCareCategoryList?.find(el => el.ccof_name=="OOSC-K");
const ooscG = rootState?.app?.childCareCategoryList?.find(el => el.ccof_name=="OOSC-G");

//OOSC and OOSK always exist together - so we just have to find one of them in the array
let schoolAgeFound = state.CCFRIFacilityModel.childCareTypes.find(el => el.childCareCategoryId == ooscK.ccof_childcare_categoryid);
if (schoolAgeFound){
state.CCFRIFacilityModel.childCareTypes.forEach(category => {

if (category.childCareCategoryId == ooscK.ccof_childcare_categoryid){
category.childCareCategory = 'Kindergarten';
}
else if (category.childCareCategoryId == ooscG.ccof_childcare_categoryid){
category.childCareCategory = 'Grade 1 to Age 12';
}
});
}
}
//if year is 2024/25 or above, change child care cat label to reflect new naming by the buisness.
replaceChildCareLabel(rootGetters['app/getLanguageYearLabel'], rootState?.app?.childCareCategoryList, state.CCFRIFacilityModel.childCareTypes );

//sort them by age asc
state.CCFRIFacilityModel.childCareTypes.sort((a, b) => a.orderNumber - b.orderNumber);
Expand Down
32 changes: 16 additions & 16 deletions frontend/src/store/modules/summaryDeclaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ export default {
let changeRequestTypes = [];
payload?.changeActions?.forEach(item => {
if (!changeRequestTypes.includes(item.changeType)) {
changeRequestTypes.push(item.changeType)
};
changeRequestTypes.push(item.changeType);
}
});

// Load Declaration model
Expand All @@ -284,7 +284,7 @@ export default {
enabledDeclarationB: payload?.enabledDeclarationB,
declarationAStatus: payload?.declarationAStatus,
declarationBStatus: payload?.declarationBStatus
}
};
commit('model', declarationModel);

// Load Summary model
Expand All @@ -296,18 +296,18 @@ export default {
commit('summaryModel', summaryModel);
await Promise.all(changeRequestTypes.map(async changeType => {
switch (changeType) {
case CHANGE_REQUEST_TYPES.NEW_FACILITY:
await dispatch('loadChangeRequestSummaryForAddNewFacility', payload);
break;
case CHANGE_REQUEST_TYPES.PARENT_FEE_CHANGE:
await dispatch('loadChangeRequestSummaryForMtfi', payload);
break;
case CHANGE_REQUEST_TYPES.PDF_CHANGE:
await dispatch('loadChangeRequestSummaryForChangeNotiForm', payload);
break;
default:
throw `Not found change request type - ${changeType}`;
}
case CHANGE_REQUEST_TYPES.NEW_FACILITY:
await dispatch('loadChangeRequestSummaryForAddNewFacility', payload);
break;
case CHANGE_REQUEST_TYPES.PARENT_FEE_CHANGE:
await dispatch('loadChangeRequestSummaryForMtfi', payload);
break;
case CHANGE_REQUEST_TYPES.PDF_CHANGE:
await dispatch('loadChangeRequestSummaryForChangeNotiForm', payload);
break;
default:
throw `Not found change request type - ${changeType}`;
}
}))
commit('isLoadingComplete', true );
} catch (error) {
Expand Down Expand Up @@ -351,7 +351,7 @@ export default {
mtfiFacility.facilityAccountNumber = userProfileListFacility.facilityAccountNumber;
mtfiFacility.licenseNumber = userProfileListFacility.licenseNumber;

mtfiFacility.oldCcfriApplicationId = userProfileListFacility.ccfriApplicationId;
mtfiFacility.oldCcfriApplicationId = rootState?.application?.applicationMap?.get(rootState?.application?.programYearId)?.facilityList?.find(el => el.facilityId == mtfiFacility.facilityId).ccfriApplicationId;
mtfiFacility.oldCcfri = (await ApiService.apiAxios.get(`${ApiRoutes.CCFRIFACILITY}/${mtfiFacility.oldCcfriApplicationId}`)).data;
mtfiFacility.oldCcfri.childCareTypes = mtfiFacility.oldCcfri?.childCareTypes?.filter(item => item.programYearId === rootState.application.programYearId);
mtfiFacility.oldCcfri?.childCareTypes?.sort((a, b) => a.orderNumber - b.orderNumber);
Expand Down

0 comments on commit 1e4197a

Please sign in to comment.