diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/ChangeLog.md b/ChangeLog.md index b281a43..9b6f5cc 100755 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -25,9 +25,24 @@ ### UI/UX - **Kompakterer Scan-Button**: Mehr Platz für Tool-Buttons -- **Swipe-Hinweis**: Visueller Hinweis "← Bestellungen" im Order-Mode - **Service Worker v5.3**: Aktualisiertes Caching mit JsBarcode-Library +## 5.1 + +### Bestellungen verwalten +- **Bestellung löschen**: Lösch-Button (Papierkorb-Icon) an jeder Entwurfs-Bestellung +- **Bestätigungsdialog**: Sicherheitsabfrage vor dem Löschen einer Bestellung +- **Freitext-Zeilen bearbeiten**: Beschreibung und Menge von Freitext-Positionen änderbar +- **Lieferant merken**: Zuletzt verwendeter Freitext-Lieferant wird für nächsten Eintrag vorausgewählt + +### Dark Theme Verbesserungen +- **Bestellzeilen**: Korrektes Styling im Dark Theme (war weiß/unleserlich) +- **Dialoge**: Alle Dialoge mit konsistenten Dark Theme Farben +- **Aktive Bestellung**: Bessere Hervorhebung der aktiven Bestellung + +### Entfernt +- Swipe-Hinweis-Button (überflüssig, Swipe ist intuitiv) + ## 4.7 - PWA-Link auf der Scanner-Seite angezeigt (korrekter externer Hostname statt interner IP) diff --git a/ajax/addfreetextline.php b/ajax/addfreetextline.php old mode 100644 new mode 100755 diff --git a/ajax/deleteorder.php b/ajax/deleteorder.php new file mode 100644 index 0000000..f5d9b05 --- /dev/null +++ b/ajax/deleteorder.php @@ -0,0 +1,74 @@ + + * + * AJAX: Delete entire order + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} + +// Load Dolibarr environment +$res = 0; +if (!$res && file_exists("../../main.inc.php")) { + $res = @include "../../main.inc.php"; +} +if (!$res && file_exists("../../../main.inc.php")) { + $res = @include "../../../main.inc.php"; +} +if (!$res && file_exists("../../../../main.inc.php")) { + $res = @include "../../../../main.inc.php"; +} +if (!$res) { + die(json_encode(['success' => false, 'error' => 'Failed to load Dolibarr'])); +} + +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + +header('Content-Type: application/json; charset=utf-8'); + +// Security check +if (!$user->hasRight('fournisseur', 'commande', 'supprimer') && !$user->hasRight('supplier_order', 'supprimer')) { + echo json_encode(['success' => false, 'error' => 'Keine Berechtigung zum Löschen']); + exit; +} + +$orderId = GETPOSTINT('order_id'); + +if (empty($orderId)) { + echo json_encode(['success' => false, 'error' => 'Missing order_id']); + exit; +} + +$order = new CommandeFournisseur($db); +if ($order->fetch($orderId) <= 0) { + echo json_encode(['success' => false, 'error' => 'Bestellung nicht gefunden']); + exit; +} + +// Only allow deletion of draft orders +if ($order->statut != 0) { + echo json_encode(['success' => false, 'error' => 'Nur Entwürfe können gelöscht werden']); + exit; +} + +$result = $order->delete($user); + +if ($result < 0) { + echo json_encode(['success' => false, 'error' => 'Löschen fehlgeschlagen: ' . $order->error]); + exit; +} + +echo json_encode([ + 'success' => true, + 'message' => 'Bestellung gelöscht' +]); diff --git a/ajax/getorderlines.php b/ajax/getorderlines.php old mode 100644 new mode 100755 index 6e2be51..cc14753 --- a/ajax/getorderlines.php +++ b/ajax/getorderlines.php @@ -82,11 +82,13 @@ foreach ($order->lines as $line) { 'product_id' => (int) $line->fk_product, 'product_ref' => $productRef, 'product_label' => $productLabel, + 'description' => $line->desc ?: '', 'qty' => (float) $line->qty, 'price' => (float) $line->subprice, 'total_ht' => (float) $line->total_ht, 'stock' => $stock, - 'ref_fourn' => $line->ref_fourn ?: '' + 'ref_fourn' => $line->ref_fourn ?: '', + 'is_freetext' => empty($line->fk_product) ? true : false ]; } diff --git a/ajax/getorders.php b/ajax/getorders.php old mode 100644 new mode 100755 diff --git a/ajax/searchproduct.php b/ajax/searchproduct.php old mode 100644 new mode 100755 diff --git a/ajax/updateorderline.php b/ajax/updateorderline.php old mode 100644 new mode 100755 index 139fc3c..5db9c98 --- a/ajax/updateorderline.php +++ b/ajax/updateorderline.php @@ -105,15 +105,19 @@ if ($action === 'delete') { } elseif ($action === 'update') { $newQty = GETPOSTFLOAT('qty'); + $newDesc = GETPOST('description', 'restricthtml'); if ($newQty <= 0) { echo json_encode(['success' => false, 'error' => 'Quantity must be greater than 0']); exit; } + // Use new description if provided, otherwise keep existing + $description = !empty($newDesc) ? $newDesc : $targetLine->desc; + $result = $order->updateline( $lineId, - $targetLine->desc, + $description, $targetLine->subprice, $newQty, $targetLine->remise_percent, diff --git a/css/scanner.css b/css/scanner.css index 8e94692..6db0583 100755 --- a/css/scanner.css +++ b/css/scanner.css @@ -933,8 +933,8 @@ } .order-card.active { - border-color: var(--butactionbg, #0077b3); - background: rgba(0, 119, 179, 0.05); + border-color: var(--butactionbg, #ad8c4f); + background: rgba(173, 140, 79, 0.15); } .order-card.direkt { @@ -955,7 +955,7 @@ .order-card-ref { font-size: 12px; - color: #666; + color: var(--colortextmuted, #b4b4b4); margin-bottom: 4px; } @@ -981,7 +981,41 @@ .order-card-info { margin-top: 8px; font-size: 11px; - color: #888; + color: var(--colortextmuted, #b4b4b4); +} + +/* Order delete button */ +.order-delete-btn { + position: absolute; + top: 8px; + right: 8px; + width: 28px; + height: 28px; + border: none; + background: transparent; + color: var(--colortextmuted, #888); + cursor: pointer; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.2s ease; + opacity: 0.6; +} + +.order-delete-btn:hover { + background: var(--danger, #993013); + color: #fff; + opacity: 1; +} + +.order-delete-btn svg { + width: 16px; + height: 16px; +} + +.order-card { + position: relative; } /* Order detail panel */ @@ -1037,16 +1071,18 @@ align-items: center; justify-content: space-between; padding: 12px; - background: var(--colorbacklinepair1, #f8f8f8); - border: 1px solid var(--colorborder, #ddd); + background: var(--colorbackline, #38393d); + border: 1px solid var(--colorborder, #2b2c2e); border-radius: 6px; margin-bottom: 8px; cursor: pointer; transition: all 0.2s ease; + color: var(--colortext, #dcdcdc); } .order-line:hover { - background: var(--colorbacklinepair2, #f0f0f0); + background: var(--colorbacktitle, #3b3c3e); + border-color: var(--butactionbg, #ad8c4f); } .order-line-info { @@ -1064,7 +1100,7 @@ .order-line-ref { font-size: 11px; - color: #888; + color: var(--colortextmuted, #b4b4b4); margin-top: 2px; } @@ -1092,22 +1128,24 @@ } .line-edit-content { - background: #fff; + background: var(--colorbackcard, #1d1e20); + color: var(--colortext, #dcdcdc); border-radius: 12px; padding: 20px; width: 100%; max-width: 350px; - box-shadow: 0 10px 40px rgba(0,0,0,0.3); + box-shadow: 0 10px 40px rgba(0,0,0,0.5); } .line-edit-title { font-size: 16px; font-weight: 600; margin-bottom: 15px; + color: var(--colortext, #dcdcdc); } .line-edit-info { - background: var(--colorbacklinepair1, #f8f8f8); + background: var(--colorbackline, #38393d); padding: 12px; border-radius: 6px; margin-bottom: 15px; @@ -1115,10 +1153,32 @@ .line-edit-stock { font-size: 13px; - color: #666; + color: var(--colortextmuted, #b4b4b4); margin-bottom: 8px; } +.line-edit-desc { + margin-bottom: 15px; +} + +.line-edit-desc label { + display: block; + font-size: 14px; + font-weight: 500; + margin-bottom: 6px; + color: var(--colortext, #dcdcdc); +} + +.line-edit-desc input { + width: 100%; + padding: 10px; + font-size: 14px; + border: 1px solid var(--colorborder, #2b2c2e); + border-radius: 6px; + background: var(--colorbackinput, #464646); + color: var(--colortext, #dcdcdc); +} + .line-edit-qty { display: flex; align-items: center; @@ -1129,6 +1189,7 @@ .line-edit-qty label { font-size: 14px; font-weight: 500; + color: var(--colortext, #dcdcdc); } .line-edit-qty input { @@ -1137,8 +1198,10 @@ text-align: center; font-size: 16px; font-weight: 600; - border: 1px solid var(--colorborder, #ddd); + border: 1px solid var(--colorborder, #2b2c2e); border-radius: 6px; + background: var(--colorbackinput, #464646); + color: var(--colortext, #dcdcdc); } .line-edit-buttons { diff --git a/js/scanner.js b/js/scanner.js index 39c3935..e51bcd5 100755 --- a/js/scanner.js +++ b/js/scanner.js @@ -46,6 +46,7 @@ let allSuppliers = []; let quaggaInitialized = false; let openDialogCount = 0; // Zaehlt offene Dialoge + let lastFreetextSupplierId = null; // Zuletzt verwendeter Freitext-Lieferant // Order overview state let lastOrderId = null; @@ -865,7 +866,7 @@