turnero: reemplazar alert() de Topaz SigWeb por toast no bloqueante

El alert() bloqueaba la UI. Ahora muestra un banner flotante de 5s
que no interrumpe el flujo y sugiere usar firma manual como alternativa.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-21 10:49:01 -05:00
co-authored by Claude Sonnet 4.6
parent 992ce9d663
commit 4a5e5fd9c9
+14 -3
View File
@@ -2550,6 +2550,17 @@ const topaz = (() => {
});
}
function _toast(msg) {
const t = document.createElement('div');
t.style.cssText = 'position:fixed;bottom:24px;left:50%;transform:translateX(-50%);'
+ 'background:#1e293b;color:#fff;padding:12px 22px;border-radius:10px;'
+ 'font-size:.88rem;z-index:99999;box-shadow:0 4px 16px rgba(0,0,0,.3);'
+ 'max-width:90vw;text-align:center;line-height:1.5';
t.innerHTML = '<i class="fas fa-exclamation-circle me-2" style="color:#f59e0b"></i>' + msg;
document.body.appendChild(t);
setTimeout(() => t.remove(), 5000);
}
function _setStatus(msg, ok) {
const el = document.getElementById('topaz-status-msg');
if (el) { el.textContent = msg; el.style.color = ok ? '#198754' : '#64748b'; }
@@ -2562,7 +2573,7 @@ const topaz = (() => {
async function activar(target) {
const ok = await _loadScript();
if (!ok) {
alert('No se detectó SigWeb.\nInstala el servicio Topaz SigWeb y vuelve a intentarlo.');
_toast('Pad biométrico no disponible en este equipo.<br>Instala el servicio Topaz SigWeb o usa la firma manual.');
return;
}
_target = target;
@@ -2574,7 +2585,7 @@ const topaz = (() => {
_call('SetTabletState', 1);
_call('ClearTablet');
} catch(e) {
alert('Error al activar el pad: ' + e.message); return;
_toast('Error al activar el pad: ' + e.message); return;
}
document.getElementById('topaz-overlay').style.display = 'flex';
document.getElementById('topaz-btn-aceptar').disabled = true;
@@ -2614,7 +2625,7 @@ const topaz = (() => {
try { b64 = _call('GetSigImageB64'); } catch(e) {
alert('Error al capturar la firma: ' + e.message); _cerrar(); return;
}
if (!b64) { alert('No se capturó ninguna firma.'); return; }
if (!b64) { _toast('No se capturó ninguna firma.'); return; }
const target = _target;
_cerrar();
const img = new Image();