From 883ea17267d0973c414193e4f6930cb538c9f250 Mon Sep 17 00:00:00 2001 From: Eduard Wisch Date: Wed, 8 Apr 2026 23:30:07 +0200 Subject: [PATCH] fix: PDF/sonstige Dateien aus Foto-Grid filtern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Das Auftrags-Anhang-Verzeichnis enthält nicht nur Bilder sondern auch das Auftrags-PDF. Das wurde von photo.php korrekt als application/pdf ausgeliefert, aber die PWA zeigte einen roten Placeholder. Fix: listOrderPhotos-Result vor dem Rendern nach mime-Type filtern. Bilder kommen in die photo-grid, PDFs/andere Dokumente in eine separate 'Weitere Dokumente'-Sektion darunter. Co-Authored-By: Claude Opus 4.6 (1M context) [deploy] --- app.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 9358a48..d3f9d6c 100644 --- a/app.js +++ b/app.js @@ -124,6 +124,10 @@ router.on('/orders/:id', async (args) => { const photos = await api.listOrderPhotos(args.id).catch(() => ({ photos: [] })); title(data.order.ref); + // Nur Bilder in der Foto-Grid zeigen; alles andere (PDFs etc.) unten auflisten + const imagePhotos = photos.photos.filter(p => (p.mime || '').startsWith('image/')); + const otherDocs = photos.photos.filter(p => !(p.mime || '').startsWith('image/')); + main().innerHTML = `

Kunde

@@ -145,11 +149,16 @@ router.on('/orders/:id', async (args) => {
-

Hochgeladene Fotos (${photos.photos.length})

+

Hochgeladene Fotos (${imagePhotos.length})

- ${photos.photos.map(p => `
`).join('')} + ${imagePhotos.map(p => `
`).join('')}
+ ${otherDocs.length ? ` +
+

Weitere Dokumente (${otherDocs.length})

+ ${otherDocs.map(p => `

📄 ${escapeHtml(p.filename)}

`).join('')} +
` : ''} `; loadThumbs(); @@ -166,8 +175,9 @@ router.on('/orders/:id', async (args) => { // Reload Photo-Liste try { const np = await api.listOrderPhotos(args.id); + const imgs = np.photos.filter(p => (p.mime || '').startsWith('image/')); document.getElementById('photo-grid').innerHTML = - np.photos.map(p => `
`).join(''); + imgs.map(p => `
`).join(''); loadThumbs(); } catch (e) {} }