fix(historial): corregir SyntaxError por backtick/backslash en renderTabla
- esc() ahora escapa backticks (`) para evitar que nombres de paciente
con backticks rompan el template literal
- onclick simplificado: eliminado .replace(/'/g,\\'\\\\\\'\\'') que era JS
inválido (backslash fuera de string literal dentro de ${}); esc() ya
convierte comillas simples a '
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
25bdf9aed2
commit
7e44fd4050
@@ -255,7 +255,7 @@ let _state = {
|
|||||||
// ── Utilidades ────────────────────────────────────────────────
|
// ── Utilidades ────────────────────────────────────────────────
|
||||||
const esc = s => (s == null ? '' : String(s))
|
const esc = s => (s == null ? '' : String(s))
|
||||||
.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>')
|
.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>')
|
||||||
.replace(/"/g,'"').replace(/'/g,''');
|
.replace(/"/g,'"').replace(/'/g,''').replace(/`/g,'`');
|
||||||
|
|
||||||
function hoy() { return new Date().toISOString().slice(0,10); }
|
function hoy() { return new Date().toISOString().slice(0,10); }
|
||||||
function hace(n){ return new Date(Date.now()-n*86400000).toISOString().slice(0,10); }
|
function hace(n){ return new Date(Date.now()-n*86400000).toISOString().slice(0,10); }
|
||||||
@@ -467,7 +467,7 @@ function renderTabla(turnos) {
|
|||||||
<i class="fas fa-chevron-down" style="font-size:.65rem"></i>
|
<i class="fas fa-chevron-down" style="font-size:.65rem"></i>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-outline-warning py-0 px-2"
|
<button class="btn btn-sm btn-outline-warning py-0 px-2"
|
||||||
onclick="abrirModalEstado(${t.id}, '${t.estado}', '${nombre.replace(/'/g,\'\\\'')}')"
|
onclick="abrirModalEstado(${t.id}, '${t.estado}', '${nombre}')"
|
||||||
title="Cambiar estado">
|
title="Cambiar estado">
|
||||||
<i class="fas fa-exchange-alt" style="font-size:.65rem"></i>
|
<i class="fas fa-exchange-alt" style="font-size:.65rem"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user