Skip to content

Commit

Permalink
Add additional filter/sort/link for contribution-list (#3502)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elblinator authored Apr 8, 2024
1 parent c268c6f commit 3479aed
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Id } from '../../../../../../../../domain/definitions/key-types';
import { Speaker } from '../../../../../../../../domain/models/speakers/speaker';
import { SpeakerState } from '../../../../../../../../domain/models/speakers/speaker-state';
import { HasMeeting } from '../../../../../view-models/has-meeting';
import { ViewMotion } from '../../../../motions';
import { ViewListOfSpeakers } from './view-list-of-speakers';
import { ViewPointOfOrderCategory } from './view-point-of-order-category';
/**
Expand Down Expand Up @@ -57,6 +58,15 @@ export class ViewSpeaker extends BaseHasMeetingUserViewModel<Speaker> {
);
}

public get numbering(): string {
if (this.list_of_speakers?.content_object.collection === `motion`) {
return (this.list_of_speakers?.content_object as ViewMotion).number;
} else if (this.list_of_speakers?.content_object.collection === `topic`) {
return this.list_of_speakers?.content_object.agenda_item.item_number;
}
return null;
}

public get name(): string {
return this.user ? this.user.getFullName(this.structure_level_list_of_speakers?.structure_level) : ``;
}
Expand Down Expand Up @@ -101,6 +111,13 @@ export class ViewSpeaker extends BaseHasMeetingUserViewModel<Speaker> {
return collectionFromFqid(this.list_of_speakers?.content_object_id);
}

public get contentSeqNum(): string {
if (!this.list_of_speakers?.content_object) {
return null;
}
return this.list_of_speakers?.content_object[`sequential_number`];
}

public get topic(): string {
const number = this.list_of_speakers?.content_object?.agenda_item?.item_number;
const title = this.list_of_speakers?.content_object?.getTitle();
Expand All @@ -124,6 +141,10 @@ export class ViewSpeaker extends BaseHasMeetingUserViewModel<Speaker> {
: null;
}

public get hasSpoken(): boolean {
return this.speaker.end_time ? true : false;
}

public getBeginTimeAsDate(): Date | null {
return this.speaker.begin_time ? new Date(this.speaker.begin_time * 1000) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ <h2>{{ 'Contributions' | translate }}</h2>

<div *osScrollingTableCell="'info'; row as speaker; config: { width: 200 }" class="cell-slot fill">
<div class="infoCell">
<div *ngIf="speaker.list_of_speakers?.content_object" class="spacer-top-5">
<a
[routerLink]="viewModelUrl(speaker) || null"
[state]="{ back: 'true' }"
*ngIf="speaker.list_of_speakers?.content_object"
class="spacer-top-5"
>
<os-icon-container [icon]="getSpeakerIcon(speaker)">
{{ speaker.topic }}
</os-icon-container>
</div>
</a>
<div *ngIf="speaker.point_of_order" class="spacer-top-5">
<os-icon-container icon="warning" translate>Point of order</os-icon-container>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,24 @@ export class ParticipantSpeakerListComponent extends BaseMeetingListViewComponen
this.csvExport.export(this.listComponent.source);
}

public getSpeakerIcon(speaker: ViewSpeaker) {
public getSpeakerIcon(speaker: ViewSpeaker): string {
return modelIcons[speaker.contentType];
}

private getSpeakerContentType(speaker: ViewSpeaker): string {
return speaker.contentType;
}

protected viewModelUrl(speaker: ViewSpeaker): string {
if (this.getSpeakerContentType(speaker) === `topic`) {
return `/${this.activeMeetingId}/agenda/topics/${speaker.contentSeqNum}`;
} else if (this.getSpeakerContentType(speaker) === `motion`) {
return `/${this.activeMeetingId}/motions/${speaker.contentSeqNum}`;
} else if (this.getSpeakerContentType(speaker) === `motion_block`) {
return `/${this.activeMeetingId}/motions/blocks/${speaker.contentSeqNum}`;
} else if (this.getSpeakerContentType(speaker) === `assignment`) {
return `/${this.activeMeetingId}/assignments/${speaker.contentSeqNum}`;
}
return `/${this.activeMeetingId}`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ export class ParticipantSpeakerListFilterService extends BaseMeetingFilterListSe
{ condition: `motion_block`, label: this.translate.instant(`Motion blocks`) },
{ condition: `assignment`, label: this.translate.instant(`Elections`) }
]
},
{
property: `hasSpoken`,
label: this.translate.instant(`Spoken`),
options: [
{ condition: true, label: this.translate.instant(`Has spoken`) },
{ condition: [false, null], label: this.translate.instant(`Has not spoken`) }
]
}
];
return staticFilterOptions.concat(this.speakerStructureLevelFilterOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ export class ParticipantSpeakerListSortService extends BaseSortListService<ViewS
private speakerSortOptions: OsSortingOption<ViewSpeaker>[] = [
{ property: `id`, label: _(`Receipt of contributions`) },
{ property: `begin_time`, label: _(`Speech start time`) },
{ property: `name`, label: _(`Speaker`) }
{ property: `name`, label: _(`Speaker`) },
{
property: `numbering`,
label: _(`Numbering`),
foreignBaseKeys: { agenda_item: [`item_number`], motion: [`number`] }
}
];

public constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const getSpeakersListSubscriptionConfig: SubscriptionConfigGenerator = (i
follow: [
{
idField: `content_object_id`,
fieldset: [`title`, `list_of_speakers_id`, ...MEETING_ROUTING_FIELDS],
fieldset: [`title`, `number`, `list_of_speakers_id`, ...MEETING_ROUTING_FIELDS],
follow: [
{
idField: `agenda_item_id`,
Expand Down

0 comments on commit 3479aed

Please sign in to comment.