Add workshop module toggle in Modules & Integrations settings
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled

This commit is contained in:
2026-07-16 08:13:56 +00:00
parent c90012ca37
commit 6d07eab5c0
7 changed files with 46 additions and 6 deletions

View File

@@ -34,6 +34,7 @@ const POS = (() => {
let counterRemissionEnabled = false;
let allowZeroPriceSales = true;
let allowNegativeStock = false;
let workshopModuleEnabled = true;
let currentPerms = [];
let receiptConfig = {};
let couriers = [];
@@ -93,7 +94,7 @@ const POS = (() => {
}
if (!canDiscount) hide('[onclick="POS.applyDiscount()"]');
if (!canEditPrice) hide('[onclick="POS.modifyPrice()"]');
if (!canCreateWorkshopOrder) {
if (!canCreateWorkshopOrder || !workshopModuleEnabled) {
hide('[onclick="POS.createServiceOrder()"]');
hide('[title="Orden de servicio"]');
}
@@ -153,6 +154,14 @@ const POS = (() => {
allowZeroPriceSales = true;
allowNegativeStock = false;
}
// Module toggles (from app-init preloaded modules)
try {
var modules = window.POS_USER && window.POS_USER.modules;
if (!modules) modules = JSON.parse(localStorage.getItem('pos_modules') || '{}');
workshopModuleEnabled = modules.workshop !== false;
} catch (e) {
workshopModuleEnabled = true;
}
// Counter remission workflow applies only to the counter role.
canCreateRemission = counterRemissionEnabled && employeeRole === 'counter' && perms.includes('pos.remission');
@@ -1390,6 +1399,7 @@ const POS = (() => {
// ─── Service Order from POS ──────────
function createServiceOrder() {
if (!workshopModuleEnabled) { showToast('El módulo de taller no está habilitado'); return; }
if (!canCreateWorkshopOrder) { showToast('No tienes permiso para ordenes de taller'); return; }
if (cart.length === 0) { showToast('Carrito vacio'); return; }
const zeroItem = findZeroPriceItem();