Skip to content

Commit

Permalink
Add spokesperson to motion xlsx export
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel committed Apr 19, 2024
1 parent 6f66cd4 commit 3e2e8db
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ <h1 mat-dialog-title>{{ 'Export motions' | translate }}</h1>
<mat-button-toggle *osPerms="permission.listOfSpeakersCanSee" value="speakers" #speakersButton>
<span>{{ 'Speakers' | translate }}</span>
</mat-button-toggle>
<mat-button-toggle *ngIf="workingGroupSpeakerActive" value="working_group_speakers" #workingGroupSpeakerButton>
<span>{{ 'Spokesperson' | translate }}</span>
</mat-button-toggle>
<mat-button-toggle value="polls" #votingResultButton>
<span>{{ 'Voting result' | translate }}</span>
</mat-button-toggle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class MotionExportDialogComponent extends BaseUiComponent implements OnIn
*/
public exportForm!: UntypedFormGroup;

public workingGroupSpeakerActive: boolean;

/**
* Store the subject to the ViewMotionCommentSection
*/
Expand Down Expand Up @@ -109,6 +111,12 @@ export class MotionExportDialogComponent extends BaseUiComponent implements OnIn
@ViewChild(`speakersButton`)
public speakersButton!: MatButtonToggle;

/**
* To deactivate the working group button.
*/
@ViewChild(`workingGroupSpeakerButton`)
public workingGroupSpeakerButton!: MatButtonToggle;

/**
* To deactivate the toc button.
*/
Expand Down Expand Up @@ -137,6 +145,7 @@ export class MotionExportDialogComponent extends BaseUiComponent implements OnIn
super();
this.defaults.lnMode = this.meetingSettingsService.instant(`motions_default_line_numbering`)!;
this.defaults.crMode = this.meetingSettingsService.instant(`motions_recommendation_text_mode`)!;
this.workingGroupSpeakerActive = this.meetingSettingsService.instant(`motions_enable_working_group_speaker`)!;
this.commentsSubject = this.commentRepo.getViewModelListObservable();
if (this.meetingSettingsService.instant(`motions_show_sequential_number`)) {
this.defaults.metaInfo!.push(`id`);
Expand Down Expand Up @@ -173,9 +182,15 @@ export class MotionExportDialogComponent extends BaseUiComponent implements OnIn
if (format === ExportFileFormat.XLSX) {
this.disableControl(`content`);
this.changeStateOfButton(this.speakersButton, false);
if (this.workingGroupSpeakerButton) {
this.changeStateOfButton(this.workingGroupSpeakerButton, false);
}
} else {
this.enableControl(`content`);
this.changeStateOfButton(this.speakersButton, true);
if (this.workingGroupSpeakerButton) {
this.changeStateOfButton(this.workingGroupSpeakerButton, true);
}
}

if (format === ExportFileFormat.CSV || format === ExportFileFormat.XLSX) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export class MotionXlsxExportService {
const properties: string[] = infoToExport.includes(`speakers`)
? sortMotionPropertyList([`number`, `title`].concat(infoToExport)).concat(`speakers`)
: sortMotionPropertyList([`number`, `title`].concat(infoToExport));
if (infoToExport.includes(`working_group_speakers`)) {
properties.push(`working_group_speakers`);
}

const worksheet = workbook.addWorksheet(this.translate.instant(`Motions`), {
pageSetup: {
Expand Down Expand Up @@ -114,6 +117,9 @@ export class MotionXlsxExportService {
case `speakers`:
propertyHeader = _(`Open requests to speak`);
break;
case `working_group_speakers`:
propertyHeader = _(`Spokesperson`);
break;
default:
propertyHeader = property.charAt(0).toUpperCase() + property.slice(1).replace(`_`, ` `);
}
Expand Down

0 comments on commit 3e2e8db

Please sign in to comment.