Skip to content

Commit

Permalink
Merge pull request #451 from bcgov/report-changes-Viet
Browse files Browse the repository at this point in the history
Fix bugs for release 1.9.6
  • Loading branch information
roblo-cgi authored Oct 13, 2023
2 parents fc953b5 + 6d611da commit 0a021e4
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 27 deletions.
2 changes: 1 addition & 1 deletion backend/src/components/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const {
updateChangeRequestNewFacility,
postApplicationSummaryDocument,
postChangeRequestSummaryDocument,
getChangeActionDetails
} = require('./utils');
const {
CCOF_APPLICATION_TYPES,
Expand Down Expand Up @@ -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');

Expand Down
3 changes: 1 addition & 2 deletions backend/src/components/changeRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,5 @@ module.exports = {
updateChangeRequestMTFI,
deleteChangeAction,
getChangeRequestMTFIByCcfriId,
deleteChangeRequestMTFI,
getChangeActionDetails
deleteChangeRequestMTFI
};
34 changes: 33 additions & 1 deletion backend/src/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -409,7 +440,8 @@ const utils = {
postChangeActionDocument,
updateChangeRequestNewFacility,
postChangeRequestSummaryDocument,
getSubmissionPDFHistory
getSubmissionPDFHistory,
getChangeActionDetails
};

module.exports = utils;
2 changes: 1 addition & 1 deletion backend/src/util/mapping/Mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '[email protected]', front: 'facilityStatus' },

// XXXXXXXXXXXXX: 'licenseEffectiveDate',
// XXXXXXXXXXXXX: 'hasReceivedFunding',
Expand All @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/LandingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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){
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/SummaryDeclaration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,23 @@
</v-expansion-panel>
<v-expansion-panel variant="accordion">
<ECEWESummary @isSummaryValid="isFormComplete" :ecewe="{}"
:ecewe-facility="facility.ecewe"
:eceweFacility="facility.ecewe"
:isProcessing="isProcessing"
:changeRecGuid="facility.changeRequestId"
:programYearId="summaryModel?.application?.programYearId"
></ECEWESummary>
</v-expansion-panel>
<v-expansion-panel variant="accordion">
<UploadedDocumentsSummary @isSummaryValid="isFormComplete"
:documents="facility.documents"></UploadedDocumentsSummary>
:documents="facility.documents"
:programYearId="summaryModel?.application?.programYearId"></UploadedDocumentsSummary>
</v-expansion-panel>
</div>
</div>
<div v-if="!this.isRenewal" class="mt-10">
<v-expansion-panel variant="accordion">
<ECEWESummary @isSummaryValid="isFormComplete" :ecewe="this.summaryModel.ecewe"
:ecewe-facility="null" :isProcessing="isProcessing"
:eceweFacility="null" :isProcessing="isProcessing"
:programYearId="summaryModel?.application?.programYearId"
></ECEWESummary>
</v-expansion-panel>
Expand Down
16 changes: 13 additions & 3 deletions frontend/src/components/ccfriApplication/group/AddNewFees.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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){
Expand Down
30 changes: 25 additions & 5 deletions frontend/src/components/mtfi/CurrentFeeVerification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = { };
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 9 additions & 5 deletions frontend/src/components/summary/group/ECEWESummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@
</v-row>
</template>
<script>
import { PATHS, pcfUrlGuid } from '@/utils/constants';
import { PATHS, pcfUrl, changeUrl } from '@/utils/constants';
import rules from '@/utils/rules';
import {mapState} from 'vuex';
import {mapState, mapGetters} from 'vuex';
export default {
name: 'UploadedDocumentsSummary',
computed: {
...mapState('summaryDeclaration', ['isLoadingComplete',])
...mapState('summaryDeclaration', ['isLoadingComplete',]),
...mapGetters('navBar', ['isChangeRequest']),
},
props: {
documents: {
Expand All @@ -85,7 +86,10 @@ export default {
},
methods: {
getLink(){
return pcfUrlGuid(PATHS.LICENSE_UPLOAD, this.programYearId, this.ccfriId );
if (this.isChangeRequest) {
return changeUrl(PATHS.LICENSE_UPLOAD, this.$route.params?.changeRecGuid);
}
return pcfUrl(PATHS.LICENSE_UPLOAD, this.programYearId);
},
getLicenceDocumentFileName() {
return this.documents.find(doc => doc.documentType === 'Facility License')?.filename;
Expand Down

0 comments on commit 0a021e4

Please sign in to comment.