Introduced a new 'Solicitudes Programadas' section with full CRUD functionality using localStorage for persistence. Added navigation to toggle between dashboard and scheduled views. Updated the header, sidebar, and main content to support dynamic titles and active views. Included components for viewing and managing scheduled requests (form and table). Enhanced styles for the new section.
74 lines
2.5 KiB
JavaScript
74 lines
2.5 KiB
JavaScript
import React from 'react';
|
|
import '../../styles/components.css';
|
|
|
|
const Sidebar = ({ isMobileMenuOpen, onToggleMobileMenu, activeView = 'dashboard', onNavigate }) => {
|
|
const navItems = [
|
|
{ key: 'dashboard', icon: 'fas fa-tachometer-alt', label: 'Dashboard', badge: null },
|
|
{ key: 'scheduled', icon: 'fas fa-list', label: 'Solicitudes Programadas', badge: null },
|
|
{ key: 'create', icon: 'fas fa-plus-circle', label: 'Crear Solicitud', badge: null },
|
|
{ key: 'history', icon: 'fas fa-history', label: 'Historial', badge: null },
|
|
{ key: 'settings', icon: 'fas fa-cog', label: 'Configuración', badge: null },
|
|
{ key: 'help', icon: 'fas fa-question-circle', label: 'Ayuda', badge: null }
|
|
];
|
|
|
|
const handleClick = (e, key) => {
|
|
e.preventDefault();
|
|
onNavigate?.(key);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<button
|
|
className="menu-toggle"
|
|
id="menuToggle"
|
|
onClick={onToggleMobileMenu}
|
|
>
|
|
<i className="fas fa-bars"></i>
|
|
</button>
|
|
|
|
<div className={`sidebar ${isMobileMenuOpen ? 'active' : ''}`} id="sidebar">
|
|
<div className="logo-container">
|
|
<div className="logo">
|
|
<div className="logo-icon">
|
|
<i className="fas fa-clock"></i>
|
|
</div>
|
|
<div className="logo-text">Request <span>Scheduler</span></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="nav-container">
|
|
<ul className="nav-links">
|
|
{navItems.map((item) => (
|
|
<li
|
|
key={item.key}
|
|
className={activeView === item.key ? 'active' : ''}
|
|
data-tooltip={item.label}
|
|
>
|
|
<a href="#" onClick={(e) => handleClick(e, item.key)}>
|
|
<i className={item.icon}></i>
|
|
<span>{item.label}</span>
|
|
{item.badge && <span className="badge">{item.badge}</span>}
|
|
</a>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
|
|
<div className="sidebar-footer">
|
|
<div className="user-info">
|
|
<div className="user-avatar">JP</div>
|
|
<div className="user-details">
|
|
<div className="user-name">Juan Pérez</div>
|
|
<div className="user-role">Administrador</div>
|
|
</div>
|
|
<a href="#" style={{color: 'white'}}>
|
|
<i className="fas fa-sign-out-alt"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Sidebar; |