Evaluate default amendment workflow in list

Evaluates the default amendment workflow in the amendment list so users
can se the filters accordingly
This commit is contained in:
Sean 2020-09-16 11:55:02 +02:00
parent 04477d9ebd
commit 51512fd589
2 changed files with 13 additions and 2 deletions

View File

@ -120,4 +120,11 @@ export class AmendmentFilterListService extends MotionFilterListService {
return [this.motionFilterOptions].concat(super.getFilterDefinitions()); return [this.motionFilterOptions].concat(super.getFilterDefinitions());
} }
} }
/**
* Override the parents 'isWorkflowEnabled', only consider the enabledWorkflows.amendment
*/
protected isWorkflowEnabled(workflowId: number): boolean {
return workflowId === this.enabledWorkflows.amendment;
}
} }

View File

@ -44,7 +44,7 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
/** /**
* Listen to the configuration for change in defined/used workflows * Listen to the configuration for change in defined/used workflows
*/ */
private enabledWorkflows = { statuteEnabled: false, statute: null, motion: null }; protected enabledWorkflows = { statuteEnabled: false, statute: null, motion: null, amendment: null };
/** /**
* Determine to show amendments in the motion list * Determine to show amendments in the motion list
@ -216,6 +216,10 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
this.enabledWorkflows.motion = +id; this.enabledWorkflows.motion = +id;
}); });
this.config.get<string>('motions_amendments_workflow').subscribe(id => {
this.enabledWorkflows.amendment = +id;
});
this.config.get<boolean>('motions_statutes_enabled').subscribe(bool => { this.config.get<boolean>('motions_statutes_enabled').subscribe(bool => {
this.enabledWorkflows.statuteEnabled = bool; this.enabledWorkflows.statuteEnabled = bool;
}); });
@ -343,7 +347,7 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
}); });
} }
private isWorkflowEnabled(workflowId: number): boolean { protected isWorkflowEnabled(workflowId: number): boolean {
return ( return (
workflowId === this.enabledWorkflows.motion || workflowId === this.enabledWorkflows.motion ||
(this.enabledWorkflows.statuteEnabled && workflowId === this.enabledWorkflows.statute) (this.enabledWorkflows.statuteEnabled && workflowId === this.enabledWorkflows.statute)