BugFix Projektauswertung

This commit is contained in:
2026-03-12 18:05:02 +01:00
parent af20dc6bd8
commit 8595b099db
2 changed files with 57 additions and 39 deletions

View File

@@ -289,7 +289,7 @@
</div>
<div class="pdf-viewer-wrapper">
<iframe
src="/api/timesheet/pdf/<%= ts.id %>?inline=true"
data-src="/api/timesheet/pdf/<%= ts.id %>?inline=true"
class="pdf-iframe"
frameborder="0"
type="application/pdf"
@@ -939,7 +939,7 @@
});
});
// PDF-Vorschau ein-/ausblenden
// PDF-Vorschau ein-/ausblenden (PDF erst bei Klick laden)
document.querySelectorAll('.toggle-pdf-btn').forEach(btn => {
btn.addEventListener('click', function() {
const timesheetId = this.dataset.timesheetId;
@@ -965,11 +965,12 @@
arrowIcon.textContent = '▼';
this.classList.add('active');
// Setze iframe src wenn noch nicht gesetzt (für besseres Laden)
// iframe-src erst jetzt setzen (lazy load), falls noch nicht gesetzt
if (iframe) {
const currentSrc = iframe.src || iframe.getAttribute('src');
if (!currentSrc || !currentSrc.includes('inline=true')) {
iframe.src = `/api/timesheet/pdf/${timesheetId}?inline=true`;
const currentSrc = iframe.getAttribute('src');
if (!currentSrc) {
const dataSrc = iframe.getAttribute('data-src') || `/api/timesheet/pdf/${timesheetId}?inline=true`;
iframe.setAttribute('src', dataSrc);
}
}