From 11ac31336c252b00f5ae86ff2293ee7bf0a8b9d4 Mon Sep 17 00:00:00 2001 From: Nick Phura Date: Fri, 16 Aug 2019 09:15:11 -0700 Subject: [PATCH] ACRFD-4-3: Improve UI, Improve constant handling. --- .../explore-panel/explore-panel.component.ts | 2 +- .../find-panel/find-panel.component.ts | 2 +- src/app/models/application.ts | 5 +-- src/app/services/application.service.ts | 33 ++++++++++++------- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/app/applications/explore-panel/explore-panel.component.ts b/src/app/applications/explore-panel/explore-panel.component.ts index 1ae23699..e333dd4f 100644 --- a/src/app/applications/explore-panel/explore-panel.component.ts +++ b/src/app/applications/explore-panel/explore-panel.component.ts @@ -263,7 +263,7 @@ export class ExplorePanelComponent implements OnDestroy { public clear() { this.clearAllFilters(); this.saveQueryParameters(); - this.emitUpdate({ search: false, resetMap: true, hidePanel: false }); + this.emitUpdate({ search: true, resetMap: true, hidePanel: false }); } /** diff --git a/src/app/applications/find-panel/find-panel.component.ts b/src/app/applications/find-panel/find-panel.component.ts index 70ace617..4a1e9d39 100644 --- a/src/app/applications/find-panel/find-panel.component.ts +++ b/src/app/applications/find-panel/find-panel.component.ts @@ -129,7 +129,7 @@ export class FindPanelComponent implements OnDestroy { public clear() { this.clearAllFilters(); this.saveQueryParameters(); - this.emitUpdate({ search: false, resetMap: true, hidePanel: false }); + this.emitUpdate({ search: true, resetMap: true, hidePanel: false }); } /** diff --git a/src/app/models/application.ts b/src/app/models/application.ts index e5c2b968..788fd1c3 100644 --- a/src/app/models/application.ts +++ b/src/app/models/application.ts @@ -49,13 +49,14 @@ export class Application { this.location = (obj && obj.location) || null; this.name = (obj && obj.name) || null; this.purpose = (obj && obj.purpose) || null; - this.status = (obj && obj.status && ConstantUtils.getCode(CodeType.STATUS, obj.status)) || null; - this.reason = (obj && obj.reason && ConstantUtils.getCode(CodeType.REASON, obj.reason)) || null; + this.status = (obj && obj.status) || null; + this.reason = (obj && obj.reason) || null; this.subpurpose = (obj && obj.subpurpose) || null; this.subtype = (obj && obj.subtype) || null; this.tantalisID = (obj && obj.tantalisID) || null; // not zero this.tenureStage = (obj && obj.tenureStage) || null; this.type = (obj && obj.type) || null; + this.region = (obj && obj.businessUnit && ConstantUtils.getTextLong(CodeType.REGION, obj.businessUnit)) || null; this.cpStatus = (obj && obj.cpStatus) || null; diff --git a/src/app/services/application.service.ts b/src/app/services/application.service.ts index f532534c..5135e687 100644 --- a/src/app/services/application.service.ts +++ b/src/app/services/application.service.ts @@ -378,9 +378,9 @@ export class ApplicationService { isAmendment(application: Application): boolean { return ( application && - application.status === StatusCodes.ABANDONED.code && - (application.reason === ReasonCodes.AMENDMENT_APPROVED.code || - application.reason === ReasonCodes.AMENDMENT_NOT_APPROVED.code) + ConstantUtils.getCode(CodeType.STATUS, application.status) === StatusCodes.ABANDONED.code && + (ConstantUtils.getCode(CodeType.REASON, application.reason) === ReasonCodes.AMENDMENT_APPROVED.code || + ConstantUtils.getCode(CodeType.REASON, application.reason) === ReasonCodes.AMENDMENT_NOT_APPROVED.code) ); } @@ -395,9 +395,9 @@ export class ApplicationService { isAbandoned(application: Application): boolean { return ( application && - application.status === StatusCodes.ABANDONED.code && - application.reason !== ReasonCodes.AMENDMENT_APPROVED.code && - application.reason !== ReasonCodes.AMENDMENT_NOT_APPROVED.code + ConstantUtils.getCode(CodeType.STATUS, application.status) === StatusCodes.ABANDONED.code && + ConstantUtils.getCode(CodeType.REASON, application.reason) !== ReasonCodes.AMENDMENT_APPROVED.code && + ConstantUtils.getCode(CodeType.REASON, application.reason) !== ReasonCodes.AMENDMENT_NOT_APPROVED.code ); } @@ -409,7 +409,10 @@ export class ApplicationService { * @memberof ApplicationService */ isApplicationUnderReview(application: Application): boolean { - return application && application.status === StatusCodes.APPLICATION_UNDER_REVIEW.code; + return ( + application && + ConstantUtils.getCode(CodeType.STATUS, application.status) === StatusCodes.APPLICATION_UNDER_REVIEW.code + ); } /** @@ -420,7 +423,10 @@ export class ApplicationService { * @memberof ApplicationService */ isApplicationReviewComplete(application: Application): boolean { - return application && application.status === StatusCodes.APPLICATION_REVIEW_COMPLETE.code; + return ( + application && + ConstantUtils.getCode(CodeType.STATUS, application.status) === StatusCodes.APPLICATION_REVIEW_COMPLETE.code + ); } /** @@ -431,7 +437,9 @@ export class ApplicationService { * @memberof ApplicationService */ isDecisionApproved(application: Application): boolean { - return application && application.status === StatusCodes.DECISION_APPROVED.code; + return ( + application && ConstantUtils.getCode(CodeType.STATUS, application.status) === StatusCodes.DECISION_APPROVED.code + ); } /** @@ -442,7 +450,10 @@ export class ApplicationService { * @memberof ApplicationService */ isDecisionNotApproved(application: Application): boolean { - return application && application.status === StatusCodes.DECISION_NOT_APPROVED.code; + return ( + application && + ConstantUtils.getCode(CodeType.STATUS, application.status) === StatusCodes.DECISION_NOT_APPROVED.code + ); } /** @@ -453,7 +464,7 @@ export class ApplicationService { * @memberof ApplicationService */ isUnknown(application: Application): boolean { - return application && application.status === StatusCodes.UNKNOWN.code; + return application && ConstantUtils.getCode(CodeType.STATUS, application.status) === StatusCodes.UNKNOWN.code; } /**