From 37b7f94f54fa20195b6b25f8cd72869f68510cf8 Mon Sep 17 00:00:00 2001 From: consultoria-as Date: Tue, 30 Jun 2026 18:04:22 +0000 Subject: [PATCH] fix(config): saveAll crash when saving modules saveModules() used event.target, which is undefined when called from saveAll. Replaced with direct checkbox lookups and null checks. --- pos/static/js/config.js | 17 +++++++++-------- pos/templates/config.html | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pos/static/js/config.js b/pos/static/js/config.js index 5fcb571..d690dde 100644 --- a/pos/static/js/config.js +++ b/pos/static/js/config.js @@ -964,14 +964,17 @@ const Config = (() => { } async function saveModules() { - var btn = event.target; - if (btn) { btn.disabled = true; btn.textContent = 'Guardando...'; } + var cbWa = document.getElementById('cfg-module-whatsapp'); + var cbMp = document.getElementById('cfg-module-marketplace'); + var cbMeli = document.getElementById('cfg-module-meli'); + var cbCat = document.getElementById('cfg-module-catalog'); + if (!cbWa && !cbMp && !cbMeli && !cbCat) return; try { var data = { - whatsapp: document.getElementById('cfg-module-whatsapp').checked, - marketplace: document.getElementById('cfg-module-marketplace').checked, - meli: document.getElementById('cfg-module-meli').checked, - catalog: document.getElementById('cfg-module-catalog').checked, + whatsapp: cbWa ? cbWa.checked : true, + marketplace: cbMp ? cbMp.checked : true, + meli: cbMeli ? cbMeli.checked : true, + catalog: cbCat ? cbCat.checked : true, }; var res = await fetch(API + '/modules', { method: 'PUT', @@ -986,8 +989,6 @@ const Config = (() => { toast('Módulos actualizados'); } catch (e) { toast(e.message, 'error'); - } finally { - if (btn) { btn.disabled = false; btn.textContent = 'Guardar módulos'; } } } diff --git a/pos/templates/config.html b/pos/templates/config.html index 98aca52..864e274 100644 --- a/pos/templates/config.html +++ b/pos/templates/config.html @@ -928,7 +928,7 @@ - +