update
This commit is contained in:
@@ -1276,11 +1276,21 @@ function TS_IndexElement(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function BuildQR(mid, label) {
|
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 `
|
return `
|
||||||
<span style="border: 2px dashed black; padding: 10px; display: inline-block; background: white; border-radius: 7px; text-align: center; margin: 10px;">
|
<span style="border: 2px dashed black; padding: 10px; display: inline-block; background: white; border-radius: 7px; text-align: center; margin: 5px;">
|
||||||
<b>QR %%TITLE%%</b>
|
<b>QR %%TITLE%%</b>
|
||||||
<br>${toHtml(quickresponse(mid), [6, 6])}<br>
|
<br>${svgNode.outerHTML}<br>
|
||||||
<small>${label}</small>
|
<small>${label || mid}</small>
|
||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,8 @@ PAGES.dataman = {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
__export: function () {
|
__export: function () {
|
||||||
var select_type = safeuuid();
|
|
||||||
var textarea_content = safeuuid();
|
|
||||||
var button_export_local = safeuuid();
|
var button_export_local = safeuuid();
|
||||||
var button_export_safe = safeuuid();
|
var button_export_safe = safeuuid();
|
||||||
var button_export_safe_cloud = safeuuid();
|
|
||||||
var button_clear = safeuuid();
|
|
||||||
container.innerHTML = html`
|
container.innerHTML = html`
|
||||||
<h1>Exportar Datos</h1>
|
<h1>Exportar Datos</h1>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@@ -58,10 +54,6 @@ PAGES.dataman = {
|
|||||||
<br />
|
<br />
|
||||||
<button id="${button_export_local}" type="button">Exportar sin cifrar</button>
|
<button id="${button_export_local}" type="button">Exportar sin cifrar</button>
|
||||||
<button id="${button_export_safe}" type="button">Exportar con cifrado</button>
|
<button id="${button_export_safe}" type="button">Exportar con cifrado</button>
|
||||||
<button id="${button_export_safe_cloud}" style="display: none;" type="button">
|
|
||||||
Exportar a EuskadiTech - cifrado
|
|
||||||
</button>
|
|
||||||
<!--<br><br><em>Para descargar envia un correo a telesec@tech.eus con el asunto "TSBK %${getDBName()}".</em>-->
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
`;
|
`;
|
||||||
document.getElementById(button_export_local).onclick = () => {
|
document.getElementById(button_export_local).onclick = () => {
|
||||||
@@ -130,25 +122,6 @@ PAGES.dataman = {
|
|||||||
download(`Export %%TITLE%% Encriptado ${getDBName()}.json.txt`, JSON.stringify(result));
|
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 () {
|
__import: function () {
|
||||||
var select_type = safeuuid();
|
var select_type = safeuuid();
|
||||||
|
|||||||
@@ -23,13 +23,15 @@ PAGES.materiales = {
|
|||||||
var FECHA_ISO = new Date().toISOString().split('T')[0];
|
var FECHA_ISO = new Date().toISOString().split('T')[0];
|
||||||
container.innerHTML = html`
|
container.innerHTML = html`
|
||||||
<h1>Material <code id="${nameh1}"></code></h1>
|
<h1>Material <code id="${nameh1}"></code></h1>
|
||||||
${BuildQR('materiales,' + mid, 'Este Material')}
|
${BuildQR('materiales,' + mid)}
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label>
|
<label>
|
||||||
Fecha Revisión<br />
|
Fecha Revisión<br />
|
||||||
<input type="date" id="${field_revision}" />
|
<input type="date" id="${field_revision}" />
|
||||||
<a onclick='document.getElementById("${field_revision}").value = "${FECHA_ISO}";'
|
<a
|
||||||
>Hoy - Contado todas las existencias</a
|
onclick='document.getElementById("${field_revision}").value = "${FECHA_ISO}";'
|
||||||
|
style="color: blue;cursor: pointer;font-size: 0.9em;"
|
||||||
|
>Hoy - Contado todas las existencias </a
|
||||||
><br /><br />
|
><br /><br />
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
@@ -38,7 +40,17 @@ PAGES.materiales = {
|
|||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Unidad<br />
|
Unidad<br />
|
||||||
<input type="text" id="${field_unidad}" /><br /><br />
|
<select id="${field_unidad}">
|
||||||
|
<option value="unidad(es)">unidad(es)</option>
|
||||||
|
<option value="paquete(s)">paquete(s)</option>
|
||||||
|
<option value="caja(s)">caja(s)</option>
|
||||||
|
<option value="rollo(s)">rollo(s)</option>
|
||||||
|
<option value="bote(s)">bote(s)</option>
|
||||||
|
|
||||||
|
<option value="metro(s)">metro(s)</option>
|
||||||
|
<option value="litro(s)">litro(s)</option>
|
||||||
|
<option value="kg">kg</option></select
|
||||||
|
><br /><br />
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Cantidad Actual<br />
|
Cantidad Actual<br />
|
||||||
@@ -50,7 +62,14 @@ PAGES.materiales = {
|
|||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Ubicación<br />
|
Ubicación<br />
|
||||||
<input type="text" id="${field_ubicacion}" value="-" /><br /><br />
|
<input
|
||||||
|
type="text"
|
||||||
|
id="${field_ubicacion}"
|
||||||
|
value="-"
|
||||||
|
list="${field_ubicacion}_list"
|
||||||
|
/><br /><br />
|
||||||
|
<!-- Autocompletar con ubicaciones existentes -->
|
||||||
|
<datalist id="${field_ubicacion}_list"></datalist>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Notas<br />
|
Notas<br />
|
||||||
@@ -61,6 +80,41 @@ PAGES.materiales = {
|
|||||||
<button class="rojo" id="${btn_borrar}">Borrar</button>
|
<button class="rojo" id="${btn_borrar}">Borrar</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
`;
|
`;
|
||||||
|
// 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) => {
|
DB.get('materiales', mid).then((data) => {
|
||||||
function load_data(data, ENC = '') {
|
function load_data(data, ENC = '') {
|
||||||
document.getElementById(nameh1).innerText = mid;
|
document.getElementById(nameh1).innerText = mid;
|
||||||
|
|||||||
Reference in New Issue
Block a user