Agregar tab de pendientes, categoria procedimiento y fecha/hora programada
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user