fix(pos): hide Sistema button for non-admin roles and allow login/logout in page guard
This commit is contained in:
@@ -221,6 +221,9 @@
|
||||
return ['/pos/sale','/pos/catalog','/pos/inventory','/pos/customers','/pos/workshop','/pos/remission-notes','/pos/invoicing','/pos/reports'].indexOf(pagePath) !== -1;
|
||||
}
|
||||
|
||||
// Always allow login/logout pages so users can sign out without hitting the guard.
|
||||
if (pagePath === '/pos/login' || pagePath === '/pos/logout') return true;
|
||||
|
||||
// Any other role (accountant, warehouse, sales, etc.) keeps the previous permissive behavior.
|
||||
return true;
|
||||
}
|
||||
@@ -280,6 +283,15 @@
|
||||
}).catch(function() {});
|
||||
} catch(e) {}
|
||||
|
||||
// ─── Hide POS "Sistema" button for roles that cannot access the dashboard ───
|
||||
(function hideBackToSystemForRestrictedRoles() {
|
||||
var backBtn = document.getElementById('backToSystemBtn');
|
||||
if (!backBtn) return;
|
||||
// owner/admin are the only roles that should see the dashboard shortcut from POS.
|
||||
if (role === 'owner' || role === 'admin') return;
|
||||
backBtn.style.display = 'none';
|
||||
})();
|
||||
|
||||
// ─── Service Worker update handler ───
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.addEventListener('message', function (event) {
|
||||
|
||||
Reference in New Issue
Block a user