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.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user