Spaces:
Running
Running
Antigravity AI commited on
Commit ·
1dfed0f
1
Parent(s): d95efd6
Update login and dashboard, fix files
Browse files- src/components/admin/DashboardOverview.jsx +24 -2
- src/pages/AdminDashboard.jsx +1 -1
- src/pages/Login.jsx +12 -35
src/components/admin/DashboardOverview.jsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
import React, { useState, useEffect } from 'react';
|
| 2 |
import { db } from '../../firebase/config';
|
| 3 |
import { ref, onValue, push, set } from 'firebase/database';
|
| 4 |
-
import { TrendingUp, Users, ShoppingBag, AlertCircle } from 'lucide-react';
|
|
|
|
| 5 |
|
| 6 |
-
export default function DashboardOverview() {
|
|
|
|
| 7 |
const [stats, setStats] = useState({ ventasHoy: 0, mesasActivas: 0, stockBajo: 0 });
|
| 8 |
|
| 9 |
useEffect(() => {
|
|
@@ -103,6 +105,26 @@ export default function DashboardOverview() {
|
|
| 103 |
))}
|
| 104 |
</div>
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
<div className="glass-card">
|
| 107 |
<h3 className="text-gradient" style={{ marginBottom: '1rem' }}>Misión del Sistema</h3>
|
| 108 |
<p style={{ color: 'var(--text-muted)', lineHeight: '1.6' }}>
|
|
|
|
| 1 |
import React, { useState, useEffect } from 'react';
|
| 2 |
import { db } from '../../firebase/config';
|
| 3 |
import { ref, onValue, push, set } from 'firebase/database';
|
| 4 |
+
import { TrendingUp, Users, ShoppingBag, AlertCircle, UtensilsCrossed, DollarSign, ShieldCheck, User, Utensils } from 'lucide-react';
|
| 5 |
+
import { useNavigate } from 'react-router-dom';
|
| 6 |
|
| 7 |
+
export default function DashboardOverview({ setActiveTab }) {
|
| 8 |
+
const navigate = useNavigate();
|
| 9 |
const [stats, setStats] = useState({ ventasHoy: 0, mesasActivas: 0, stockBajo: 0 });
|
| 10 |
|
| 11 |
useEffect(() => {
|
|
|
|
| 105 |
))}
|
| 106 |
</div>
|
| 107 |
|
| 108 |
+
<div style={{ marginBottom: '3rem' }}>
|
| 109 |
+
<h3 className="text-gradient" style={{ marginBottom: '1.5rem', fontSize: '1.25rem' }}>Accesos Rápidos</h3>
|
| 110 |
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))', gap: '1rem' }}>
|
| 111 |
+
{[
|
| 112 |
+
{ label: 'Administrador', icon: <ShieldCheck size={28} />, action: () => setActiveTab && setActiveTab('overview'), color: 'var(--primary)', bg: 'rgba(255,90,95,0.1)' },
|
| 113 |
+
{ label: 'Caja', icon: <DollarSign size={28} />, action: () => setActiveTab && setActiveTab('cash'), color: 'var(--success)', bg: 'rgba(32, 201, 151, 0.1)' },
|
| 114 |
+
{ label: 'Mesero / POS', icon: <User size={28} />, action: () => navigate('/pos'), color: 'var(--info)', bg: 'rgba(50, 173, 230, 0.1)' },
|
| 115 |
+
{ label: 'Cocina', icon: <UtensilsCrossed size={28} />, action: () => window.open('/kitchen', '_blank'), color: 'var(--warning)', bg: 'rgba(245, 166, 35, 0.1)' },
|
| 116 |
+
{ label: 'Carta Digital', icon: <Utensils size={28} />, action: () => window.open('/menu', '_blank'), color: '#a855f7', bg: 'rgba(168, 85, 247, 0.1)' }
|
| 117 |
+
].map((btn, idx) => (
|
| 118 |
+
<button key={idx} onClick={btn.action} className="glass-card" style={{ padding: '1.5rem', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '1rem', border: `1px solid ${btn.bg}`, cursor: 'pointer', transition: 'all 0.3s ease' }} onMouseOver={e => e.currentTarget.style.transform = 'translateY(-5px)'} onMouseOut={e => e.currentTarget.style.transform = 'translateY(0)'}>
|
| 119 |
+
<div style={{ width: '60px', height: '60px', borderRadius: '50%', background: btn.bg, color: btn.color, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
| 120 |
+
{btn.icon}
|
| 121 |
+
</div>
|
| 122 |
+
<span style={{ fontWeight: '600', color: 'var(--text-main)' }}>{btn.label}</span>
|
| 123 |
+
</button>
|
| 124 |
+
))}
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
<div className="glass-card">
|
| 129 |
<h3 className="text-gradient" style={{ marginBottom: '1rem' }}>Misión del Sistema</h3>
|
| 130 |
<p style={{ color: 'var(--text-muted)', lineHeight: '1.6' }}>
|
src/pages/AdminDashboard.jsx
CHANGED
|
@@ -77,7 +77,7 @@ export default function AdminDashboard() {
|
|
| 77 |
{/* Main Content Area */}
|
| 78 |
<main className="main-content" style={{ overflowY: 'auto', background: 'var(--bg-base)' }}>
|
| 79 |
<div className="animate-fade-in" style={{ width: '100%', maxWidth: '1200px', margin: '0 auto', padding: '2rem' }}>
|
| 80 |
-
{activeTab === 'overview' && <DashboardOverview />}
|
| 81 |
{activeTab === 'menu' && <MenuEditor />}
|
| 82 |
{activeTab === 'inventory' && <InventoryControl />}
|
| 83 |
{activeTab === 'reports' && <Reports />}
|
|
|
|
| 77 |
{/* Main Content Area */}
|
| 78 |
<main className="main-content" style={{ overflowY: 'auto', background: 'var(--bg-base)' }}>
|
| 79 |
<div className="animate-fade-in" style={{ width: '100%', maxWidth: '1200px', margin: '0 auto', padding: '2rem' }}>
|
| 80 |
+
{activeTab === 'overview' && <DashboardOverview setActiveTab={setActiveTab} />}
|
| 81 |
{activeTab === 'menu' && <MenuEditor />}
|
| 82 |
{activeTab === 'inventory' && <InventoryControl />}
|
| 83 |
{activeTab === 'reports' && <Reports />}
|
src/pages/Login.jsx
CHANGED
|
@@ -87,54 +87,31 @@ export default function Login() {
|
|
| 87 |
onClick={() => { setDemo('admin'); setError(''); }}
|
| 88 |
style={{
|
| 89 |
padding: '20px', borderRadius: 'var(--radius-sm)', border: '1px solid',
|
| 90 |
-
borderColor:
|
| 91 |
-
background:
|
| 92 |
display: 'flex', alignItems: 'center', gap: '15px', textAlign: 'left',
|
| 93 |
transition: 'all 0.3s ease', cursor: 'pointer'
|
| 94 |
}}
|
| 95 |
>
|
| 96 |
<div style={{
|
| 97 |
padding: '10px', borderRadius: '10px',
|
| 98 |
-
background:
|
| 99 |
-
color:
|
| 100 |
}}>
|
| 101 |
<ShieldCheck size={24} />
|
| 102 |
</div>
|
| 103 |
<div>
|
| 104 |
-
<div style={{ fontWeight: '700', color:
|
| 105 |
<div style={{ fontSize: '0.75rem', color: 'var(--text-muted)' }}>Gestión y Reportes</div>
|
| 106 |
</div>
|
| 107 |
</button>
|
| 108 |
-
|
| 109 |
-
<button
|
| 110 |
-
onClick={() => { setDemo('mesero'); setError(''); }}
|
| 111 |
-
style={{
|
| 112 |
-
padding: '20px', borderRadius: 'var(--radius-sm)', border: '1px solid',
|
| 113 |
-
borderColor: loginMode === 'mesero' ? 'var(--primary)' : 'transparent',
|
| 114 |
-
background: loginMode === 'mesero' ? 'rgba(255,107,107,0.1)' : 'rgba(255,255,255,0.02)',
|
| 115 |
-
display: 'flex', alignItems: 'center', gap: '15px', textAlign: 'left',
|
| 116 |
-
transition: 'all 0.3s ease', cursor: 'pointer'
|
| 117 |
-
}}
|
| 118 |
-
>
|
| 119 |
-
<div style={{
|
| 120 |
-
padding: '10px', borderRadius: '10px',
|
| 121 |
-
background: loginMode === 'mesero' ? 'var(--primary)' : 'rgba(255,255,255,0.05)',
|
| 122 |
-
color: loginMode === 'mesero' ? '#fff' : 'var(--text-muted)'
|
| 123 |
-
}}>
|
| 124 |
-
<User size={24} />
|
| 125 |
-
</div>
|
| 126 |
-
<div>
|
| 127 |
-
<div style={{ fontWeight: '700', color: loginMode === 'mesero' ? 'var(--text-main)' : 'var(--text-muted)' }}>Mesero / POS</div>
|
| 128 |
-
<div style={{ fontSize: '0.75rem', color: 'var(--text-muted)' }}>Pedidos y Control</div>
|
| 129 |
-
</div>
|
| 130 |
-
</button>
|
| 131 |
</div>
|
| 132 |
|
| 133 |
{/* Lado Derecho: Formulario de Login */}
|
| 134 |
<div style={{ flex: 1, padding: '60px' }}>
|
| 135 |
<div style={{ marginBottom: '40px' }}>
|
| 136 |
<h1 className="text-gradient" style={{ fontSize: '2.5rem', fontWeight: '900', marginBottom: '10px' }}>
|
| 137 |
-
|
| 138 |
</h1>
|
| 139 |
<p style={{ color: 'var(--text-muted)' }}>Ingrese sus credenciales para continuar</p>
|
| 140 |
</div>
|
|
@@ -167,12 +144,12 @@ export default function Login() {
|
|
| 167 |
|
| 168 |
{/* Botón Demo rápido */}
|
| 169 |
<div style={{ marginTop: '30px', textAlign: 'center' }}>
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
</div>
|
| 177 |
</div>
|
| 178 |
</div>
|
|
|
|
| 87 |
onClick={() => { setDemo('admin'); setError(''); }}
|
| 88 |
style={{
|
| 89 |
padding: '20px', borderRadius: 'var(--radius-sm)', border: '1px solid',
|
| 90 |
+
borderColor: 'var(--primary)',
|
| 91 |
+
background: 'rgba(255,107,107,0.1)',
|
| 92 |
display: 'flex', alignItems: 'center', gap: '15px', textAlign: 'left',
|
| 93 |
transition: 'all 0.3s ease', cursor: 'pointer'
|
| 94 |
}}
|
| 95 |
>
|
| 96 |
<div style={{
|
| 97 |
padding: '10px', borderRadius: '10px',
|
| 98 |
+
background: 'var(--primary)',
|
| 99 |
+
color: '#fff'
|
| 100 |
}}>
|
| 101 |
<ShieldCheck size={24} />
|
| 102 |
</div>
|
| 103 |
<div>
|
| 104 |
+
<div style={{ fontWeight: '700', color: 'var(--text-main)' }}>Administrador</div>
|
| 105 |
<div style={{ fontSize: '0.75rem', color: 'var(--text-muted)' }}>Gestión y Reportes</div>
|
| 106 |
</div>
|
| 107 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
</div>
|
| 109 |
|
| 110 |
{/* Lado Derecho: Formulario de Login */}
|
| 111 |
<div style={{ flex: 1, padding: '60px' }}>
|
| 112 |
<div style={{ marginBottom: '40px' }}>
|
| 113 |
<h1 className="text-gradient" style={{ fontSize: '2.5rem', fontWeight: '900', marginBottom: '10px' }}>
|
| 114 |
+
Dashboard Admin
|
| 115 |
</h1>
|
| 116 |
<p style={{ color: 'var(--text-muted)' }}>Ingrese sus credenciales para continuar</p>
|
| 117 |
</div>
|
|
|
|
| 144 |
|
| 145 |
{/* Botón Demo rápido */}
|
| 146 |
<div style={{ marginTop: '30px', textAlign: 'center' }}>
|
| 147 |
+
<button
|
| 148 |
+
onClick={() => setDemo('admin')}
|
| 149 |
+
style={{ background: 'none', border: 'none', color: 'var(--text-muted)', cursor: 'pointer', textDecoration: 'underline', fontSize: '0.85rem' }}
|
| 150 |
+
>
|
| 151 |
+
Usar credenciales de prueba
|
| 152 |
+
</button>
|
| 153 |
</div>
|
| 154 |
</div>
|
| 155 |
</div>
|