From fce0691ba50e92f2a8d5dd53286b2c9bb055e44e Mon Sep 17 00:00:00 2001 From: Niels Vandekeybus Date: Fri, 26 Mar 2021 14:39:14 +0100 Subject: [PATCH] filter secretary so only active functions are shown --- app/components/participation-list/functionaris-selector.hbs | 2 +- app/components/participation-list/functionaris-selector.js | 5 ++++- app/components/participation-list/modal.hbs | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/components/participation-list/functionaris-selector.hbs b/app/components/participation-list/functionaris-selector.hbs index 14a4b00d5..44642eed7 100644 --- a/app/components/participation-list/functionaris-selector.hbs +++ b/app/components/participation-list/functionaris-selector.hbs @@ -7,6 +7,6 @@ @onchange={{@onSelect}} as |functionaris| > {{functionaris.isBestuurlijkeAliasVan.gebruikteVoornaam}} {{functionaris.isBestuurlijkeAliasVan.achternaam}}, - {{functionaris.bekleedt.rol.label}} + {{functionaris.bekleedt.rol.label}} (periode {{moment-format functionaris.start "MM/DD/YYYY"}} - {{moment-format functionaris.einde "MM/DD/YYYY"}}) {{/if}} diff --git a/app/components/participation-list/functionaris-selector.js b/app/components/participation-list/functionaris-selector.js index a7e394de7..9144776ff 100644 --- a/app/components/participation-list/functionaris-selector.js +++ b/app/components/participation-list/functionaris-selector.js @@ -34,10 +34,13 @@ export default class ParticipationListFunctionarisSelectorComponent extends Comp } } }); + const startOfMeeting = this.args.meeting.gestartOpTijdstip ? this.args.meeting.gestartOpTijdstip : this.args.meeting.geplandeStart; let queryParams = { sort: 'is-bestuurlijke-alias-van.achternaam', 'filter[bekleedt][bevat-in][:id:]': bestuursorganen.map((b) => b.id).join(','), + 'filter[:lte:start]': startOfMeeting.toISOString() }; - this.options = yield this.store.query('functionaris', queryParams); + const candidateOptions = yield this.store.query('functionaris', queryParams); + this.options = candidateOptions.reject((functionaris) => functionaris.einde && functionaris.einde < startOfMeeting); } } diff --git a/app/components/participation-list/modal.hbs b/app/components/participation-list/modal.hbs index 382ec0897..718edf8ce 100644 --- a/app/components/participation-list/modal.hbs +++ b/app/components/participation-list/modal.hbs @@ -26,6 +26,7 @@