Agregar tab de pendientes, categoria procedimiento y fecha/hora programada

This commit is contained in:
2026-08-11 20:20:04 +00:00
parent ca2f8a32e1
commit a700c40d20
5 changed files with 599 additions and 2 deletions
+37
View File
@@ -64,6 +64,7 @@ const memStore = {
atb: [],
indicaciones: [],
movimientos_indicaciones: [],
pendientes: [],
kv: {}
};
@@ -935,6 +936,42 @@ export async function createMovimientoIndicacion(mov) {
}
}
// ========== PENDIENTES ==========
export async function getAllPendientes() {
if (db) {
const pendientes = await db.collection('pendientes').find().toArray();
return cleanDocs(pendientes);
}
return [...memStore.pendientes];
}
export async function createPendiente(pendiente) {
if (db) {
await db.collection('pendientes').insertOne(pendiente);
} else {
memStore.pendientes.push(pendiente);
}
}
export async function updatePendiente(id, datos) {
if (db) {
await db.collection('pendientes').updateOne({ id }, { $set: datos });
} else {
const idx = memStore.pendientes.findIndex(p => p.id === id);
if (idx !== -1) {
memStore.pendientes[idx] = { ...memStore.pendientes[idx], ...datos };
}
}
}
export async function deletePendiente(id) {
if (db) {
await db.collection('pendientes').deleteOne({ id });
} else {
memStore.pendientes = memStore.pendientes.filter(p => p.id !== id);
}
}
// ========== KV STORE ==========
export async function getValue(key) {
if (db) {