Kleine fehler beseitigt
This commit is contained in:
1 parent
57e201b8fc
commit
115f0f5671
15 files changed
+220
-115
No files matched your search
+24
-10
@@ -8,7 +8,7 @@
|
||||
// vor js/init.js); exportPDF() hängt am Export-Button von Test.html und nutzt
|
||||
// die per CDN eingebundene Bibliothek pdfmake (offline nicht verfügbar). Es
|
||||
// liest die aktuelle Woche über currentWeek() aus js/store.js, Personen über
|
||||
// peopleByRole() aus js/board/board.js, Helfer wie assignKey()/sortGroups()/
|
||||
// peopleByRole() aus js/utils.js, Helfer wie assignKey()/sortGroups()/
|
||||
// formatWeekDate() aus js/utils.js sowie die Auslastungs-Berechnung
|
||||
// (berechneAuslastung, lpActiveList, faktorFormat, pdfLoadAmpelColor,
|
||||
// LOAD_BAR_MAX) aus js/load/load.js. Das Modul stellt ausschließlich exportPDF()
|
||||
@@ -272,6 +272,12 @@ function pdfProjectRow(p, allPeople, alt){
|
||||
];
|
||||
|
||||
allPeople.forEach(entry => {
|
||||
// Platzhalter-Einträge für leere Rollen (person === null) → leere Zelle,
|
||||
// damit Spaltenzahl mit der Kopfzeile übereinstimmt.
|
||||
if(!entry.person){
|
||||
row.push({ text: '', style: 'tdCenter', fillColor: base || '#FFFFFF' });
|
||||
return;
|
||||
}
|
||||
const s = (p.assign || {})[assignKey(entry.person.id, entry.role)] || 0;
|
||||
const txt = s === 1 ? 'X' : s === 2 ? '(X)' : '';
|
||||
const bg = s === 1 ? PDF_ASSIGN_MAIN
|
||||
@@ -468,17 +474,25 @@ async function exportPDF(){
|
||||
|
||||
try {
|
||||
const grouped = peopleByRole(w);
|
||||
const allPeople = [];
|
||||
ROLES.forEach(r => (grouped[r] || []).forEach(e => {
|
||||
// role explizit setzen, falls peopleByRole sie nicht mitliefert
|
||||
allPeople.push({ person: e.person, role: e.role || r });
|
||||
}));
|
||||
// displayPeople: Spalten der Tabelle inkl. Platzhalter für leere Rollen –
|
||||
// pdfHeaderRows erzwingt pro Rolle mindestens eine Spalte (colSpan/“–”),
|
||||
// deshalb müssen Zeilen, Breiten und colCount dieselbe Spaltenzahl nutzen,
|
||||
// sonst wirft pdfmake bei einer leeren Rolle einen Layout-Fehler.
|
||||
const displayPeople = [];
|
||||
ROLES.forEach(r => {
|
||||
const list = grouped[r] || [];
|
||||
if(list.length === 0){
|
||||
displayPeople.push({ person: null, role: r });
|
||||
} else {
|
||||
list.forEach(e => displayPeople.push({ person: e.person, role: e.role || r }));
|
||||
}
|
||||
});
|
||||
|
||||
pdfCheckWidth(allPeople);
|
||||
pdfCheckWidth(displayPeople);
|
||||
|
||||
const logo = await loadLogoPng();
|
||||
const colCount = 3 + allPeople.length + LPHS.length;
|
||||
const widths = pdfColumnWidths(allPeople);
|
||||
const colCount = 3 + displayPeople.length + LPHS.length;
|
||||
const widths = pdfColumnWidths(displayPeople);
|
||||
|
||||
// --- Deckblatt ---
|
||||
const cover = [];
|
||||
@@ -521,7 +535,7 @@ async function exportPDF(){
|
||||
const header = pdfHeaderRows(grouped);
|
||||
|
||||
const body = [ pdfGroupTitleRow(groupName, colCount), header[0], header[1] ];
|
||||
projects.forEach((p, i) => body.push(pdfProjectRow(p, allPeople, i % 2 === 0)));
|
||||
projects.forEach((p, i) => body.push(pdfProjectRow(p, displayPeople, i % 2 === 0)));
|
||||
|
||||
content.push({
|
||||
table: { headerRows: 3, widths: widths, body: body, dontBreakRows: true },
|
||||
|
||||
Reference in new issue
Block a user