Merge pull request #4324 from MaximilianKrambach/callListLandscape

call list subheaders
This commit is contained in:
Emanuel Schütze 2019-02-13 13:39:19 +01:00 committed by GitHub
commit 34585fc4cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -489,6 +489,8 @@ export class MotionPdfService {
/** /**
* Creates pdfMake definitions for the call list of given motions * Creates pdfMake definitions for the call list of given motions
* Any motions that are 'top level' (no sort_parent_id) will have their tags
* used as comma separated header titles in an extra row
* *
* @param motions A list of motions * @param motions A list of motions
* @returns definitions ready to be opened or exported via {@link PdfDocumentService} * @returns definitions ready to be opened or exported via {@link PdfDocumentService}
@ -528,7 +530,32 @@ export class MotionPdfService {
] ]
]; ];
const callListRows = motions.map(motion => this.createCallListRow(motion)); const callListRows: object[] = [];
let currentTitle = '';
motions.map(motion => {
if (!motion.sort_parent_id) {
const heading = motion.tags ? motion.tags.map(tag => tag.name).join(', ') : '';
if (heading !== currentTitle) {
callListRows.push([
{
text: heading,
colSpan: 6,
style: 'heading3',
margin: [0, 10, 0, 10]
},
'',
'',
'',
'',
''
]);
currentTitle = heading;
}
}
callListRows.push(this.createCallListRow(motion));
});
const table: object = { const table: object = {
table: { table: {
widths: ['auto', 'auto', 'auto', '*', 'auto', 'auto'], widths: ['auto', 'auto', 'auto', '*', 'auto', 'auto'],