diff --git a/client/src/app/site/pages/meetings/modules/poll/base/base-poll-pdf.service.ts b/client/src/app/site/pages/meetings/modules/poll/base/base-poll-pdf.service.ts
index 9fd2c350f3..2a8930baf0 100644
--- a/client/src/app/site/pages/meetings/modules/poll/base/base-poll-pdf.service.ts
+++ b/client/src/app/site/pages/meetings/modules/poll/base/base-poll-pdf.service.ts
@@ -64,6 +64,10 @@ export abstract class BasePollPdfService {
return this.activeMeetingService.meetingId!;
}
+ private get activeVoteWeight(): boolean {
+ return this.meetingSettingsService.instant(`users_enable_vote_weight`);
+ }
+
protected meetingSettingsService = inject(MeetingSettingsService);
protected userRepo = inject(ParticipantControllerService);
protected activeMeetingService = inject(ActiveMeetingService);
@@ -382,7 +386,7 @@ export abstract class BasePollPdfService {
margin: [0, 20, 0, 5],
bold: true
});
- const votesData = this.createVotesTable(exportInfo.votesData);
+ const votesData = this.createVotesTable(exportInfo.votesData, poll.type);
pollResultPdfContent.push(votesData);
}
@@ -559,23 +563,31 @@ export abstract class BasePollPdfService {
*
* @returns the table as pdfmake object
*/
- private createVotesTable(votesData: BaseVoteData[]): object {
- const pollTableBody: any[] = [
- [
- {
- text: ``,
- style: `tableHeader`
- },
- {
- text: this.translate.instant(`Participant`),
- style: `tableHeader`
- },
- {
- text: this.translate.instant(`Votes`),
- style: `tableHeader`
- }
- ]
+ private createVotesTable(votesData: BaseVoteData[], pollType: PollType): object {
+ const isAnonymised: boolean = votesData[0].user ? false : true;
+ const showVoteWeight: boolean = this.activeVoteWeight && pollType == PollType.Named && !isAnonymised;
+ let pollTableBody: any[] = [];
+ const pollTableHeader = [
+ {
+ text: ``,
+ style: `tableHeader`
+ },
+ {
+ text: this.translate.instant(`Participant`),
+ style: `tableHeader`
+ },
+ {
+ text: this.translate.instant(`Votes`),
+ style: `tableHeader`
+ }
];
+ if (showVoteWeight) {
+ pollTableHeader.splice(2, 0, {
+ text: this.translate.instant(`Vote Weight`),
+ style: `tableHeader`
+ });
+ }
+ pollTableBody = [pollTableHeader];
let index = 1;
for (const date of votesData.sort((entryA, entryB) =>
@@ -592,11 +604,15 @@ export abstract class BasePollPdfService {
text: this.parseSingleResult(date[`votes`] ?? date[`value`])
}
];
-
+ if (showVoteWeight) {
+ tableLine.splice(2, 0, {
+ text: this.getUserVoteWeightForExport(date.user)
+ });
+ }
pollTableBody.push(tableLine);
index++;
}
- return this.generateTableObject(pollTableBody);
+ return this.generateTableObject(pollTableBody, showVoteWeight);
}
/**
@@ -605,22 +621,29 @@ export abstract class BasePollPdfService {
* @returns the table as pdfmake object
*/
private createUsersTable(usersData: EntitledUsersTableEntry[]): object {
- const pollTableBody: any[] = [
- [
- {
- text: ``,
- style: `tableHeader`
- },
- {
- text: this.translate.instant(`Participant`),
- style: `tableHeader`
- },
- {
- text: this.translate.instant(`Has voted`),
- style: `tableHeader`
- }
- ]
+ const showVoteWeight: boolean = this.activeVoteWeight;
+ let pollTableBody: any[] = [];
+ const pollTableHeader = [
+ {
+ text: ``,
+ style: `tableHeader`
+ },
+ {
+ text: this.translate.instant(`Participant`),
+ style: `tableHeader`
+ },
+ {
+ text: this.translate.instant(`Has voted`),
+ style: `tableHeader`
+ }
];
+ if (showVoteWeight) {
+ pollTableHeader.splice(2, 0, {
+ text: this.translate.instant(`Vote Weight`),
+ style: `tableHeader`
+ });
+ }
+ pollTableBody = [pollTableHeader];
let index = 1;
for (const date of usersData.sort((entryA, entryB) =>
@@ -651,18 +674,23 @@ export abstract class BasePollPdfService {
text: this.translate.instant(date.voted ? `Yes` : `No`)
}
];
+ if (showVoteWeight) {
+ tableLine.splice(2, 0, {
+ text: this.getUserVoteWeightForExport(date.user)
+ });
+ }
pollTableBody.push(tableLine);
index++;
}
- return this.generateTableObject(pollTableBody);
+ return this.generateTableObject(pollTableBody, showVoteWeight);
}
- private generateTableObject(pollTableBody: any[]): object {
+ private generateTableObject(pollTableBody: any[], showVoteWeight: boolean): object {
return [
{
table: {
- widths: [`4%`, `48%`, `48%`],
+ widths: showVoteWeight ? [`4%`, `32%`, `32%`, `32%`] : [`4%`, `48%`, `48%`],
headerRows: 1,
body: pollTableBody
},
@@ -675,6 +703,10 @@ export abstract class BasePollPdfService {
return user?.getShortName() ?? this.translate.instant(`Anonymous`);
}
+ private getUserVoteWeightForExport(user: ViewUser | undefined): string {
+ return user?.voteWeight.toString();
+ }
+
private parseSingleResult(resultData: any, indent = 0): string {
const indentation = ` `.repeat(indent);
if (Array.isArray(resultData)) {
diff --git a/client/src/app/site/pages/meetings/modules/poll/components/entitled-users-table/entitled-users-table.component.html b/client/src/app/site/pages/meetings/modules/poll/components/entitled-users-table/entitled-users-table.component.html
index 3d25052e90..814e7cc20a 100644
--- a/client/src/app/site/pages/meetings/modules/poll/components/entitled-users-table/entitled-users-table.component.html
+++ b/client/src/app/site/pages/meetings/modules/poll/components/entitled-users-table/entitled-users-table.component.html
@@ -20,6 +20,10 @@
{{ entry.user.getLevelAndNumber() }}
}
+
+ @if (displayVoteWeight) {
+
{{ 'Vote weight' | translate }}: {{ entry.user.vote_weight() }}
+ }
@if (entry.vote_delegated_to_user_id && !entry.delegation_user_merged_into_id) {
diff --git a/client/src/app/site/pages/meetings/modules/poll/components/entitled-users-table/entitled-users-table.component.ts b/client/src/app/site/pages/meetings/modules/poll/components/entitled-users-table/entitled-users-table.component.ts
index 3b2652615c..87805b9b57 100644
--- a/client/src/app/site/pages/meetings/modules/poll/components/entitled-users-table/entitled-users-table.component.ts
+++ b/client/src/app/site/pages/meetings/modules/poll/components/entitled-users-table/entitled-users-table.component.ts
@@ -42,6 +42,9 @@ export class EntitledUsersTableComponent {
return this._isViewingThis;
}
+ @Input()
+ public displayVoteWeight: boolean;
+
public readonly permission = Permission;
public filterPropsEntitledUsersTable = [
diff --git a/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-polls/components/assignment-poll-detail/assignment-poll-detail.component.html b/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-polls/components/assignment-poll-detail/assignment-poll-detail.component.html
index 276074d182..85cf33ecc7 100644
--- a/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-polls/components/assignment-poll-detail/assignment-poll-detail.component.html
+++ b/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-polls/components/assignment-poll-detail/assignment-poll-detail.component.html
@@ -57,6 +57,7 @@
{{ poll.title }}
diff --git a/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-polls/components/assignment-poll-detail/assignment-poll-detail.component.ts b/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-polls/components/assignment-poll-detail/assignment-poll-detail.component.ts
index a77b41f416..4b595ba83a 100644
--- a/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-polls/components/assignment-poll-detail/assignment-poll-detail.component.ts
+++ b/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-polls/components/assignment-poll-detail/assignment-poll-detail.component.ts
@@ -38,12 +38,15 @@ export class AssignmentPollDetailComponent
return this.hasPerms() || this.poll.isPublished;
}
+ public displayVoteWeight: boolean;
+
public constructor(
pollService: AssignmentPollService,
private pollDialog: AssignmentPollDialogService,
pollPdfService: AssignmentPollPdfService
) {
super(pollService, pollPdfService);
+ this.subscriptions.push(this.voteWeightEnabled.subscribe(data => (this.displayVoteWeight = data)));
}
public openDialog(poll: ViewPoll): void {
diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-polls/components/motion-poll-detail/motion-poll-detail.component.html b/client/src/app/site/pages/meetings/pages/motions/pages/motion-polls/components/motion-poll-detail/motion-poll-detail.component.html
index d5561a1d0f..ad4ff8046a 100644
--- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-polls/components/motion-poll-detail/motion-poll-detail.component.html
+++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-polls/components/motion-poll-detail/motion-poll-detail.component.html
@@ -46,6 +46,7 @@ {{ poll.title | translate }}
{{ poll.title | translate }}
diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-polls/components/motion-poll-detail/motion-poll-detail.component.ts b/client/src/app/site/pages/meetings/pages/motions/pages/motion-polls/components/motion-poll-detail/motion-poll-detail.component.ts
index 9cced9740c..bfa9049d5b 100644
--- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-polls/components/motion-poll-detail/motion-poll-detail.component.ts
+++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-polls/components/motion-poll-detail/motion-poll-detail.component.ts
@@ -11,6 +11,10 @@ import { MotionPollService } from '../../../../modules/motion-poll/services';
import { MotionPollDialogService } from '../../../../modules/motion-poll/services/motion-poll-dialog.service';
import { MotionPollPdfService } from '../../../../modules/motion-poll/services/motion-poll-pdf.service';
+export interface ExtendedVoteData extends BaseVoteData {
+ vote_verbose_translated?: string | null;
+}
+
@Component({
selector: `os-motion-poll-detail`,
templateUrl: `./motion-poll-detail.component.html`,
@@ -19,12 +23,14 @@ import { MotionPollPdfService } from '../../../../modules/motion-poll/services/m
encapsulation: ViewEncapsulation.None
})
export class MotionPollDetailComponent extends BasePollDetailComponent {
- public filterPropsSingleVotesTable = [`user.full_name`, `valueVerbose`];
+ public filterPropsSingleVotesTable = [`user.full_name`, `valueVerbose`, `vote_verbose_translated`];
public get showResults(): boolean {
return this.hasPerms() || this.poll.isPublished;
}
+ public displayVoteWeight: boolean;
+
public constructor(
protected override translate: TranslateService,
pollService: MotionPollService,
@@ -32,10 +38,19 @@ export class MotionPollDetailComponent extends BasePollDetailComponent (this.displayVoteWeight = data)));
}
- protected createVotesData(): BaseVoteData[] {
- return this.poll?.options[0]?.votes;
+ protected createVotesData(): ExtendedVoteData[] {
+ const voteData = this.poll?.options[0]?.votes;
+ const extendedVoteData: ExtendedVoteData[] = this.poll?.options[0]?.votes;
+ if (extendedVoteData) {
+ extendedVoteData.map(
+ (element, index) =>
+ (element.vote_verbose_translated = this.translate.instant(voteData[index].vote.valueVerbose))
+ );
+ }
+ return extendedVoteData;
}
public openDialog(): void {