From 0d16b487d56665c514792727b332f56ba542908b Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 26 Aug 2020 15:50:55 +0200 Subject: [PATCH] Add "supporter" to motion export dialog Allows PDF, CSV and XLSX to export the supporter manually --- .../src/app/site/motions/motions.constants.ts | 2 ++ .../motions/services/motion-pdf.service.ts | 34 ++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/client/src/app/site/motions/motions.constants.ts b/client/src/app/site/motions/motions.constants.ts index fd84c0b65..50370f58a 100644 --- a/client/src/app/site/motions/motions.constants.ts +++ b/client/src/app/site/motions/motions.constants.ts @@ -21,6 +21,7 @@ export const PERSONAL_NOTE_ID = -1; */ export type InfoToExport = | 'submitters' + | 'supporters' | 'state' | 'recommendation' | 'category' @@ -99,6 +100,7 @@ export enum MotionEditNotificationType { export const motionImportExportHeaderOrder: string[] = [ 'identifier', 'submitters', + 'supporters', 'title', 'text', 'reason', diff --git a/client/src/app/site/motions/services/motion-pdf.service.ts b/client/src/app/site/motions/services/motion-pdf.service.ts index b4d99f411..36ba58714 100644 --- a/client/src/app/site/motions/services/motion-pdf.service.ts +++ b/client/src/app/site/motions/services/motion-pdf.service.ts @@ -245,23 +245,25 @@ export class MotionPdfService { } // supporters - const minSupporters = this.configService.instant('motions_min_supporters'); - if (minSupporters && motion.supporters.length > 0) { - const supporters = motion.supporters - .map(supporter => { - return supporter.full_name; - }) - .join(', '); + if (!infoToExport || infoToExport.includes('supporters')) { + const minSupporters = this.configService.instant('motions_min_supporters'); + if (!!minSupporters && motion.supporters.length > 0) { + const supporters = motion.supporters + .map(supporter => { + return supporter.full_name; + }) + .join(', '); - metaTableBody.push([ - { - text: `${this.translate.instant('Supporters')}:`, - style: 'boldText' - }, - { - text: supporters - } - ]); + metaTableBody.push([ + { + text: `${this.translate.instant('Supporters')}:`, + style: 'boldText' + }, + { + text: supporters + } + ]); + } } // state