From 483498cfccd1b6430e2bb15f0ff06707a2986bd3 Mon Sep 17 00:00:00 2001 From: consultoria-as Date: Tue, 30 Jun 2026 20:13:32 +0000 Subject: [PATCH] fix: define global toast utility in app-init - Added window.toast() in app-init.js so workshop/customers/inventory pages can use it. - Bumped app-init.js cache version on all templates. --- pos/static/js/app-init.js | 17 +++++++++++++++++ pos/templates/accounting.html | 2 +- pos/templates/catalog.html | 2 +- pos/templates/config.html | 2 +- pos/templates/customers.html | 2 +- pos/templates/dashboard.html | 2 +- pos/templates/diagrams.html | 2 +- pos/templates/fleet.html | 2 +- pos/templates/inventory.html | 2 +- pos/templates/invoicing.html | 2 +- pos/templates/marketplace_external.html | 2 +- pos/templates/pos.html | 2 +- pos/templates/quotations.html | 2 +- pos/templates/reports.html | 2 +- pos/templates/supplier_catalog.html | 2 +- pos/templates/whatsapp.html | 2 +- pos/templates/workshop.html | 2 +- 17 files changed, 33 insertions(+), 16 deletions(-) diff --git a/pos/static/js/app-init.js b/pos/static/js/app-init.js index 2365003..67dbadc 100644 --- a/pos/static/js/app-init.js +++ b/pos/static/js/app-init.js @@ -215,4 +215,21 @@ }); } + // ─── Global toast utility ─── + window.toast = function(msg, type) { + type = type || 'success'; + var bg = type === 'error' ? '#d32f2f' : '#388e3c'; + var el = document.createElement('div'); + el.style.cssText = 'position:fixed;bottom:20px;right:20px;z-index:99999;padding:12px 20px;border-radius:8px;background:' + bg + ';color:#fff;font-weight:500;box-shadow:0 4px 12px rgba(0,0,0,.2);opacity:0;transition:opacity .3s;'; + el.textContent = msg; + document.body.appendChild(el); + // trigger reflow + el.offsetHeight; + el.style.opacity = '1'; + setTimeout(function() { + el.style.opacity = '0'; + setTimeout(function() { if (el.parentNode) el.parentNode.removeChild(el); }, 300); + }, 3000); + }; + })(); diff --git a/pos/templates/accounting.html b/pos/templates/accounting.html index b6a089e..f910c7f 100644 --- a/pos/templates/accounting.html +++ b/pos/templates/accounting.html @@ -493,7 +493,7 @@ - + diff --git a/pos/templates/catalog.html b/pos/templates/catalog.html index 9bbdc4e..d2e3c5d 100644 --- a/pos/templates/catalog.html +++ b/pos/templates/catalog.html @@ -316,7 +316,7 @@ - + diff --git a/pos/templates/config.html b/pos/templates/config.html index ab12c64..7ab31aa 100644 --- a/pos/templates/config.html +++ b/pos/templates/config.html @@ -923,7 +923,7 @@ - + diff --git a/pos/templates/customers.html b/pos/templates/customers.html index 6abf0f3..8fd9fb8 100644 --- a/pos/templates/customers.html +++ b/pos/templates/customers.html @@ -651,7 +651,7 @@ - + diff --git a/pos/templates/dashboard.html b/pos/templates/dashboard.html index dd02d09..db59bc5 100644 --- a/pos/templates/dashboard.html +++ b/pos/templates/dashboard.html @@ -596,7 +596,7 @@ - + diff --git a/pos/templates/diagrams.html b/pos/templates/diagrams.html index 58018b1..c13981f 100644 --- a/pos/templates/diagrams.html +++ b/pos/templates/diagrams.html @@ -150,7 +150,7 @@ - + diff --git a/pos/templates/fleet.html b/pos/templates/fleet.html index be439a0..7242faa 100644 --- a/pos/templates/fleet.html +++ b/pos/templates/fleet.html @@ -303,7 +303,7 @@ - + diff --git a/pos/templates/inventory.html b/pos/templates/inventory.html index df89914..2a52548 100644 --- a/pos/templates/inventory.html +++ b/pos/templates/inventory.html @@ -1059,7 +1059,7 @@ - + diff --git a/pos/templates/invoicing.html b/pos/templates/invoicing.html index 9beb5fd..6796d98 100644 --- a/pos/templates/invoicing.html +++ b/pos/templates/invoicing.html @@ -1064,7 +1064,7 @@ - + diff --git a/pos/templates/marketplace_external.html b/pos/templates/marketplace_external.html index 987da8e..e0ad835 100644 --- a/pos/templates/marketplace_external.html +++ b/pos/templates/marketplace_external.html @@ -343,7 +343,7 @@ - + diff --git a/pos/templates/pos.html b/pos/templates/pos.html index 36d366b..ee5171e 100644 --- a/pos/templates/pos.html +++ b/pos/templates/pos.html @@ -616,7 +616,7 @@ - + diff --git a/pos/templates/quotations.html b/pos/templates/quotations.html index f3d2d96..e01e339 100644 --- a/pos/templates/quotations.html +++ b/pos/templates/quotations.html @@ -15,7 +15,7 @@ - + diff --git a/pos/templates/reports.html b/pos/templates/reports.html index 4479a8d..41d8fe6 100644 --- a/pos/templates/reports.html +++ b/pos/templates/reports.html @@ -366,7 +366,7 @@ - + diff --git a/pos/templates/supplier_catalog.html b/pos/templates/supplier_catalog.html index 3a4395e..8ad58d7 100644 --- a/pos/templates/supplier_catalog.html +++ b/pos/templates/supplier_catalog.html @@ -126,7 +126,7 @@ - + diff --git a/pos/templates/whatsapp.html b/pos/templates/whatsapp.html index 6a3b20b..944766b 100644 --- a/pos/templates/whatsapp.html +++ b/pos/templates/whatsapp.html @@ -132,7 +132,7 @@ function posLogout(){localStorage.removeItem('pos_token');window.location.href=' - + diff --git a/pos/templates/workshop.html b/pos/templates/workshop.html index cd5d2bb..1d88cc5 100644 --- a/pos/templates/workshop.html +++ b/pos/templates/workshop.html @@ -478,7 +478,7 @@ - +