- categorias.html: lista con conteo de movimientos, drawer para agregar/editar - api/categorias.php: GET/POST/PUT/DELETE (DELETE bloqueado si tiene movimientos) - categorias.js: grid de 30 íconos Material Symbols + paleta de 12 colores, preview en vivo - Sidebar actualizado en todas las páginas con link a Categorías - Sesiones PHP guardadas en pagos/db/sessions/ (bind mount) → sobreviven reinicios Docker - Fix selector de categorías en add.html: sesiones persistentes resuelven el Cargando… Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
153 lines
7.7 KiB
HTML
153 lines
7.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
|
<title>Categorías — Quiet Wealth</title>
|
|
<script src="js/tailwind.cdn.js"></script>
|
|
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap" rel="stylesheet"/>
|
|
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap" rel="stylesheet"/>
|
|
<script>
|
|
tailwind.config = {
|
|
theme: {
|
|
extend: {
|
|
colors: {
|
|
"background":"#f8faf9","primary-container":"#006a6a","surface-container-lowest":"#ffffff",
|
|
"on-background":"#191c1c","surface-container-high":"#e6e9e8","surface-container-highest":"#e1e3e2",
|
|
"surface-container-low":"#f2f4f3","on-primary":"#ffffff","on-surface":"#191c1c",
|
|
"on-surface-variant":"#3e4948","outline-variant":"#bec9c8","on-error":"#ffffff",
|
|
"surface-variant":"#e1e3e2","outline":"#6e7979","surface-container":"#eceeed",
|
|
"error":"#ba1a1a","secondary":"#4d6357","surface":"#f8faf9",
|
|
"primary":"#005050","on-secondary":"#ffffff"
|
|
},
|
|
fontFamily: { headline:["Manrope"], body:["Manrope"] }
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style>
|
|
body { font-family:'Manrope',sans-serif; }
|
|
.material-symbols-outlined { font-variation-settings:'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24; }
|
|
#drawer { transition: transform 0.3s ease; }
|
|
</style>
|
|
</head>
|
|
<body class="bg-background text-on-background min-h-screen">
|
|
|
|
<!-- ═══════════ SIDEBAR ═══════════ -->
|
|
<aside class="hidden md:flex flex-col fixed left-0 top-0 h-screen w-56 bg-surface-container-lowest border-r border-outline-variant z-40 py-7 px-4 gap-1">
|
|
<div class="flex items-center gap-2 px-2 mb-7">
|
|
<span class="material-symbols-outlined text-[#006a6a] text-2xl" style="font-variation-settings:'FILL' 1;">account_balance_wallet</span>
|
|
<span class="font-extrabold text-[#006a6a] tracking-tight text-lg">Quiet Wealth</span>
|
|
</div>
|
|
<a href="index.html" class="flex items-center gap-3 px-3 py-2.5 rounded-xl text-on-surface-variant hover:bg-surface-container text-sm font-medium transition-colors">
|
|
<span class="material-symbols-outlined text-[20px]">home</span>Dashboard
|
|
</a>
|
|
<a href="historial.html" class="flex items-center gap-3 px-3 py-2.5 rounded-xl text-on-surface-variant hover:bg-surface-container text-sm font-medium transition-colors">
|
|
<span class="material-symbols-outlined text-[20px]">history</span>Historial
|
|
</a>
|
|
<a href="add.html" class="flex items-center gap-3 px-3 py-2.5 rounded-xl text-on-surface-variant hover:bg-surface-container text-sm font-medium transition-colors">
|
|
<span class="material-symbols-outlined text-[20px]">add_circle</span>Nuevo movimiento
|
|
</a>
|
|
<a href="categorias.html" class="flex items-center gap-3 px-3 py-2.5 rounded-xl bg-[#005050]/10 text-primary font-bold text-sm">
|
|
<span class="material-symbols-outlined text-[20px]" style="font-variation-settings:'FILL' 1;">category</span>Categorías
|
|
</a>
|
|
<div class="mt-auto">
|
|
<button onclick="fetch('api/login.php?action=logout').then(()=>location.href='login.html')"
|
|
class="flex items-center gap-3 px-3 py-2.5 rounded-xl text-on-surface-variant hover:bg-surface-container text-sm font-medium transition-colors w-full">
|
|
<span class="material-symbols-outlined text-[20px]">logout</span>Salir
|
|
</button>
|
|
</div>
|
|
</aside>
|
|
|
|
<!-- ═══════════ CONTENIDO ═══════════ -->
|
|
<div class="md:ml-56 min-h-screen flex flex-col">
|
|
|
|
<header class="bg-background sticky top-0 z-30 border-b border-outline-variant/30 px-6 md:px-8 py-4 flex items-center justify-between">
|
|
<div class="flex items-center gap-3">
|
|
<button onclick="window.location.href='index.html'" class="md:hidden p-2 -ml-2 hover:bg-surface-container rounded-full transition-colors">
|
|
<span class="material-symbols-outlined text-primary">arrow_back</span>
|
|
</button>
|
|
<h1 class="text-xl font-bold text-on-surface">Categorías</h1>
|
|
</div>
|
|
<button onclick="abrirDrawer(null)"
|
|
class="flex items-center gap-1.5 px-4 py-2 bg-primary text-white rounded-xl font-bold text-sm hover:bg-primary-container transition-colors shadow-sm">
|
|
<span class="material-symbols-outlined text-[18px]">add</span>Nueva
|
|
</button>
|
|
</header>
|
|
|
|
<main class="flex-1 px-6 md:px-8 py-6 pb-8">
|
|
<div class="max-w-2xl mx-auto md:mx-0">
|
|
<div id="ui-loading" class="py-16 flex flex-col items-center gap-3 text-on-surface-variant">
|
|
<span class="material-symbols-outlined text-4xl opacity-40">hourglass_top</span>
|
|
<p class="text-sm">Cargando categorías…</p>
|
|
</div>
|
|
<div id="ui-lista" class="hidden bg-surface-container-lowest rounded-[1.5rem] overflow-hidden divide-y divide-surface-container-low"></div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<!-- ═══════════ DRAWER (agregar / editar) ═══════════ -->
|
|
<div id="drawer-overlay" class="fixed inset-0 bg-black/40 backdrop-blur-sm z-50 hidden" onclick="cerrarDrawer()"></div>
|
|
|
|
<div id="drawer" class="fixed bottom-0 inset-x-0 md:inset-x-auto md:right-0 md:top-0 md:w-96 bg-surface-container-lowest z-50 rounded-t-[2rem] md:rounded-none md:rounded-l-[2rem] shadow-2xl translate-y-full md:translate-y-0 md:translate-x-full flex flex-col">
|
|
|
|
<div class="flex items-center justify-between px-6 py-5 border-b border-outline-variant/30">
|
|
<h2 id="drawer-title" class="text-lg font-bold text-on-surface">Nueva categoría</h2>
|
|
<button onclick="cerrarDrawer()" class="p-2 hover:bg-surface-container rounded-full transition-colors">
|
|
<span class="material-symbols-outlined text-on-surface-variant">close</span>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="flex-1 overflow-y-auto px-6 py-5 space-y-5">
|
|
|
|
<!-- Nombre -->
|
|
<div class="space-y-2">
|
|
<label class="text-[11px] uppercase tracking-widest font-bold text-on-surface-variant">Nombre</label>
|
|
<input id="drawer-nombre" type="text" placeholder="Ej: Salud, Gimnasio…"
|
|
class="w-full bg-surface-container-low px-4 py-3 rounded-xl text-sm font-semibold focus:outline-none focus:ring-2 focus:ring-primary/30"/>
|
|
</div>
|
|
|
|
<!-- Preview -->
|
|
<div class="flex items-center gap-4 p-4 bg-surface-container-low rounded-xl">
|
|
<div id="preview-icono" class="w-12 h-12 rounded-xl flex items-center justify-center" style="background:#005050">
|
|
<span id="preview-icono-sym" class="material-symbols-outlined text-white text-2xl" style="font-variation-settings:'FILL' 1;">category</span>
|
|
</div>
|
|
<div>
|
|
<p id="preview-nombre" class="font-bold text-on-surface text-sm">Vista previa</p>
|
|
<p class="text-xs text-on-surface-variant">Así se verá en los movimientos</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Íconos -->
|
|
<div class="space-y-2">
|
|
<label class="text-[11px] uppercase tracking-widest font-bold text-on-surface-variant">Ícono</label>
|
|
<div id="icon-grid" class="grid grid-cols-6 gap-2">
|
|
<!-- renderizado por JS -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Colores -->
|
|
<div class="space-y-2">
|
|
<label class="text-[11px] uppercase tracking-widest font-bold text-on-surface-variant">Color</label>
|
|
<div id="color-grid" class="flex flex-wrap gap-2">
|
|
<!-- renderizado por JS -->
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="px-6 py-4 border-t border-outline-variant/30 flex gap-3">
|
|
<button onclick="cerrarDrawer()" class="flex-1 py-3 bg-surface-container text-on-surface rounded-xl font-semibold text-sm">
|
|
Cancelar
|
|
</button>
|
|
<button id="drawer-save" class="flex-1 py-3 bg-primary text-white rounded-xl font-bold text-sm active:scale-95 transition-transform">
|
|
Guardar
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="js/ui.js"></script>
|
|
<script src="js/categorias.js"></script>
|
|
</body>
|
|
</html>
|