From 75c319c70137648d0d204de631034f29ff334b3c Mon Sep 17 00:00:00 2001 From: naielv <109038805+naielv@users.noreply.github.com> Date: Thu, 5 Feb 2026 23:57:54 +0100 Subject: [PATCH] update --- src/app_modules.js | 16 +++++++++-- src/page/dataman.js | 27 ------------------ src/page/materiales.js | 64 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 72 insertions(+), 35 deletions(-) diff --git a/src/app_modules.js b/src/app_modules.js index 11cf4f0..f9ba4ff 100644 --- a/src/app_modules.js +++ b/src/app_modules.js @@ -1276,11 +1276,21 @@ function TS_IndexElement( } function BuildQR(mid, label) { + var svgNode = QRCode({ + msg: mid, + dim: 150, + pad: 0, + mtx: -1, + ecl: 'L', + ecb: 0, + pal: ['#000000', '#ffffff'], + vrb: 0, + }); return ` - + QR %%TITLE%% -
${toHtml(quickresponse(mid), [6, 6])}
- ${label} +
${svgNode.outerHTML}
+ ${label || mid}
`; } diff --git a/src/page/dataman.js b/src/page/dataman.js index f6cf968..9df5e96 100644 --- a/src/page/dataman.js +++ b/src/page/dataman.js @@ -43,12 +43,8 @@ PAGES.dataman = { }; }, __export: function () { - var select_type = safeuuid(); - var textarea_content = safeuuid(); var button_export_local = safeuuid(); var button_export_safe = safeuuid(); - var button_export_safe_cloud = safeuuid(); - var button_clear = safeuuid(); container.innerHTML = html`

Exportar Datos

@@ -58,10 +54,6 @@ PAGES.dataman = {
- -
`; document.getElementById(button_export_local).onclick = () => { @@ -130,25 +122,6 @@ PAGES.dataman = { download(`Export %%TITLE%% Encriptado ${getDBName()}.json.txt`, JSON.stringify(result)); })(); }; - // document.getElementById(button_export_safe_cloud).onclick = () => { - // var download_data = (DATA) => { - // toastr.info("Exportado todo, subiendo!"); - // fetch( - // "https://telesec-sync.tech.eus/upload_backup.php?table=" + getDBName(), - // { - // method: "POST", - // body: JSON.stringify(DATA), - // } - // ) - // .then(() => { - // toastr.success("Subido correctamente!"); - // }) - // .catch(() => { - // toastr.error("Ha ocurrido un error en la subida."); - // }); - // }; - // gun.get(TABLE).load(download_data); - // }; }, __import: function () { var select_type = safeuuid(); diff --git a/src/page/materiales.js b/src/page/materiales.js index 1489179..8b9cc0d 100644 --- a/src/page/materiales.js +++ b/src/page/materiales.js @@ -23,13 +23,15 @@ PAGES.materiales = { var FECHA_ISO = new Date().toISOString().split('T')[0]; container.innerHTML = html`

Material

- ${BuildQR('materiales,' + mid, 'Este Material')} + ${BuildQR('materiales,' + mid)}
`; + // Cargar ubicaciones existentes para autocompletar + DB.map('materiales', (data) => { + if (!data) return; + function addUbicacion(d) { + const ubicacion = d.Ubicacion || '-'; + const datalist = document.getElementById(`${field_ubicacion}_list`); + if (!datalist) { + console.warn(`Element with ID "${field_ubicacion}_list" not found.`); + return; + } + const optionExists = Array.from(datalist.options).some((opt) => opt.value === ubicacion); + if (!optionExists) { + const option = document.createElement('option'); + option.value = ubicacion; + datalist.appendChild(option); + } + } + if (typeof data === 'string') { + TS_decrypt( + data, + SECRET, + (data, wasEncrypted) => { + if (data && typeof data === 'object') { + addUbicacion(data); + } + }, + 'materiales', + mid + ); + } else { + addUbicacion(data); + } + }); + + // Cargar datos del material DB.get('materiales', mid).then((data) => { function load_data(data, ENC = '') { document.getElementById(nameh1).innerText = mid;