Add workshop module toggle in Modules & Integrations settings
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user