438 lines
12 KiB
PHP
438 lines
12 KiB
PHP
<?php include __DIR__ . '/../partials/sidebar_importador.php'; ?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Dashboard | Importador</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
<style>
|
|
:root {
|
|
--primary: #2563eb;
|
|
--primary-dark: #1d4ed8;
|
|
--secondary: #64748b;
|
|
--success: #059669;
|
|
--warning: #d97706;
|
|
--danger: #dc2626;
|
|
--info: #0891b2;
|
|
--light: #f8fafc;
|
|
--dark: #0f172a;
|
|
--border-color: #e2e8f0;
|
|
--text-muted: #64748b;
|
|
--bg-body: #f8fafc;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
background-color: var(--bg-body);
|
|
color: var(--dark);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.main-content {
|
|
margin-left: 280px;
|
|
padding: 2rem;
|
|
min-height: 100vh;
|
|
transition: margin-left 0.3s ease;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.main-content {
|
|
margin-left: 0;
|
|
padding: 1rem;
|
|
}
|
|
}
|
|
|
|
.page-header {
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.page-title {
|
|
color: var(--dark);
|
|
font-weight: 600;
|
|
font-size: 1.75rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.page-subtitle {
|
|
color: var(--text-muted);
|
|
font-weight: 400;
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
.dashboard-card {
|
|
background: white;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
height: 100%;
|
|
transition: all 0.2s ease;
|
|
cursor: pointer;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.dashboard-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
|
|
border-color: var(--primary);
|
|
}
|
|
|
|
.card-icon {
|
|
width: 48px;
|
|
height: 48px;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 1rem;
|
|
font-size: 1.25rem;
|
|
color: white;
|
|
}
|
|
|
|
.card-icon.primary { background: var(--primary); }
|
|
.card-icon.success { background: var(--success); }
|
|
.card-icon.warning { background: var(--warning); }
|
|
.card-icon.info { background: var(--info); }
|
|
.card-icon.danger { background: var(--danger); }
|
|
|
|
.card-title {
|
|
font-weight: 600;
|
|
font-size: 1.1rem;
|
|
color: var(--dark);
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.card-description {
|
|
color: var(--text-muted);
|
|
font-size: 0.9rem;
|
|
margin-bottom: 1.5rem;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.card-action {
|
|
margin-top: auto;
|
|
}
|
|
|
|
.btn-card {
|
|
background: var(--primary);
|
|
color: white;
|
|
border: none;
|
|
padding: 0.625rem 1.25rem;
|
|
border-radius: 6px;
|
|
font-weight: 500;
|
|
font-size: 0.875rem;
|
|
transition: all 0.2s ease;
|
|
width: 100%;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.btn-card:hover {
|
|
background: var(--primary-dark);
|
|
color: white;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-card.success {
|
|
background: var(--success);
|
|
}
|
|
|
|
.btn-card.success:hover {
|
|
background: #047857;
|
|
}
|
|
|
|
.btn-card.warning {
|
|
background: var(--warning);
|
|
}
|
|
|
|
.btn-card.warning:hover {
|
|
background: #b45309;
|
|
}
|
|
|
|
.btn-card.info {
|
|
background: var(--info);
|
|
}
|
|
|
|
.btn-card.info:hover {
|
|
background: #0e7490;
|
|
}
|
|
|
|
.btn-card.danger {
|
|
background: var(--danger);
|
|
}
|
|
|
|
.btn-card.danger:hover {
|
|
background: #b91c1c;
|
|
}
|
|
|
|
.badge-required {
|
|
position: absolute;
|
|
top: 1rem;
|
|
right: 1rem;
|
|
background: var(--warning);
|
|
color: white;
|
|
font-size: 0.75rem;
|
|
padding: 0.25rem 0.5rem;
|
|
border-radius: 4px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.alert-professional {
|
|
background: white;
|
|
border: 1px solid var(--border-color);
|
|
border-left: 4px solid var(--info);
|
|
border-radius: 8px;
|
|
padding: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.alert-professional.warning {
|
|
border-left-color: var(--warning);
|
|
}
|
|
|
|
.alert-icon {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-right: 1rem;
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
.alert-icon.info {
|
|
background: rgba(8, 145, 178, 0.1);
|
|
color: var(--info);
|
|
}
|
|
|
|
.alert-icon.warning {
|
|
background: rgba(217, 119, 6, 0.1);
|
|
color: var(--warning);
|
|
}
|
|
|
|
.alert-title {
|
|
font-weight: 600;
|
|
font-size: 1rem;
|
|
color: var(--dark);
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.alert-text {
|
|
color: var(--text-muted);
|
|
font-size: 0.9rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.btn-loading {
|
|
opacity: 0.7;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.btn-loading::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
width: 16px;
|
|
height: 16px;
|
|
margin-left: -8px;
|
|
margin-top: -8px;
|
|
border: 2px solid transparent;
|
|
border-top: 2px solid currentColor;
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
.fade-in {
|
|
animation: fadeIn 0.5s ease-out;
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(10px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="main-content">
|
|
<!-- Page Header -->
|
|
<div class="page-header">
|
|
<h1 class="page-title">Dashboard Importador</h1>
|
|
<p class="page-subtitle">Gestiona tus catálogos y accede a las funcionalidades del sistema</p>
|
|
</div>
|
|
|
|
<?php if ($catalogosData['catalogos_activos']): ?>
|
|
<!-- Catálogos Grid -->
|
|
<div class="row g-4 mb-4">
|
|
<?php foreach ($catalogosData['catalogos'] as $catalogo): ?>
|
|
<div class="col-lg-4 col-md-6 fade-in">
|
|
<div class="dashboard-card" onclick="navigateWithAnimation(this, '<?= $catalogo['ruta'] ?>')">
|
|
<?php if ($catalogo['obligatorio']): ?>
|
|
<div class="badge-required">Obligatorio</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="card-icon <?= getCardColorClass($catalogo['color']) ?>">
|
|
<i class="<?= obtenerIconoCatalogo($catalogo['nombre']) ?>"></i>
|
|
</div>
|
|
|
|
<h3 class="card-title"><?= $catalogo['nombre'] ?></h3>
|
|
<p class="card-description"><?= $catalogo['descripcion'] ?></p>
|
|
|
|
<div class="card-action">
|
|
<button class="btn-card <?= $catalogo['color'] ?>">
|
|
<?= $catalogo['accion'] ?>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<?php if (count($catalogosData['catalogos']) === 2): ?>
|
|
<!-- Info Alert -->
|
|
<div class="alert-professional">
|
|
<div class="d-flex align-items-start">
|
|
<div class="alert-icon info">
|
|
<i class="fas fa-lightbulb"></i>
|
|
</div>
|
|
<div>
|
|
<h4 class="alert-title">Consejo del Sistema</h4>
|
|
<p class="alert-text">Tienes disponibles solo los catálogos obligatorios. Puedes activar catálogos adicionales desde tu panel de preferencias para acceder a más funcionalidades.</p>
|
|
<button class="btn-card info" onclick="navigateWithAnimation(this, '/IMPORTADORES/preferencias/catalogos')">
|
|
Configurar Catálogos
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php else: ?>
|
|
<!-- Warning Alert -->
|
|
<div class="alert-professional warning mb-4">
|
|
<div class="d-flex align-items-start">
|
|
<div class="alert-icon warning">
|
|
<i class="fas fa-exclamation-triangle"></i>
|
|
</div>
|
|
<div>
|
|
<h4 class="alert-title">Catálogos Desactivados</h4>
|
|
<p class="alert-text">Los catálogos están desactivados en tu configuración. Solo tienes acceso a las funciones básicas del sistema.</p>
|
|
<button class="btn-card warning" onclick="navigateWithAnimation(this, '/IMPORTADORES/preferencias/catalogos')">
|
|
Activar Catálogos
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Basic Functions Grid -->
|
|
<div class="row g-4">
|
|
<?php foreach ($catalogosData['catalogos'] as $catalogo): ?>
|
|
<div class="col-lg-4 col-md-6 fade-in">
|
|
<div class="dashboard-card" onclick="navigateWithAnimation(this, '<?= $catalogo['ruta'] ?>')">
|
|
<div class="badge-required">Básico</div>
|
|
|
|
<div class="card-icon <?= getCardColorClass($catalogo['color']) ?>">
|
|
<i class="<?= obtenerIconoCatalogo($catalogo['nombre']) ?>"></i>
|
|
</div>
|
|
|
|
<h3 class="card-title"><?= $catalogo['nombre'] ?></h3>
|
|
<p class="card-description"><?= $catalogo['descripcion'] ?></p>
|
|
|
|
<div class="card-action">
|
|
<button class="btn-card <?= $catalogo['color'] ?>">
|
|
<?= $catalogo['accion'] ?>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
// Navigation function with professional loading animation
|
|
function navigateWithAnimation(element, url) {
|
|
// Find the button within the card
|
|
const button = element.querySelector('.btn-card') || element;
|
|
|
|
// Prevent double clicks
|
|
if (button.classList.contains('btn-loading')) {
|
|
return;
|
|
}
|
|
|
|
// Add loading state
|
|
button.classList.add('btn-loading');
|
|
button.disabled = true;
|
|
|
|
// Add subtle card animation
|
|
const card = element.closest('.dashboard-card') || element;
|
|
card.style.transform = 'scale(0.98)';
|
|
card.style.opacity = '0.8';
|
|
|
|
// Navigate after short delay
|
|
setTimeout(() => {
|
|
window.location.href = url;
|
|
}, 600);
|
|
}
|
|
|
|
// Initialize page animations
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Add staggered fade-in animation to cards
|
|
const fadeElements = document.querySelectorAll('.fade-in');
|
|
fadeElements.forEach((element, index) => {
|
|
element.style.animationDelay = (index * 0.1) + 's';
|
|
});
|
|
|
|
// Add smooth hover effects to cards
|
|
const cards = document.querySelectorAll('.dashboard-card');
|
|
cards.forEach(card => {
|
|
card.addEventListener('mouseenter', function() {
|
|
this.style.transform = 'translateY(-4px)';
|
|
});
|
|
|
|
card.addEventListener('mouseleave', function() {
|
|
this.style.transform = 'translateY(0)';
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<?php
|
|
// Helper functions for the dashboard
|
|
function getCardColorClass($color) {
|
|
$colorMap = [
|
|
'indigo' => 'primary',
|
|
'teal' => 'success',
|
|
'orange' => 'warning',
|
|
'cyan' => 'info',
|
|
'lime' => 'success',
|
|
'violet' => 'primary',
|
|
'lila' => 'primary'
|
|
];
|
|
return $colorMap[$color] ?? 'primary';
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
</body>
|
|
</html>
|