diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-manage-motion-meeting-users/motion-manage-motion-meeting-users.component.ts b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-manage-motion-meeting-users/motion-manage-motion-meeting-users.component.ts index 44c07211e4..428d35f66e 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-manage-motion-meeting-users/motion-manage-motion-meeting-users.component.ts +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-manage-motion-meeting-users/motion-manage-motion-meeting-users.component.ts @@ -69,6 +69,8 @@ export class MotionManageMotionMeetingUsersComponent Promise; + public secondSelectorValues: Selectable[]; public secondSelectorFormControl: UntypedFormControl; @@ -98,6 +100,11 @@ export class MotionManageMotionMeetingUsersComponent { + this.secondSelectorValues = items; + }); + } } public get isEditMode(): boolean { @@ -235,7 +242,7 @@ export class MotionManageMotionMeetingUsersComponent boolean { + public getDisabledFn(): (v: Selectable) => boolean { return (value: Selectable) => this.secondSelectorDisabledIds.includes(value.id); } @@ -246,7 +253,7 @@ export class MotionManageMotionMeetingUsersComponent 0; + return this.secondSelectorValues && this.secondSelectorValues.length > 0; } private updateData(models: V[]): void { diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-meta-data/motion-meta-data.component.html b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-meta-data/motion-meta-data.component.html index 5566d4c811..692fe4a9cc 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-meta-data/motion-meta-data.component.html +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-meta-data/motion-meta-data.component.html @@ -11,7 +11,7 @@ additionalInputLabel="{{ 'Extension' | translate }}" [additionalInputValue]="motion?.additional_submitter" secondSelectorLabel="{{ 'Committees' | translate }}" - [secondSelectorValues]="forwardingCommittees" + [loadSecondSelectorValues]="loadForwardingCommittees" > diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-meta-data/motion-meta-data.component.ts b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-meta-data/motion-meta-data.component.ts index 14dd9dcfa6..2a0fad8480 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-meta-data/motion-meta-data.component.ts +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/components/motion-meta-data/motion-meta-data.component.ts @@ -112,9 +112,7 @@ export class MotionMetaDataComponent extends BaseMotionDetailChildComponent impl return this._referencedMotions; } - public get forwardingCommittees(): Selectable[] { - return this._forwardingCommittees; - } + public loadForwardingCommittees: () => Promise; private _referencingMotions: ViewMotion[]; @@ -122,8 +120,6 @@ export class MotionMetaDataComponent extends BaseMotionDetailChildComponent impl private _forwardingAvailable = false; - private _forwardingCommittees: (Selectable & { name: string; toString: any })[] = []; - public get supportersObservable(): Observable { return this._supportersSubject; } @@ -152,6 +148,9 @@ export class MotionMetaDataComponent extends BaseMotionDetailChildComponent impl if (operator.hasPerms(Permission.motionCanManage)) { this.motionForwardingService.forwardingMeetingsAvailable().then(forwardingAvailable => { this._forwardingAvailable = forwardingAvailable; + this.loadForwardingCommittees = async (): Promise => { + return (await this.checkPresenter()) as Selectable[]; + }; }); } else { this._forwardingAvailable = false; @@ -164,7 +163,6 @@ export class MotionMetaDataComponent extends BaseMotionDetailChildComponent impl this.subscriptions.push( this.participantSort.getSortedViewModelListObservable().subscribe(() => this.updateSupportersSubject()) ); - this.checkPresenter(); } public override ngOnDestroy(): void { @@ -388,15 +386,15 @@ export class MotionMetaDataComponent extends BaseMotionDetailChildComponent impl } } - private async checkPresenter(): Promise { + private async checkPresenter(): Promise<(Selectable & { name: string; toString: any })[]> { const meetingId = this.activeMeetingService.meetingId; const committees = this.operator.hasPerms(Permission.motionCanManage) && !!meetingId ? await this.presenter.call({ meeting_id: meetingId }) : []; - this._forwardingCommittees = []; + const forwardingCommittees: (Selectable & { name: string; toString: any })[] = []; for (let n = 0; n < committees.length; n++) { - this._forwardingCommittees.push({ + forwardingCommittees.push({ id: n + 1, name: committees[n], getTitle: () => committees[n], @@ -404,5 +402,7 @@ export class MotionMetaDataComponent extends BaseMotionDetailChildComponent impl toString: () => committees[n] }); } + + return forwardingCommittees; } }