From 8ea11800412e2abc959a16b3d98674dde34268c5 Mon Sep 17 00:00:00 2001 From: data Date: Sun, 1 Mar 2026 19:48:25 +0100 Subject: [PATCH] PWA: Merkzettel-Box auf Produktliste, Checkboxen-Fix, qty_done=1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PWA Panel 2: Merkzettel-Notizen über der Produktliste anzeigen (wie auf Website stundenzettel_commande.php), mit Abhaken + Hinzufügen - stundenzettel_commande.php: Grüne Haken entfernt, immer Checkboxen - Produktübernahme: qty_done immer 1 statt Auftragsmenge - Cache-Busting v2.7 → v2.8 Co-Authored-By: Claude Opus 4.6 --- css/pwa.css | 74 ++++++++++++++++++++++++++++++++++++++ js/pwa.js | 68 +++++++++++++++++++++++++++++++++++ pwa.php | 4 +-- stundenzettel_commande.php | 15 +++----- 4 files changed, 149 insertions(+), 12 deletions(-) diff --git a/css/pwa.css b/css/pwa.css index c8ede4e..0d2b5df 100644 --- a/css/pwa.css +++ b/css/pwa.css @@ -685,6 +685,80 @@ body { outline: none; } +/* === Merkzettel-Box (Panel 2, wie stundenzettel_commande.php) === */ +.merkzettel-box { + background: var(--colorbackcard); + border-left: 3px solid var(--warning); + border-radius: 10px; + padding: 12px 14px; + margin-bottom: 12px; +} +.merkzettel-box-header { + display: flex; + align-items: center; + gap: 8px; + margin-bottom: 8px; + font-size: 14px; +} +.merkzettel-box-icon { + font-size: 16px; +} +.merkzettel-box .opac { + color: var(--colortextmuted); + font-weight: normal; + font-size: 12px; +} +.merkzettel-box-list { + list-style: none; + margin: 0; + padding: 0; +} +.merkzettel-box-item { + display: flex; + align-items: flex-start; + gap: 10px; + padding: 6px 0; +} +.merkzettel-box-item .note-checkbox, +.merkzettel-box-item .note-checkbox-ro { + width: 22px; + height: 22px; + flex-shrink: 0; + font-size: 18px; + color: var(--colortextmuted); +} +.merkzettel-box-item .note-checkbox { + cursor: pointer; +} +.merkzettel-box-item .note-checkbox.checked { + color: var(--success); +} +.merkzettel-box-item .note-text { + flex: 1; + font-size: 14px; + word-break: break-word; +} +.merkzettel-box-item .note-text.checked { + text-decoration: line-through; + color: var(--colortextmuted); +} +.merkzettel-box-add { + display: flex; + gap: 8px; + margin-top: 8px; +} +.merkzettel-box-add input { + flex: 1; + padding: 8px 12px; + background: var(--colorbackinput); + border: 1px solid var(--colorborder); + border-radius: 8px; + color: var(--colortext); + font-size: 14px; + min-height: 40px; + outline: none; +} + /* === Tracking-Cards === */ .tracking-card { background: var(--colorbackcard); diff --git a/js/pwa.js b/js/pwa.js index 95cfd0f..eba0a47 100644 --- a/js/pwa.js +++ b/js/pwa.js @@ -1058,6 +1058,52 @@ var canWrite = self.state.canWrite; var hasSelectable = false; var activeFilter = self.state.productFilter || 'open'; + var isDraft = stz && stz.status == 0; + + // Merkzettel-Notizen oben anzeigen (wie stundenzettel_commande.php) + if (self.data.notes && self.data.notes.length) { + html += '
'; + html += '
'; + html += '📋'; + html += 'Merkzettel'; + if (stz) html += ' (' + self.escHtml(stz.ref) + ')'; + html += '
'; + html += '
    '; + self.data.notes.forEach(function(n) { + var checked = n.checked == 1; + html += '
  • '; + if (isDraft && canWrite) { + html += ''; + html += checked ? '☑' : '☐'; + html += ''; + } else { + html += '' + (checked ? '☑' : '☐') + ''; + } + html += '' + self.escHtml(n.note) + ''; + html += '
  • '; + }); + html += '
'; + // Notiz-Input (nur im Entwurf) + if (isDraft && canWrite) { + html += '
'; + html += ''; + html += ''; + html += '
'; + } + html += '
'; + } else if (isDraft && canWrite) { + // Leere Box mit nur Input zum Hinzufuegen + html += '
'; + html += '
'; + html += '📋'; + html += 'Merkzettel'; + html += '
'; + html += '
'; + html += ''; + html += ''; + html += '
'; + html += '
'; + } // Filter-Buttons (wie Desktop: Offen/Erledigt/Alle) html += '
'; @@ -1248,6 +1294,13 @@ $panel.find('.btn-create-new-stz').on('click', function() { self.showCreateStzDialog(); }); + + // Merkzettel auf Panel 2: Abhaken + Hinzufuegen + $panel.find('.merkzettel-box .note-checkbox').on('click', function() { + self.toggleNote($(this).data('id'), $(this).data('checked')); + }); + $('#btn-add-note-p2').on('click', function() { self.addNoteFromPanel2(); }); + $('#note-input-p2').on('keypress', function(e) { if (e.which === 13) self.addNoteFromPanel2(); }); }, renderProductCard: function(p, isDraft, canWrite) { @@ -1664,6 +1717,21 @@ }); }, + addNoteFromPanel2: function() { + var self = this; + var text = $('#note-input-p2').val().trim(); + if (!text) return; + + self.api('add_note', {stz_id: self.state.stzId, note: text}).then(function(res) { + if (res.success) { + $('#note-input-p2').val(''); + self.reloadData(); + } else { + self.showToast(res.error || 'Fehler', 'error'); + } + }); + }, + toggleNote: function(id, checked) { var self = this; self.api('toggle_note', {note_id: id, checked: checked, stz_id: self.state.stzId}).then(function(res) { diff --git a/pwa.php b/pwa.php index f97f49a..50ec86e 100644 --- a/pwa.php +++ b/pwa.php @@ -38,7 +38,7 @@ $themeColor = getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#4390dc'); - + @@ -160,7 +160,7 @@ $themeColor = getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#4390dc'); authUrl: '' }; - +