diff --git a/assets/static/euskaditech-css/simple.css b/assets/static/euskaditech-css/simple.css index 0e47d60..1c9fd31 100644 --- a/assets/static/euskaditech-css/simple.css +++ b/assets/static/euskaditech-css/simple.css @@ -65,7 +65,8 @@ a:hover { @media print { .supermesh-indicator, .no_print, - .no_print * { + .no_print *, + .saveico, .delico, .opicon { display: none !important; } } diff --git a/src/index.html b/src/index.html index 9568a9d..7b46d95 100644 --- a/src/index.html +++ b/src/index.html @@ -85,15 +85,11 @@ - - - - diff --git a/src/page/aulas.js b/src/page/aulas.js index 0da0eec..c335b58 100644 --- a/src/page/aulas.js +++ b/src/page/aulas.js @@ -1,4 +1,5 @@ PERMS['aulas'] = 'Aulas (Solo docentes!)'; +PERMS['aulas:resumen_diario'] = '> Resumen diario'; PAGES.aulas = { //navcss: "btn1", Title: 'Gest-Aula', @@ -13,168 +14,98 @@ PAGES.aulas = { var data_Tareas = safeuuid(); var data_Diario = safeuuid(); var data_Weather = safeuuid(); + var link_alertas = safeuuid(); + var link_diario = safeuuid(); + var link_actividades = safeuuid(); container.innerHTML = html`

Gestión del Aula

- Notas esenciales - Como iniciar el día - Como realizar el café - Como acabar el día - Horario - Tareas + Atajos de hoy + + Alertas + + + Solicitar material + + + Informe + + + Actividades + + + Ordenadores + + + Resumen Diario +
Acciones - Solicitudes de material - Diario de hoy - Ver Alertas - Informes y diarios - Ver comandas - Control de ordenadores -
-
- Datos de hoy - - Menú Comedor:
Cargando...
- Tareas:
-
-Cargando...
-
- Diario:
-
-Cargando...
-
- Clima:
+ + Solicitudes de materiales + + + Informes +
`; - - //#region Cargar Clima - // Get location from DB settings.weather_location; if missing ask user and save it - // url format: https://wttr.in/?F0m - DB.get('settings', 'weather_location').then((loc) => { - if (!loc) { - loc = prompt('Introduce tu ubicación para el clima (ciudad, país):', 'Madrid, Spain'); - if (loc) { - DB.put('settings', 'weather_location', loc); + + //#region Contar alertas activas y mostrarlas en el botón + DB.get('notas', 'alertas') + .then((res) => TS_decrypt(res, SECRET, (data) => { + var count = 0; + // Sumar el total de alertas activas, cada linea de "Contenido" + // es una alerta, aunque podrían hacerse varias por nota. + // Ignora lineas que no empiezen por > (por si el profesor escribe algo que no es una alerta) + data.Contenido.split('\n').forEach((line) => { + if (line.trim().startsWith('>')) count++; + }); + if (count > 0) { + document.getElementById(link_alertas).innerText = `Alertas (${count})`; + document.getElementById(link_alertas).classList.add('rojo'); + } else { + document.getElementById(link_alertas).innerText = 'Alertas'; + document.getElementById(link_alertas).classList.remove('rojo'); } - } - if (loc) { - document.getElementById(data_Weather).src = - 'https://wttr.in/' + encodeURIComponent(loc) + '_IF0m_background=FFFFFF.png'; + })) + .catch((e) => { + console.warn('Error contando alertas activas', e); + }); + //#endregion Contar alertas activas + //#region Comprobar si hay un diario para hoy y marcar el botón + DB.get('aulas_informes', 'diario-' + CurrentISODate()) + .then((res) => { + if (res) { + document.getElementById(link_diario).classList.add('btn2'); + } else { + document.getElementById(link_diario).classList.remove('btn2'); + } + }) + .catch((e) => { + console.warn('Error comprobando diario de hoy', e); + }); + //#endregion Comprobar diario + //#region Comprobar si hay un informe de actividades para hoy y contar las actividades (mismo formato que alertas) + DB.get('aulas_informes', 'actividades-' + CurrentISODate()).then((res) => TS_decrypt(res, SECRET, (data) => { + var count = 0; + data.Contenido.split('\n').forEach((line) => { + if (line.trim().startsWith('>')) count++; + }); + if (count > 0) { + document.getElementById(link_actividades).innerText = `Actividades (${count})`; + document.getElementById(link_actividades).classList.add('btn4'); } else { - document.getElementById(data_Weather).src = 'https://wttr.in/_IF0m_background=FFFFFF.png'; + document.getElementById(link_actividades).innerText = 'Actividades'; + document.getElementById(link_actividades).classList.remove('btn4'); } + })) + .catch((e) => { + console.warn('Error comprobando actividades de hoy', e); }); - //#endregion Cargar Clima - //#region Cargar Comedor - DB.get('comedor', CurrentISODate()).then((data) => { - function add_row(data) { - // Fix newlines - data.Platos = data.Platos || 'No hay platos registrados para hoy.'; - // Display platos - document.getElementById(data_Comedor).innerHTML = data.Platos.replace(/\n/g, '
'); - } - if (typeof data == 'string') { - TS_decrypt( - data, - SECRET, - (data, wasEncrypted) => { - add_row(data || {}); - }, - 'comedor', - CurrentISODate() - ); - } else { - add_row(data || {}); - } - }); - //#endregion Cargar Comedor - //#region Cargar Tareas - DB.get('notas', 'tareas').then((data) => { - function add_row(data) { - // Fix newlines - data.Contenido = data.Contenido || 'No hay tareas.'; - // Display platos - document.getElementById(data_Tareas).innerHTML = data.Contenido.replace(/\n/g, '
'); - } - if (typeof data == 'string') { - TS_decrypt( - data, - SECRET, - (data, wasEncrypted) => { - add_row(data || {}); - }, - 'notas', - 'tareas' - ); - } else { - add_row(data || {}); - } - }); - //#endregion Cargar Tareas - //#region Cargar Diario - DB.get('aulas_informes', 'diario-' + CurrentISODate()).then((data) => { - function add_row(data) { - // Fix newlines - data.Contenido = data.Contenido || 'No hay un diario.'; - // Display platos - document.getElementById(data_Diario).innerHTML = data.Contenido.replace(/\n/g, '
'); - } - if (typeof data == 'string') { - TS_decrypt( - data, - SECRET, - (data, wasEncrypted) => { - add_row(data || {}); - }, - 'aulas_informes', - 'diario-' + CurrentISODate() - ); - } else { - add_row(data || {}); - } - }); - //#endregion Cargar Diario + //#endregion Comprobar actividades }, _solicitudes: function () { const tablebody = safeuuid(); @@ -190,7 +121,7 @@ Cargando...


- - + + `; (async () => { @@ -311,7 +248,7 @@ Cargando... - Diario:
+ Por fecha:
@@ -324,7 +261,7 @@ Cargando...← Volver a informes @@ -388,8 +328,14 @@ Cargando...


- - + + `; (async () => { @@ -659,6 +605,141 @@ Cargando...Resumen Diario ${CurrentISODate()} + + ← Volver a Gestión de Aulas +
Menú Comedor:
Cargando...
+
Tareas:
+
+Cargando...
+
+
Informe:
+
+Cargando...
+
+
Clima:
+ `; + + //#region Cargar Clima + // Get location from DB settings.weather_location; if missing ask user and save it + // url format: https://wttr.in/?F0m + DB.get('settings', 'weather_location').then((loc) => { + if (!loc) { + loc = prompt('Introduce tu ubicación para el clima (ciudad, país):', 'Madrid, Spain'); + if (loc) { + DB.put('settings', 'weather_location', loc); + } + } + if (loc) { + document.getElementById(data_Weather).src = + 'https://wttr.in/' + encodeURIComponent(loc) + '_IF0m_background=FFFFFF.png'; + } else { + document.getElementById(data_Weather).src = 'https://wttr.in/_IF0m_background=FFFFFF.png'; + } + }); + //#endregion Cargar Clima + //#region Cargar Comedor + DB.get('comedor', CurrentISODate()).then((data) => { + function add_row(data) { + if (!data.Primero) { + var result = 'No hay información del comedor para hoy.'; + } else { + var result = data.Primero + "
" + data.Segundo + "
" + data.Postre; + } + // Display platos + document.getElementById(data_Comedor).innerHTML = result; + } + if (typeof data == 'string') { + TS_decrypt( + data, + SECRET, + (data, wasEncrypted) => { + add_row(data || {}); + }, + 'comedor', + CurrentISODate() + ); + } else { + add_row(data || {}); + } + }); + //#endregion Cargar Comedor + //#region Cargar Tareas + DB.get('notas', 'tareas').then((data) => { + function add_row(data) { + // Fix newlines + data.Contenido = data.Contenido || 'No hay tareas.'; + // Display tareas + document.getElementById(data_Tareas).innerHTML = data.Contenido.replace(/\n/g, '
'); + } + if (typeof data == 'string') { + TS_decrypt( + data, + SECRET, + (data, wasEncrypted) => { + add_row(data || {}); + }, + 'notas', + 'tareas' + ); + } else { + add_row(data || {}); + } + }); + //#endregion Cargar Tareas + //#region Cargar Diario + DB.get('aulas_informes', 'diario-' + CurrentISODate()).then((data) => { + function add_row(data) { + // Fix newlines + data.Contenido = data.Contenido || 'No hay un diario.'; + // Display platos + document.getElementById(data_Diario).innerHTML = data.Contenido.replace(/\n/g, '
'); + } + if (typeof data == 'string') { + TS_decrypt( + data, + SECRET, + (data, wasEncrypted) => { + add_row(data || {}); + }, + 'aulas_informes', + 'diario-' + CurrentISODate() + ); + } else { + add_row(data || {}); + } + }); + //#endregion Cargar Diario + }, edit: function (fsection) { if (!checkRole('aulas')) { setUrlHash('index'); @@ -678,6 +759,9 @@ Cargando...Aviso -
- Valores - - - - -
- - - -
- - -
- `; - document.getElementById(btn_leer).onclick = () => { - document.getElementById(field_estado).value = 'leido'; - }; - document.getElementById(btn_desleer).onclick = () => { - document.getElementById(field_estado).value = 'por_leer'; - }; - var divact = document.getElementById(div_actions); - addCategory_Personas( - divact, - SC_Personas, - '', - (value) => { - document.getElementById(field_origen).value = value; - }, - 'Origen' - ); - addCategory_Personas( - divact, - SC_Personas, - '', - (value) => { - document.getElementById(field_destino).value = value; - }, - 'Destino' - ); - (async () => { - const data = await DB.get('notificaciones', mid); - function load_data(data, ENC = '') { - document.getElementById(nameh1).innerText = mid; - 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'] || SUB_LOGGED_IN_ID || ''; - document.getElementById(field_destino).value = data['Destino'] || ''; - document.getElementById(field_estado).value = data['Estado'] || '%%' || ''; - document.getElementById(field_respuesta).value = data['Respuesta'] || ''; - - // Persona select - divact.innerHTML = ''; - addCategory_Personas( - divact, - SC_Personas, - data['Origen'] || '', - (value) => { - document.getElementById(field_origen).value = value; - }, - 'Origen' - ); - addCategory_Personas( - divact, - SC_Personas, - data['Destino'] || '', - (value) => { - document.getElementById(field_destino).value = value; - }, - 'Destino' - ); - } - if (typeof data == 'string') { - TS_decrypt( - data, - SECRET, - (data, wasEncrypted) => { - load_data(data, '%E'); - }, - 'notificaciones', - mid - ); - } else { - load_data(data || {}); - } - })(); - document.getElementById(btn_guardar).onclick = () => { - // Check if button is already disabled to prevent double-clicking - var guardarBtn = document.getElementById(btn_guardar); - if (guardarBtn.disabled) return; - - // Validate before disabling button - if (document.getElementById(field_origen).value == '') { - alert('¡Hay que elegir una persona de origen!'); - return; - } - if (document.getElementById(field_destino).value == '') { - alert('¡Hay que elegir una persona de origen!'); - return; - } - - // Disable button after validation passes - guardarBtn.disabled = true; - guardarBtn.style.opacity = '0.5'; - - var data = { - Fecha: document.getElementById(field_fecha).value, - Origen: document.getElementById(field_origen).value, - Destino: document.getElementById(field_destino).value, - Mensaje: document.getElementById(field_mensaje).value, - Respuesta: document.getElementById(field_respuesta).value, - Asunto: document.getElementById(field_asunto).value, - Estado: document.getElementById(field_estado).value.replace('%%', 'por_leer'), - }; - document.getElementById('actionStatus').style.display = 'block'; - DB.put('notificaciones', mid, data) - .then(() => { - toastr.success('Guardado!'); - setTimeout(() => { - document.getElementById('actionStatus').style.display = 'none'; - setUrlHash('avisos'); - }, SAVE_WAIT); - }) - .catch((e) => { - console.warn('DB.put error', e); - guardarBtn.disabled = false; - guardarBtn.style.opacity = '1'; - document.getElementById('actionStatus').style.display = 'none'; - toastr.error('Error al guardar la notificación'); - }); - }; - document.getElementById(btn_borrar).onclick = () => { - if (confirm('¿Quieres borrar esta notificación?') == true) { - DB.del('notificaciones', mid).then(() => { - toastr.error('Borrado!'); - setTimeout(() => { - setUrlHash('avisos'); - }, SAVE_WAIT); - }); - } - }; - }, - index: function () { - if (!checkRole('avisos')) { - setUrlHash('index'); - return; - } - const tablebody = safeuuid(); - var btn_new = safeuuid(); - container.innerHTML = html` -

Avisos

- -
- `; - TS_IndexElement( - 'avisos', - [ - { - key: 'Origen', - type: 'persona', - default: '', - label: 'Origen', - }, - { - key: 'Destino', - type: 'persona', - default: '', - label: 'Destino', - }, - { - key: 'Asunto', - type: 'raw', - default: '', - label: 'Asunto', - }, - { - key: 'Estado', - type: 'raw', - default: '', - label: 'Estado', - }, - ], - 'notificaciones', - document.querySelector('#cont'), - (data, new_tr) => { - new_tr.style.backgroundColor = '#FFCCCB'; - if (data.Estado == 'leido') { - new_tr.style.backgroundColor = 'lightgreen'; - } - } - ); - if (!checkRole('avisos:edit')) { - document.getElementById(btn_new).style.display = 'none'; - } else { - document.getElementById(btn_new).onclick = () => { - setUrlHash('avisos,' + safeuuid('')); - }; - } - }, -}; diff --git a/src/page/materiales.js b/src/page/materiales.js index 291b6aa..69db975 100644 --- a/src/page/materiales.js +++ b/src/page/materiales.js @@ -285,9 +285,9 @@ PAGES.materiales = {
@@ -424,7 +424,7 @@ PAGES.materiales = { var nota = document.getElementById(mov_nota).value || ''; var actual = parseNum(document.getElementById(field_cantidad).value, 0); - if (!Number.isFinite(cantidadMov) || cantidadMov <= 0) { + if ((!Number.isFinite(cantidadMov) || cantidadMov <= 0) && tipo !== 'Ajuste') { toastr.warning('Indica una cantidad válida para el movimiento'); return; } diff --git a/src/page/mensajes.js b/src/page/mensajes.js deleted file mode 100644 index fef50fb..0000000 --- a/src/page/mensajes.js +++ /dev/null @@ -1,294 +0,0 @@ -PERMS['mensajes'] = 'Mensajes'; -PERMS['mensajes:edit'] = '> Editar'; -PAGES.mensajes = { - navcss: 'btn5', - icon: 'static/appico/message.png', - AccessControl: true, - // AccessControlRole is not needed. - Title: 'Mensajes', - edit: function (mid) { - if (!checkRole('mensajes:edit')) { - setUrlHash('mensajes'); - return; - } - var nameh1 = safeuuid(); - var field_asunto = safeuuid(); - var field_contenido = safeuuid(); - var field_autor = safeuuid(); - var field_files = safeuuid(); - var attachments_list = safeuuid(); - var btn_guardar = safeuuid(); - var btn_borrar = safeuuid(); - var div_actions = safeuuid(); - container.innerHTML = html` -

Mensaje

-
- Valores -
- - -
- - -
- - - - -
- `; - DB.get('mensajes', mid).then((data) => { - function load_data(data, ENC = '') { - document.getElementById(nameh1).innerText = mid; - document.getElementById(field_asunto).value = data['Asunto'] || ''; - document.getElementById(field_contenido).value = data['Contenido'] || ''; - document.getElementById(field_autor).value = data['Autor'] || SUB_LOGGED_IN_DETAILS["Nombre"] || ''; - - // Mostrar adjuntos existentes (si los hay). - // No confiar en `data._attachments` porque `DB.get` devuelve solo `doc.data`. - const attachContainer = document.getElementById(attachments_list); - attachContainer.innerHTML = ''; - // Usar API de DB para listar attachments (no acceder a internals desde la UI) - DB.listAttachments('mensajes', mid) - .then((list) => { - if (!list || !Array.isArray(list)) return; - list.forEach((att) => { - addAttachmentRow(att.name, att.dataUrl); - }); - }) - .catch((e) => { - console.warn('listAttachments error', e); - }); - } - if (typeof data == 'string') { - TS_decrypt(data, SECRET, (data) => { - load_data(data, '%E'); - }); - } else { - load_data(data || {}); - } - }); - // gestión de archivos seleccionados antes de guardar - const attachmentsToUpload = []; - function addAttachmentRow(name, url) { - const attachContainer = document.getElementById(attachments_list); - const idRow = safeuuid(); - const isImage = url && url.indexOf('data:image') === 0; - const preview = isImage - ? `` - : `${name}`; - const html = ` -
-
${preview}${name}
-
-
`; - attachContainer.insertAdjacentHTML('beforeend', html); - attachContainer.querySelectorAll(`button[data-name="${name}"]`).forEach((btn) => { - btn.onclick = () => { - if (!confirm('¿Borrar este adjunto?')) return; - // Usar API pública en DB para borrar metadata del attachment - DB.deleteAttachment('mensajes', mid, name) - .then((ok) => { - if (ok) { - document.getElementById(idRow).remove(); - toastr.error('Adjunto borrado'); - } else { - toastr.error('No se pudo borrar el adjunto'); - } - }) - .catch((e) => { - console.warn('deleteAttachment error', e); - toastr.error('Error borrando adjunto'); - }); - }; - }); - } - - document.getElementById(field_files).addEventListener('change', function (e) { - const files = Array.from(e.target.files || []); - files.forEach((file) => { - const reader = new FileReader(); - reader.onload = function (ev) { - const dataUrl = ev.target.result; - attachmentsToUpload.push({ - name: file.name, - data: dataUrl, - type: file.type || 'application/octet-stream', - }); - // mostrar preview temporal - addAttachmentRow(file.name, dataUrl); - }; - reader.readAsDataURL(file); - }); - // limpiar input para permitir re-subidas del mismo archivo - e.target.value = ''; - }); - document.getElementById(btn_guardar).onclick = () => { - // Disable button to prevent double-clicking - var guardarBtn = document.getElementById(btn_guardar); - if (guardarBtn.disabled) return; - - guardarBtn.disabled = true; - guardarBtn.style.opacity = '0.5'; - - var data = { - Autor: document.getElementById(field_autor).value, - Contenido: document.getElementById(field_contenido).value, - Asunto: document.getElementById(field_asunto).value, - }; - document.getElementById('actionStatus').style.display = 'block'; - DB.put('mensajes', mid, data) - .then(() => { - // subir attachments si los hay - const uploadPromises = []; - attachmentsToUpload.forEach((att) => { - if (DB.putAttachment) { - uploadPromises.push( - DB.putAttachment('mensajes', mid, att.name, att.data, att.type).catch((e) => { - console.warn('putAttachment error', e); - }) - ); - } - }); - Promise.all(uploadPromises) - .then(() => { - // limpiar lista temporal y recargar attachments - attachmentsToUpload.length = 0; - try { - // recargar lista actual sin salir - const pouchId = 'mensajes:' + mid; - if (DB && DB._internal && DB._internal.local) { - DB._internal.local - .get(pouchId, { attachments: true }) - .then((doc) => { - const attachContainer = document.getElementById(attachments_list); - attachContainer.innerHTML = ''; - if (doc && doc._attachments) { - Object.keys(doc._attachments).forEach((name) => { - try { - const att = doc._attachments[name]; - if (att && att.data) { - const durl = - 'data:' + - (att.content_type || 'application/octet-stream') + - ';base64,' + - att.data; - addAttachmentRow(name, durl); - return; - } - } catch (e) {} - DB.getAttachment('mensajes', mid, name) - .then((durl) => { - addAttachmentRow(name, durl); - }) - .catch(() => {}); - }); - } - }) - .catch(() => { - /* ignore reload errors */ - }); - } - } catch (e) {} - toastr.success('Guardado!'); - setTimeout(() => { - document.getElementById('actionStatus').style.display = 'none'; - setUrlHash('mensajes'); - }, SAVE_WAIT); - }) - .catch((e) => { - console.warn('Attachment upload error', e); - document.getElementById('actionStatus').style.display = 'none'; - guardarBtn.disabled = false; - guardarBtn.style.opacity = '1'; - toastr.error('Error al guardar los adjuntos'); - }); - }) - .catch((e) => { - console.warn('DB.put error', e); - document.getElementById('actionStatus').style.display = 'none'; - guardarBtn.disabled = false; - guardarBtn.style.opacity = '1'; - toastr.error('Error al guardar el mensaje'); - }); - }; - document.getElementById(btn_borrar).onclick = () => { - if (confirm('¿Quieres borrar este mensaje?') == true) { - DB.del('mensajes', mid).then(() => { - toastr.error('Borrado!'); - setTimeout(() => { - setUrlHash('mensajes'); - }, SAVE_WAIT); - }); - } - }; - }, - index: function () { - if (!checkRole('mensajes')) { - setUrlHash('index'); - return; - } - const tablebody = safeuuid(); - var btn_new = safeuuid(); - container.innerHTML = html` -

Mensajes

- -
- `; - TS_IndexElement( - 'mensajes', - [ - { - key: 'Autor', - type: 'raw', - default: '', - label: 'Origen', - }, - { - key: 'Asunto', - type: 'raw', - default: '', - label: 'Asunto', - }, - ], - 'mensajes', - document.querySelector('#cont') - ); - if (!checkRole('mensajes:edit')) { - document.getElementById(btn_new).style.display = 'none'; - } else { - document.getElementById(btn_new).onclick = () => { - setUrlHash('mensajes,' + safeuuid('')); - }; - } - }, -}; diff --git a/src/page/resumen_diario.js b/src/page/resumen_diario.js deleted file mode 100644 index 703200a..0000000 --- a/src/page/resumen_diario.js +++ /dev/null @@ -1,138 +0,0 @@ -PERMS['resumen_diario'] = 'Resumen diario (Solo docentes!)'; -PAGES.resumen_diario = { - icon: 'static/appico/calendar.png', - navcss: 'btn3', - AccessControl: true, - Title: 'Resumen Diario', - index: function () { - var data_Comedor = safeuuid(); - var data_Tareas = safeuuid(); - var data_Diario = safeuuid(); - var data_Weather = safeuuid(); - if (!checkRole('resumen_diario')) { - setUrlHash('index'); - return; - } - container.innerHTML = html` -

Resumen Diario ${CurrentISODate()}

- -
Menú Comedor:
Cargando...
-
Tareas:
-
-Cargando...
-
-
Diario:
-
-Cargando...
-
-
Clima:
- `; - - //#region Cargar Clima - // Get location from DB settings.weather_location; if missing ask user and save it - // url format: https://wttr.in/?F0m - DB.get('settings', 'weather_location').then((loc) => { - if (!loc) { - loc = prompt('Introduce tu ubicación para el clima (ciudad, país):', 'Madrid, Spain'); - if (loc) { - DB.put('settings', 'weather_location', loc); - } - } - if (loc) { - document.getElementById(data_Weather).src = - 'https://wttr.in/' + encodeURIComponent(loc) + '_IF0m_background=FFFFFF.png'; - } else { - document.getElementById(data_Weather).src = 'https://wttr.in/_IF0m_background=FFFFFF.png'; - } - }); - //#endregion Cargar Clima - //#region Cargar Comedor - DB.get('comedor', CurrentISODate()).then((data) => { - function add_row(data) { - // Fix newlines - data.Platos = data.Platos || 'No hay platos registrados para hoy.'; - // Display platos - document.getElementById(data_Comedor).innerHTML = data.Platos.replace(/\n/g, '
'); - } - if (typeof data == 'string') { - TS_decrypt( - data, - SECRET, - (data, wasEncrypted) => { - add_row(data || {}); - }, - 'comedor', - CurrentISODate() - ); - } else { - add_row(data || {}); - } - }); - //#endregion Cargar Comedor - //#region Cargar Tareas - DB.get('notas', 'tareas').then((data) => { - function add_row(data) { - // Fix newlines - data.Contenido = data.Contenido || 'No hay tareas.'; - // Display platos - document.getElementById(data_Tareas).innerHTML = data.Contenido.replace(/\n/g, '
'); - } - if (typeof data == 'string') { - TS_decrypt( - data, - SECRET, - (data, wasEncrypted) => { - add_row(data || {}); - }, - 'notas', - 'tareas' - ); - } else { - add_row(data || {}); - } - }); - //#endregion Cargar Tareas - //#region Cargar Diario - DB.get('aulas_informes', 'diario-' + CurrentISODate()).then((data) => { - function add_row(data) { - // Fix newlines - data.Contenido = data.Contenido || 'No hay un diario.'; - // Display platos - document.getElementById(data_Diario).innerHTML = data.Contenido.replace(/\n/g, '
'); - } - if (typeof data == 'string') { - TS_decrypt( - data, - SECRET, - (data, wasEncrypted) => { - add_row(data || {}); - }, - 'aulas_informes', - 'diario-' + CurrentISODate() - ); - } else { - add_row(data || {}); - } - }); - //#endregion Cargar Diario - }, -};