From 382e31158ae5cfcb86a729051659ca12f7a08332 Mon Sep 17 00:00:00 2001 From: Naiel <109038805+naielv@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:17:26 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20A=C3=B1adir=20modo=20de=20revisi=C3=B3n?= =?UTF-8?q?=20y=20mejorar=20la=20retroalimentaci=C3=B3n=20en=20el=20panel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/pagos.js | 89 ++--------------------------------------------- src/page/panel.js | 64 ++++++++++++++++++++++++++-------- 2 files changed, 51 insertions(+), 102 deletions(-) diff --git a/src/page/pagos.js b/src/page/pagos.js index d947e88..d6bb70c 100644 --- a/src/page/pagos.js +++ b/src/page/pagos.js @@ -5,8 +5,6 @@ PAGES.pagos = { icon: 'static/appico/credit_cards.png', AccessControl: true, Title: 'Pagos', - CajaCafeID: 'caja_cafe', - CajaCafeNombre: 'Caja Café', __getVisiblePersonas: function () { return Object.fromEntries( @@ -14,70 +12,6 @@ PAGES.pagos = { ); }, - __ensureCajaCafePersona: function () { - var cajaId = PAGES.pagos.CajaCafeID; - var cajaNombre = PAGES.pagos.CajaCafeNombre; - var existing = SC_Personas[cajaId]; - - if (existing && existing.Nombre === cajaNombre && existing.Oculto === true) { - return Promise.resolve(cajaId); - } - - var data = { - Nombre: cajaNombre, - Region: 'Sistema', - Roles: '', - SC_Anilla: '', - markdown: 'Monedero interno de cafetería', - Monedero_Balance: parseFloat((existing && existing.Monedero_Balance) || 0) || 0, - Monedero_Notas: (existing && existing.Monedero_Notas) || '', - Oculto: true, - }; - - return DB.put('personas', cajaId, data) - .then(() => { - SC_Personas[cajaId] = data; - return cajaId; - }) - .catch((e) => { - console.warn('DB.put error', e); - return null; - }); - }, - - __creditCajaCafeForGasto: function (personaOrigenId, monto, callback) { - var cajaId = PAGES.pagos.CajaCafeID; - if (personaOrigenId === cajaId) { - if (callback) callback(); - return; - } - - PAGES.pagos.__ensureCajaCafePersona().then((resolvedCajaId) => { - if (!resolvedCajaId) { - if (callback) callback(); - return; - } - - var caja = SC_Personas[resolvedCajaId]; - if (!caja) { - if (callback) callback(); - return; - } - - var currentBalance = parseFloat(caja.Monedero_Balance || 0); - caja.Monedero_Balance = fixfloat(currentBalance + monto); - - DB.put('personas', resolvedCajaId, caja) - .then(() => { - if (callback) callback(); - }) - .catch((e) => { - console.warn('DB.put error', e); - if (callback) callback(); - }); - }); - }, - // Datafono view for creating/processing transactions datafono: function (prefilledData = {}) { if (!checkRole('pagos:edit')) { @@ -104,8 +38,6 @@ PAGES.pagos = { sessionStorage.removeItem('pagos_scanned_persona'); } - PAGES.pagos.__ensureCajaCafePersona(); - var field_tipo = safeuuid(); var field_monto = safeuuid(); var field_persona = safeuuid(); @@ -577,13 +509,7 @@ PAGES.pagos = { var shouldUpdateBalance = !(tipo === 'Gasto' && metodo === 'Efectivo'); function finalizeTransactionSave() { - if (tipo === 'Gasto') { - PAGES.pagos.__creditCajaCafeForGasto(personaId, monto, () => { - saveTransaction(ticketId, transactionData); - }); - } else { - saveTransaction(ticketId, transactionData); - } + saveTransaction(ticketId, transactionData); } if (shouldUpdateBalance) { @@ -1017,14 +943,7 @@ PAGES.pagos = { }); } else if (tipo === 'Gasto') { revertWalletBalance(personaId, 'Ingreso', monto, () => { - var cajaId = PAGES.pagos.CajaCafeID; - if (personaId === cajaId) { - deleteTransaction(tid); - return; - } - revertWalletBalance(cajaId, 'Gasto', monto, () => { - deleteTransaction(tid); - }); + deleteTransaction(tid); }); } else if (tipo === 'Transferencia') { var destinoId = data.PersonaDestino; @@ -1089,8 +1008,6 @@ PAGES.pagos = { return; } - PAGES.pagos.__ensureCajaCafePersona(); - var btn_datafono = safeuuid(); var total_ingresos = safeuuid(); var total_gastos = safeuuid(); @@ -1373,8 +1290,6 @@ PAGES.pagos = { return; } - PAGES.pagos.__ensureCajaCafePersona(); - var field_tipo = safeuuid(); var field_monto = safeuuid(); var field_persona = safeuuid(); diff --git a/src/page/panel.js b/src/page/panel.js index e71a417..d4198c7 100644 --- a/src/page/panel.js +++ b/src/page/panel.js @@ -276,6 +276,8 @@ PAGES.panel = { answers: {}, score: 0, feedback: '', + feedbackType: '', + reviewMode: false, }; function saveResult() { @@ -299,16 +301,36 @@ PAGES.panel = { .map((option, i) => { var oid = safeuuid(); var checked = selected === option ? 'checked' : ''; + var disabled = state.reviewMode ? 'disabled' : ''; + var optionStyle = + 'display:block;margin: 8px 0;padding: 8px;border: 1px solid #ccc;border-radius: 6px;cursor:pointer;max-width: 150px;text-align: center;'; + + if (state.reviewMode) { + if (option === q.correct) { + optionStyle = + 'display:block;margin: 8px 0;padding: 8px;border: 2px solid #2ed573;background:#eafff1;border-radius: 6px;cursor:pointer;max-width: 150px;text-align: center;'; + } else if (option === selected && option !== q.correct) { + optionStyle = + 'display:block;margin: 8px 0;padding: 8px;border: 2px solid #ff4757;background:#ffecec;border-radius: 6px;cursor:pointer;max-width: 150px;text-align: center;'; + } + } + var optionContent = PAGES.panel.__renderOptionContent(q, option); return ` -