Update lab_formulario_builder.php
This commit is contained in:
@@ -983,6 +983,9 @@ async function guardar() {
|
||||
$('tb-nombre').classList.remove('is-invalid');
|
||||
|
||||
const usarGlobal = $('tb-usar-global').checked;
|
||||
// Sincronizar modos ANTES de serializar el esquema
|
||||
const _modos = []; if($('tb-firma-canvas').checked)_modos.push('canvas'); if($('tb-firma-foto').checked)_modos.push('foto');
|
||||
_campos = _campos.map(c => c.tipo === 'firma' ? { ...c, modos: _modos.length ? _modos : ['canvas','foto'] } : c);
|
||||
const datos = {
|
||||
nombre,
|
||||
descripcion: $('tb-descripcion').value.trim() || null,
|
||||
@@ -990,12 +993,6 @@ async function guardar() {
|
||||
esquema: JSON.stringify(_campos),
|
||||
permite_firma: $('tb-firma').checked ? 1 : 0,
|
||||
requiere_firma: $('tb-firma-req').checked ? 1 : 0,
|
||||
// Sincronizar modos en el campo firma del esquema
|
||||
...(() => {
|
||||
const _modos = []; if($('tb-firma-canvas').checked)_modos.push('canvas'); if($('tb-firma-foto').checked)_modos.push('foto');
|
||||
_campos = _campos.map(c => c.tipo === 'firma' ? { ...c, modos: _modos.length ? _modos : ['canvas','foto'] } : c);
|
||||
return {};
|
||||
})(),
|
||||
doc_encabezado: usarGlobal ? null : ($('tb-doc-encabezado').value.trim() || null),
|
||||
doc_subtitulo: usarGlobal ? null : ($('tb-doc-subtitulo').value.trim() || null),
|
||||
doc_color: usarGlobal ? null : ($('tb-doc-color').value || null),
|
||||
|
||||
Reference in New Issue
Block a user