@@ -778,32 +778,25 @@ function TS_IndexElement(
|
||||
var lastSearchValue = "";
|
||||
var lastFilteredSorted = [];
|
||||
function sorter(a, b) {
|
||||
if (a.Fecha && b.Fecha) {
|
||||
if (a.Fecha < b.Fecha) return -1;
|
||||
if (a.Fecha > b.Fecha) return 1;
|
||||
if (a.Nombre && b.Nombre) {
|
||||
const nameA = a.Nombre.toLowerCase();
|
||||
const nameB = b.Nombre.toLowerCase();
|
||||
if (nameA < nameB) return -1;
|
||||
if (nameA > nameB) return 1;
|
||||
}
|
||||
return 0;
|
||||
// 1. Fecha (ascending)
|
||||
if (a.Fecha && b.Fecha && a.Fecha !== b.Fecha) {
|
||||
return a.Fecha < b.Fecha ? -1 : 1;
|
||||
}
|
||||
if (a.Persona && b.Persona) {
|
||||
const personaA = SC_Personas[a.Persona] || { Nombre: "", Region: "" };
|
||||
const personaB = SC_Personas[b.Persona] || { Nombre: "", Region: "" };
|
||||
if (personaA.Region < personaB.Region) return -1;
|
||||
if (personaA.Region > personaB.Region) return 1;
|
||||
if (personaA.Nombre < personaB.Nombre) return -1;
|
||||
if (personaA.Nombre > personaB.Nombre) return 1;
|
||||
return 0;
|
||||
// 2. Region (ascending, from SC_Personas if Persona exists)
|
||||
const regionA = a.Persona && SC_Personas[a.Persona] ? SC_Personas[a.Persona].Region || "" : "";
|
||||
const regionB = b.Persona && SC_Personas[b.Persona] ? SC_Personas[b.Persona].Region || "" : "";
|
||||
if (regionA !== regionB) {
|
||||
return regionA < regionB ? -1 : 1;
|
||||
}
|
||||
if (a.Nombre && b.Nombre) {
|
||||
const nameA = a.Nombre.toLowerCase();
|
||||
const nameB = b.Nombre.toLowerCase();
|
||||
if (nameA < nameB) return -1;
|
||||
if (nameA > nameB) return 1;
|
||||
return 0;
|
||||
// 3. Persona (Nombre, ascending, from SC_Personas if Persona exists)
|
||||
const nombrePersonaA = a.Persona && SC_Personas[a.Persona] ? SC_Personas[a.Persona].Nombre || "" : "";
|
||||
const nombrePersonaB = b.Persona && SC_Personas[b.Persona] ? SC_Personas[b.Persona].Nombre || "" : "";
|
||||
if (nombrePersonaA !== nombrePersonaB) {
|
||||
return nombrePersonaA.toLowerCase() < nombrePersonaB.toLowerCase() ? -1 : 1;
|
||||
}
|
||||
// 4. Nombre (ascending, from a.Nombre/b.Nombre)
|
||||
if (a.Nombre && b.Nombre && a.Nombre !== b.Nombre) {
|
||||
return a.Nombre.toLowerCase() < b.Nombre.toLowerCase() ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ PAGES.aulas = {
|
||||
Asunto<br>
|
||||
<input type="text" id="${field_asunto}" value=""><br><br>
|
||||
</label>
|
||||
<input type="hidden" id="${field_autor}" readonly value="${SUB_LOGGED_IN_ID || ""}">
|
||||
<input type="hidden" id="${field_autor}" readonly value="">
|
||||
</div>
|
||||
<label>
|
||||
Contenido - ¡Incluye el material a solicitar!<br>
|
||||
@@ -134,7 +134,7 @@ PAGES.aulas = {
|
||||
document.getElementById(field_asunto).value = data["Asunto"] || "";
|
||||
document.getElementById(field_contenido).value =
|
||||
data["Contenido"] || "";
|
||||
document.getElementById(field_autor).value = data["Solicitante"] || "";
|
||||
document.getElementById(field_autor).value = data["Solicitante"] || SUB_LOGGED_IN_ID || "";
|
||||
}
|
||||
if (typeof data == "string") {
|
||||
TS_decrypt(data, SECRET, (data) => {
|
||||
@@ -244,10 +244,10 @@ PAGES.aulas = {
|
||||
<div style="max-width: 400px;">
|
||||
<label>
|
||||
Asunto<br>
|
||||
<input type="text" id="${field_asunto}" value="${title}"><br><br>
|
||||
<input type="text" id="${field_asunto}" value=""><br><br>
|
||||
</label>
|
||||
<input type="hidden" id="${field_autor}" readonly value="${SUB_LOGGED_IN_ID || ""}">
|
||||
<input type="hidden" id="${field_fecha}" value="${mid.startsWith("diario-") ? mid.replace("diario-", "") : CurrentISODate()}">
|
||||
<input type="hidden" id="${field_autor}" readonly value="">
|
||||
<input type="hidden" id="${field_fecha}" value="">
|
||||
</div>
|
||||
<label>
|
||||
Contenido<br>
|
||||
@@ -265,11 +265,11 @@ PAGES.aulas = {
|
||||
.once((data, key) => {
|
||||
function load_data(data, ENC = "") {
|
||||
document.getElementById(nameh1).innerText = key;
|
||||
document.getElementById(field_asunto).value = data["Asunto"] || "";
|
||||
document.getElementById(field_asunto).value = data["Asunto"] || title || "";
|
||||
document.getElementById(field_contenido).value =
|
||||
data["Contenido"] || "";
|
||||
document.getElementById(field_autor).value = data["Autor"] || "";
|
||||
document.getElementById(field_fecha).value = data["Fecha"] || CurrentISODate();
|
||||
document.getElementById(field_autor).value = data["Autor"] || SUB_LOGGED_IN_ID || "";
|
||||
document.getElementById(field_fecha).value = data["Fecha"] || mid.startsWith("diario-") ? mid.replace("diario-", "") : CurrentISODate();
|
||||
}
|
||||
if (typeof data == "string") {
|
||||
TS_decrypt(data, SECRET, (data) => {
|
||||
|
||||
@@ -26,7 +26,7 @@ PAGES.avisos = {
|
||||
<legend>Valores</legend>
|
||||
<label>
|
||||
Fecha<br>
|
||||
<input readonly disabled type="text" id="${field_fecha}" value="${CurrentISODate()}"><br><br>
|
||||
<input readonly disabled type="text" id="${field_fecha}" value=""><br><br>
|
||||
</label>
|
||||
<label>
|
||||
Asunto<br>
|
||||
@@ -45,7 +45,7 @@ PAGES.avisos = {
|
||||
</label>
|
||||
<label>
|
||||
Estado<br>
|
||||
<input readonly disabled type="text" id="${field_estado}" value="%%">
|
||||
<input readonly disabled type="text" id="${field_estado}" value="">
|
||||
<br>
|
||||
<button id="${btn_leer}">Leido</button>
|
||||
<button id="${btn_desleer}">No leido</button>
|
||||
@@ -87,14 +87,14 @@ PAGES.avisos = {
|
||||
.once((data, key) => {
|
||||
function load_data(data, ENC = "") {
|
||||
document.getElementById(nameh1).innerText = key;
|
||||
document.getElementById(field_fecha).value = data["Fecha"];
|
||||
document.getElementById(field_fecha).value = data["Fecha"] || CurrentISODate() || "";
|
||||
document.getElementById(field_asunto).value = data["Asunto"] || "";
|
||||
document.getElementById(field_mensaje).value =
|
||||
data["Mensaje"] || "";
|
||||
document.getElementById(field_origen).value = data["Origen"] || "";
|
||||
document.getElementById(field_destino).value =
|
||||
data["Destino"] || "";
|
||||
document.getElementById(field_estado).value = data["Estado"] || "";
|
||||
document.getElementById(field_estado).value = data["Estado"] || "%%" || "";
|
||||
document.getElementById(field_respuesta).value =
|
||||
data["Respuesta"] || "";
|
||||
|
||||
|
||||
@@ -13,21 +13,21 @@ PAGES.comedor = {
|
||||
var btn_guardar = safeuuid();
|
||||
var btn_borrar = safeuuid();
|
||||
container.innerHTML = `
|
||||
<h1>Entrada del menú <code id="${nameh1}"></code></h1>
|
||||
<fieldset style="float: left;">
|
||||
<legend>Valores</legend>
|
||||
<label>
|
||||
Fecha<br>
|
||||
<input type="date" id="${field_fecha}" value="${CurrentISODate()}"><br><br>
|
||||
</label>
|
||||
<label>
|
||||
Platos<br>
|
||||
<textarea id="${field_platos}"></textarea><br><br>
|
||||
</label>
|
||||
<button class="btn5" id="${btn_guardar}">Guardar</button>
|
||||
<button class="rojo" id="${btn_borrar}">Borrar</button>
|
||||
</fieldset>
|
||||
`;
|
||||
<h1>Entrada del menú <code id="${nameh1}"></code></h1>
|
||||
<fieldset style="float: left;">
|
||||
<legend>Valores</legend>
|
||||
<label>
|
||||
Fecha<br>
|
||||
<input type="date" id="${field_fecha}" value=""><br><br>
|
||||
</label>
|
||||
<label>
|
||||
Platos<br>
|
||||
<textarea id="${field_platos}"></textarea><br><br>
|
||||
</label>
|
||||
<button class="btn5" id="${btn_guardar}">Guardar</button>
|
||||
<button class="rojo" id="${btn_borrar}">Borrar</button>
|
||||
</fieldset>
|
||||
`;
|
||||
gun
|
||||
.get(TABLE)
|
||||
.get("comedor")
|
||||
@@ -35,7 +35,7 @@ PAGES.comedor = {
|
||||
.once((data, key) => {
|
||||
function load_data(data, ENC = "") {
|
||||
document.getElementById(nameh1).innerText = key;
|
||||
document.getElementById(field_fecha).value = data["Fecha"];
|
||||
document.getElementById(field_fecha).value = data["Fecha"] || mid || CurrentISODate();
|
||||
document.getElementById(field_platos).value =
|
||||
data["Platos"] || "";
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ PAGES.notas = {
|
||||
Asunto<br>
|
||||
<input type="text" id="${field_asunto}" value=""><br><br>
|
||||
</label>
|
||||
<input type="hidden" id="${field_autor}" value="${SUB_LOGGED_IN_ID || ""}">
|
||||
<input type="hidden" id="${field_autor}" value="">
|
||||
<div id="${div_actions}"></div>
|
||||
</div>
|
||||
<label>
|
||||
@@ -55,7 +55,7 @@ PAGES.notas = {
|
||||
document.getElementById(field_asunto).value = data["Asunto"] || "";
|
||||
document.getElementById(field_contenido).value =
|
||||
data["Contenido"] || "";
|
||||
document.getElementById(field_autor).value = data["Autor"] || "";
|
||||
document.getElementById(field_autor).value = data["Autor"] || SUB_LOGGED_IN_ID || "";
|
||||
|
||||
// Persona select
|
||||
divact.innerHTML = "";
|
||||
|
||||
@@ -29,7 +29,7 @@ PAGES.supercafe = {
|
||||
<legend>Rellenar comanda</legend>
|
||||
<label style="display: none;">
|
||||
Fecha<br>
|
||||
<input readonly disabled type="text" id="${field_fecha}" value="${CurrentISODate()}"><br><br>
|
||||
<input readonly disabled type="text" id="${field_fecha}" value=""><br><br>
|
||||
</label>
|
||||
<label style="display: none;">
|
||||
Persona<br>
|
||||
|
||||
Reference in New Issue
Block a user