Skip to content

Commit

Permalink
Merge pull request #419 from NickPhura/ACRFD-4-3
Browse files Browse the repository at this point in the history
ACRFD-4-3: Improve UI, Improve constant handling.
  • Loading branch information
NickPhura authored Aug 19, 2019
2 parents d477804 + 11ac313 commit 31f6985
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/app/applications/find-panel/find-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/app/models/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
33 changes: 22 additions & 11 deletions src/app/services/application.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}

Expand All @@ -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
);
}

Expand All @@ -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
);
}

/**
Expand All @@ -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
);
}

/**
Expand All @@ -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
);
}

/**
Expand All @@ -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
);
}

/**
Expand All @@ -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;
}

/**
Expand Down

0 comments on commit 31f6985

Please sign in to comment.