update itv - logos

This commit is contained in:
2026-09-12 15:18:41 +02:00
parent 2b8f5374c9
commit 51d07f85c0
11 changed files with 69 additions and 889 deletions
Vendored
BIN
View File
Binary file not shown.
+8 -5
View File
@@ -801,7 +801,6 @@ def documentos_eliminar(doc_id):
# Ruta API que devuelve unidades según población
@app.route('/api/unidades/<int:poblacion_id>')
@login_required
@@ -849,7 +848,8 @@ def itv_list():
SELECT id, m_oficial, m_reservada, marca, modelo, tipo,
tipo, unidad, poblacion, itv
FROM vehiculos
WHERE itv IS NOT NULL AND itv != ''
WHERE situacion !='BAJA'
AND itv IS NOT NULL AND itv != ''
AND itv BETWEEN ? AND ?
AND {where_q}
ORDER BY itv ASC
@@ -859,7 +859,8 @@ def itv_list():
SELECT id, m_oficial, m_reservada, marca, modelo, tipo,
tipo, unidad, poblacion, itv
FROM vehiculos
WHERE itv IS NOT NULL AND itv != ''
WHERE situacion !='BAJA'
AND itv IS NOT NULL AND itv != ''
AND itv BETWEEN ? AND ?
ORDER BY itv ASC
''', (desde_q, hasta_q)).fetchall()
@@ -901,7 +902,8 @@ def itv_exportar():
SELECT m_oficial, m_reservada, marca, modelo, tipo,
tipo, unidad, poblacion, itv
FROM vehiculos
WHERE itv IS NOT NULL AND itv != ''
WHERE situacion !='BAJA'
AND itv IS NOT NULL AND itv != ''
AND itv BETWEEN ? AND ?
AND {where_q}
ORDER BY itv ASC
@@ -911,7 +913,8 @@ def itv_exportar():
SELECT m_oficial, m_reservada, marca, modelo, tipo,
tipo, unidad, poblacion, itv
FROM vehiculos
WHERE itv IS NOT NULL AND itv != ''
WHERE situacion !='BAJA'
AND itv IS NOT NULL AND itv != ''
AND itv BETWEEN ? AND ?
ORDER BY itv ASC
''', (desde_q, hasta_q)).fetchall()
BIN
View File
Binary file not shown.
+53 -2
View File
@@ -230,8 +230,9 @@ SET
Después:
1- Poner id autoincremental en tabla vehículos
2. Poner id autoincremental en tabla historial
3. Importar las tablas cvv - poblaciones - tipo - unidades
3- Hacer el update:
4- Hacer el update:
UPDATE historial
SET vehiculo_id = (
SELECT id
@@ -239,8 +240,58 @@ SET vehiculo_id = (
WHERE vehiculos.m_oficial = historial.matricula
);
4- Ordenar los campos de las tablas, con este orden:
5- Ordenar los campos de las tablas, con este orden:
CREATE TABLE "vehiculos" (
"id" INTEGER,
"m_oficial" TEXT,
"m_reservada" TEXT,
"m_propia" TEXT,
"VIN" TEXT,
"poliza" TEXT,
"viat" TEXT,
"legajo" TEXT,
"marca" TEXT,
"modelo" TEXT,
"tipo" TEXT,
"color" REAL,
"combustible" TEXT,
"plazas" TEXT,
"lanzadestellos" INTEGER,
"situacion" TEXT,
"poblacion" TEXT,
"unidad" TEXT,
"grupo" TEXT,
"int_operacion" TEXT,
"int_grupo" TEXT,
"int_juzgado" TEXT,
"int_procedimiento" INTEGER,
"f_destino_situacion" INTEGER,
"f_alta" TEXT,
"f_baja" INTEGER,
"km" TEXT,
"km_1" TEXT,
"itv_ultima" INTEGER,
"itv" INTEGER,
"observaciones" TEXT,
"historial" TEXT,
"notas" TEXT, pdf TEXT,
PRIMARY KEY("id" AUTOINCREMENT)
)
CREATE TABLE "historial" (
"id" INTEGER,
"vehiculo_id" INTEGER,
"fecha" TEXT,
"matricula" TEXT,
"situacion" TEXT,
"poblacion" TEXT,
"unidad" TEXT,
"grupo" TEXT,
"observaciones" TEXT,
PRIMARY KEY("id" AUTOINCREMENT),
FOREIGN KEY("vehiculo_id") REFERENCES "vehiculos"("id")
)
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
View File
Binary file not shown.
+8 -2
View File
@@ -107,9 +107,15 @@
{% endif %}
{% if buscado and rows %}
<div style="margin-left:auto;display:flex;gap:8px;">
<div style="display: grid; justify-items: start; gap: 2px;">
<!-- <span class="badge-vencida">Vencida</span> -->
<span class="badge-proxima">Próxima (vencimiento - 1 de un mes)</span>
<span class="badge-ok">Al día (vencimiento + 1 de un mes)</span>
</div>
<div style="margin-left:auto;display:flex;gap:8px; padding: 0px;">
<a href="{{ url_for('itv_exportar', desde=desde, hasta=hasta, q_itv=q_itv) }}"
class="btn btn-ghost" title="Exportar a Excel">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
BIN
View File
Binary file not shown.
-880
View File
@@ -1,880 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{% block title %}App{% endblock %} · PyFleet</title>
<script>
(function() {
var theme = localStorage.getItem('nexus-theme') || 'light';
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='car-front.svg') }}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/animate.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap-icons-1.13.1/bootstrap-icons.css') }}">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* original */
:root {
--bg: #0a111f;
--surface: #101a2e;
--nav-bg: #080e19;
--border: #1d2b45;
--accent: #3b82f6;
--accent2: #06b6d4;
--text: #e8f0ff;
--muted: #71819c;
--pill-bg: #17243a;
--success: #22c7e8;
--nav-w: 220px;
--radius: 12px;
}
[data-theme="light"] {
--bg: #f5f6fa;
--surface: #ffffff;
--nav-bg: #ffffff;
--border: #e3e6ef;
--accent: #2563eb;
--accent2: #4f8df7;
--text: #1a1d29;
--muted: #8a8fa3;
--pill-bg: #eef0f8;
--success: #159dcc;
}
/* azul profundo + azul eléctrico + cyan */
/* :root {
--bg: #0d0f14;
--surface: #13161e;
--nav-bg: #0a0c10;
--border: #1e2230;
--accent: #3b82f6;
--accent2: #06b6d4;
--text: #e2e6f0;
--muted: #5a607a;
--pill-bg: #1a1f2e;
--success: #34b9e8;
--nav-w: 220px;
--radius: 12px;
}
[data-theme="light"] {
--bg: #f4f8fd;
--surface: #ffffff;
--nav-bg: #ffffff;
--border: #dce6f2;
--accent: #2563eb;
--accent2: #0891b2;
--text: #172033;
--muted: #718096;
--pill-bg: #eaf2fc;
--success: #0891b2;
} */
/* Ambar + coral */
/* :root {
--bg: #12110f;
--surface: #1b1916;
--nav-bg: #0e0d0b;
--border: #302b25;
--accent: #f59e0b;
--accent2: #f97316;
--text: #f3eee6;
--muted: #8e877d;
--pill-bg: #28231d;
--success: #34d399;
--nav-w: 220px;
--radius: 12px;
}
[data-theme="light"] {
--bg: #faf8f4;
--surface: #ffffff;
--nav-bg: #ffffff;
--border: #e8e1d7;
--accent: #d97706;
--accent2: #ea580c;
--text: #29251f;
--muted: #8a8278;
--pill-bg: #f6eee1;
--success: #059669;
} */
body {
background: var(--bg);
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 15px;
display: flex;
min-height: 100vh;
transition: background .2s ease, color .2s ease;
}
.input-disabled-look {
background-color: #f5f5f5;
color: #6c757d;
border: 1px solid #ced4da;
cursor: not-allowed;
opacity: 0.7;
pointer-events: none;
}
nav, .card, .msg-banner, .msg-form input, .nav-links a {
transition: background .2s ease, border-color .2s ease, color .2s ease;
}
/* ── NAVBAR ── */
nav {
width: var(--nav-w);
background: var(--nav-bg);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
padding: 28px 16px 24px;
position: fixed;
top: 0; left: 0; bottom: 0;
z-index: 10;
}
.nav-logo {
font-family: 'Space Grotesk', sans-serif;
font-size: 20px;
font-weight: 700;
color: var(--text);
letter-spacing: -0.5px;
padding: 0 8px 28px;
display: flex;
align-items: center;
gap: 40px;
}
.nav-logo span.dot {
width: 8px; height: 8px;
background: var(--accent);
border-radius: 50%;
display: inline-block;
box-shadow: 0 0 8px var(--accent);
}
.nav-section-label {
font-size: 10px;
font-weight: 600;
letter-spacing: 1.2px;
text-transform: uppercase;
color: var(--muted);
padding: 0 8px 10px;
}
.nav-links {
display: flex;
flex-direction: column;
gap: 4px;
flex: 1;
}
.nav-links a {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 12px;
border-radius: 8px;
text-decoration: none;
color: var(--muted);
font-size: 14px;
font-weight: 500;
transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--border); color: var(--text); }
.nav-links a.active {
background: linear-gradient(135deg, rgba(30, 144, 255, 0.08), rgba(0, 51, 204, 0.25));
/* background: linear-gradient(135deg, rgba(92,110,248,.18), rgba(139,92,246,.1)); */
/* background: linear-gradient(135deg, rgba(30, 144, 255, 0.25), rgba(0, 51, 204, 0.75)); */
color: var(--text);
border: 1px solid rgba(92,110,248,.25);
}
.nav-links a .icon {
width: 18px; height: 18px;
opacity: .6;
flex-shrink: 0;
}
.nav-links a.active .icon { opacity: 1; }
/* indicator bar */
.nav-links a.active::before {
content: '';
position: absolute;
left: 16px;
width: 3px; height: 18px;
background: var(--accent);
border-radius: 2px;
margin-left: -12px;
}
.nav-links a { position: relative; }
/* message badge in nav */
.msg-badge {
margin-left: auto;
background: var(--accent);
color: #fff;
font-size: 10px;
font-weight: 600;
padding: 2px 7px;
border-radius: 20px;
}
.nav-footer {
padding-top: 16px;
border-top: 1px solid var(--border);
font-size: 12px;
color: var(--muted);
padding-left: 8px;
}
/* ── THEME SWITCH ── */
.theme-switch-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 8px 16px;
margin-bottom: 4px;
border-bottom: 1px solid var(--border);
}
.theme-switch-label {
font-size: 12px;
font-weight: 500;
color: var(--muted);
display: flex;
align-items: center;
gap: 6px;
}
.theme-toggle {
position: relative;
width: 42px;
height: 23px;
background: var(--pill-bg);
border: 1px solid var(--border);
border-radius: 20px;
cursor: pointer;
flex-shrink: 0;
padding: 0;
}
.theme-toggle::after {
content: '☾';
position: absolute;
top: 1px; left: 1px;
width: 17px; height: 17px;
background: var(--accent);
border-radius: 50%;
transition: transform .25s cubic-bezier(.4,0,.2,1), background .2s;
display: flex;
align-items: center;
justify-content: center;
font-size: 10px;
line-height: 1;
color: #fff;
}
[data-theme="light"] .theme-toggle::after {
content: '☀';
transform: translateX(19px);
background: #f59e0b;
}
/* ── MAIN CONTENT ── */
main {
margin-left: var(--nav-w);
flex: 1;
padding: 40px 48px;
min-height: 100vh;
}
.page-header {
margin-bottom: 36px;
}
.page-eyebrow {
font-size: 11px;
font-weight: 600;
letter-spacing: 1.4px;
text-transform: uppercase;
color: var(--accent);
margin-bottom: 8px;
}
.page-title {
font-family: 'Space Grotesk', sans-serif;
font-size: 28px;
font-weight: 700;
color: var(--text);
letter-spacing: -0.5px;
}
.page-subtitle {
margin-top: 6px;
color: var(--muted);
font-size: 14px;
}
/* ── MENSAJES MÚLTIPLES ── */
.msg-banner-wrap {
background: linear-gradient(135deg, rgba(92,110,248,.1), rgba(139,92,246,.06));
border: 1px solid rgba(92,110,248,.25);
border-radius: var(--radius);
margin-bottom: 24px;
overflow: hidden;
animation: slideIn .25s ease;
}
.msg-banner-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
border-bottom: 1px solid rgba(92,110,248,.15);
font-size: 11px;
font-weight: 600;
letter-spacing: .7px;
text-transform: uppercase;
color: var(--accent);
}
.msg-clear-all {
background: none;
border: 1px solid rgba(92,110,248,.3);
border-radius: 6px;
color: var(--muted);
font-size: 11px;
padding: 3px 10px;
cursor: pointer;
transition: color .15s, border-color .15s;
}
.msg-clear-all:hover { color: var(--text); border-color: var(--muted); }
.msg-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
border-bottom: 1px solid rgba(92,110,248,.08);
gap: 12px;
}
.msg-item:last-child { border-bottom: none; }
.msg-fecha {
font-size: 10px;
color: var(--muted);
margin-bottom: 2px;
}
.msg-texto { font-size: 13px; color: var(--text); }
.msg-del-btn {
background: none;
border: none;
color: var(--muted);
cursor: pointer;
font-size: 13px;
padding: 4px 8px;
border-radius: 6px;
flex-shrink: 0;
transition: color .15s, background .15s;
}
.msg-del-btn:hover { color: #f87171; background: rgba(248,113,113,.1); }
/* ── MESSAGE BANNER ── */
.msg-banner {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
background: linear-gradient(135deg, rgba(92,110,248,.12), rgba(139,92,246,.08));
border: 1px solid rgba(92,110,248,.3);
border-radius: var(--radius);
padding: 14px 18px;
margin-bottom: 28px;
animation: slideIn .25s ease;
}
@keyframes slideIn {
from { opacity:0; transform: translateY(-6px); }
to { opacity:1; transform: translateY(0); }
}
.msg-banner .label {
font-size: 11px;
font-weight: 600;
letter-spacing: .8px;
text-transform: uppercase;
color: var(--accent);
margin-bottom: 3px;
}
.msg-banner .text { color: var(--text); font-size: 14px; }
.msg-banner a.clear-btn {
color: var(--muted);
font-size: 12px;
text-decoration: none;
white-space: nowrap;
padding: 5px 10px;
border: 1px solid var(--border);
border-radius: 6px;
transition: color .15s, border-color .15s;
flex-shrink: 0;
}
.msg-banner a.clear-btn:hover { color: var(--text); border-color: var(--muted); }
/* ── MESSAGE FORM ── */
.msg-form {
display: flex;
gap: 10px;
margin-top: 28px;
max-width: 560px;
}
.msg-form input {
flex: 1;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 14px;
padding: 10px 14px;
outline: none;
transition: border-color .15s;
}
.msg-form input::placeholder { color: var(--muted); }
.msg-form input:focus { border-color: var(--accent); }
.msg-form button {
background: var(--accent);
color: #fff;
border: none;
border-radius: 8px;
font-family: 'Inter', sans-serif;
font-size: 13px;
font-weight: 600;
padding: 10px 20px;
cursor: pointer;
transition: opacity .15s;
white-space: nowrap;
}
.msg-form button:hover { opacity: .85; }
/* ── CARDS ── */
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 16px;
margin-top: 28px;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
transition: border-color .2s;
}
.card:hover { border-color: rgba(92,110,248,.35); }
.card-icon {
font-size: 22px;
margin-bottom: 12px;
}
.card-title {
font-family: 'Space Grotesk', sans-serif;
font-size: 14px;
font-weight: 600;
margin-bottom: 6px;
}
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }
/* ── SELECT / DROPDOWN ── */
.select-wrap {
position: relative;
}
.form-select {
appearance: none;
-webkit-appearance: none;
cursor: pointer;
padding-right: 38px;
}
.form-select option {
background: var(--surface);
color: var(--text);
}
.select-arrow {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
width: 16px;
height: 16px;
color: var(--muted);
pointer-events: none;
transition: transform .2s;
}
.select-wrap:focus-within .select-arrow {
transform: translateY(-50%) rotate(180deg);
color: var(--accent);
}
.form-select:focus {
border-color: var(--accent);
}
{% block extra_css %}{% endblock %}
thead th {
position: relative;
transition: background .15s, color .15s;
}
thead th:hover {
background: var(--border);
color: var(--text);
}
thead th:hover .sort-icon {
opacity: .7 !important;
}
/* ── CRUD TABLE ── */
.crud-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 20px;
flex-wrap: wrap;
}
.search-wrap {
position: relative;
flex: 1;
max-width: 360px;
}
.search-wrap > svg:first-child {
/* .search-wrap svg { */
position: absolute;
left: 12px; top: 50%;
transform: translateY(-50%);
width: 16px; height: 16px;
color: var(--muted);
pointer-events: none;
}
.search-wrap input {
width: 100%;
padding: 9px 14px 9px 38px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 13px;
outline: none;
transition: border-color .15s;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus { border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: opacity .15s, background .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .85; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; color: #f87171; border: 1px solid rgba(248,113,113,.35); }
.btn-danger:hover { background: rgba(248,113,113,.08); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.table-wrap {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--pill-bg); }
th {
padding: 12px 16px;
text-align: left;
font-size: 11px;
font-weight: 600;
letter-spacing: .8px;
text-transform: uppercase;
color: var(--muted);
}
td {
padding: 13px 16px;
font-size: 13px;
border-top: 1px solid var(--border);
color: var(--text);
}
tbody tr { transition: background .12s; padding-bottom: }
tbody tr:hover { background: var(--pill-bg); }
.td-id { font-family: monospace; color: var(--muted); font-size: 12px; }
.td-actions { display: flex; gap: 8px; align-items: center; }
.empty-state {
text-align: center;
padding: 48px 24px;
color: var(--muted);
font-size: 14px;
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .3; }
/* ── FORM ── */
.form-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 32px;
max-width: 1560px; /* aqui se establece el ancho de los formularios */
}
.form-group { margin-bottom: 5px; }
.form-label {
display: block;
font-size: 12px;
font-weight: 600;
letter-spacing: .5px;
color: var(--muted);
margin-bottom: 7px;
text-transform: uppercase;
}
.form-input {
width: 100%;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 14px;
padding: 10px 14px;
outline: none;
transition: border-color .15s;
}
.nav-submenu-toggle {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
padding: 10px 12px;
border-radius: 8px;
background: none;
border: none;
color: var(--muted);
font-family: 'Inter', sans-serif;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background .15s, color .15s;
}
.nav-submenu-toggle:hover,
.nav-submenu-toggle.active { background: var(--border); color: var(--text); }
.nav-submenu-items {
display: none;
flex-direction: column;
gap: 2px;
padding-left: 16px;
margin-top: 2px;
}
.nav-submenu-items.open { display: flex; }
.nav-submenu-items a {
font-size: 13px;
padding: 8px 12px;
}
.form-input::placeholder { color: var(--muted); }
.form-input:focus { border-color: var(--accent); }
.form-input:disabled { opacity: .5; cursor: not-allowed; }
.form-actions { display: flex; gap: 10px; margin-top: 28px; }
/* ── FLASH ── */
.flash { padding: 11px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 20px; animation: slideIn .2s ease; }
.flash.ok { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.3); color: #34d399; }
.flash.error { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: #f87171; }
</style>
</head>
<body>
<!-- class="animate__animated animate__backInLeft" -->
<nav id="navbar"
{% if session.pop("animate_navbar", None) %}
class="animate__animated animate__backInUp"
{% endif %}>
<div style="padding: 0 8px 20px; text-align:center;">
<img src="{{ url_for('static', filename='img/logo.png') }}"
alt="Logo"
style="max-width:160px; width:100%; height:auto;">
</div>
<div class="nav-logo">
<span></span><h3>PyFleet</h3>
</div>
<div class="theme-switch-row">
<span class="theme-switch-label">Tema</span>
<button class="theme-toggle" id="themeToggle" aria-label="Cambiar tema claro/oscuro" type="button"></button>
</div>
<div class="nav-section-label">Navegación</div>
<div class="nav-links">
<a href="{{ url_for('index') }}" class="{% if page == 'inicio' %}active{% endif %}">
<i class="bi bi-house"style="font-size: 1rem;"></i>
Inicio
<!-- {% if session.get('mensaje') and page == 'inicio' %}<span class="msg-badge">!</span>{% endif %} -->
</a>
<a href="{{ url_for('vehiculos_list') }}" class="{% if page == 'vehiculos' %}active{% endif %}">
<i class="bi bi-car-front" style="font-size: 1rem;"></i>
Vehículos
</a>
<a href="{{ url_for('itv_list') }}" class="{% if page == 'itv' %}active{% endif %}">
<i class="bi bi-calendar-check" style="font-size: 1rem;"></i>
ITV
</a>
<a href="{{ url_for('viat_list') }}" class="{% if page == 'viat' %}active{% endif %}">
<i class="bi bi-broadcast" style="font-size: 1rem;"></i>
Via-T
</a>
<a href="{{ url_for('contacto') }}" class="{% if page == 'contacto' %}active{% endif %}">
<i class="bi bi-person-vcard" style="font-size: 1rem;"></i>
Contacto
{% if session.get('mensaje') and page == 'contacto' %}<span class="msg-badge">!</span>{% endif %}
</a>
<div class="nav-submenu" style="margin-top: 100px;">
<hr style="opacity: 0.5;margin-bottom: 5px;">
<button class="nav-submenu-toggle {% if page in ['poblaciones','unidades','tipo'] %}active{% endif %}"
onclick="toggleSubmenu(this)">
<i class="bi bi-database-check" style="font-size: 1rem;"></i>
Configuración
<svg class="chevron" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" style="margin-top:10px;margin-left:auto;transition:transform .2s">
<polyline points="6 9 12 15 18 9"/>
</svg>
</button>
<div class="nav-submenu-items {% if page in ['poblaciones','unidades','tipo'] %}open{% endif %}">
<a href="{{ url_for('unidades_list') }}" class="{% if page == 'unidades' %}active{% endif %}">
<i class="bi bi-building"></i>
Unidades
</a>
<a href="{{ url_for('tipo_list') }}" class="{% if page == 'tipo' %}active{% endif %}">
<i class="bi bi-bus-front"></i>
Tipo vehiculo
</a>
</div>
</div>
</div>
<div class="nav-footer">
{% if mensajes %}
<a href="{{ url_for('index') }}" style="
display:flex;align-items:center;gap:6px;
color:var(--accent);text-decoration:none;font-size:12px;
padding:6px 8px;border-radius:7px;transition:background .15s;
margin-bottom:4px;"
onmouseover="this.style.background='var(--border)'"
onmouseout="this.style.background=''">
💬 {{ mensajes|length }} mensaje{{ 's' if mensajes|length != 1 }} activo{{ 's' if mensajes|length != 1 }}
</a>
{% else %}
<span style="font-size:12px;padding:6px 8px;display:block;">Sin mensajes</span>
{% endif %}
<a href="{{ url_for('logout') }}" style="
display:flex;align-items:center;gap:8px;margin-top:12px;
color:var(--muted);font-size:13px;text-decoration:none;
padding:7px 8px;border-radius:7px;transition:background .15s,color .15s;
" onmouseover="this.style.background='var(--border)';this.style.color='var(--text)'"
onmouseout="this.style.background='';this.style.color='var(--muted)'">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4"/>
<polyline points="16 17 21 12 16 7"/>
<line x1="21" y1="12" x2="9" y2="12"/>
</svg>
Cerrar sesión
</a>
</div>
</nav>
<main>
{# Mensajes solo en página de inicio #}
{% if page == 'inicio' %}
{% if mensajes %}
<div class="msg-banner-wrap">
<div class="msg-banner-header">
<div style="display:flex;align-items:center;gap:8px;">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
</svg>
<span>{{ mensajes|length }} mensaje{{ 's' if mensajes|length != 1 }}</span>
</div>
<form method="POST" action="{{ url_for('mensajes_eliminar_todos') }}"
onsubmit="return confirm('¿Eliminar todos los mensajes?')">
<button type="submit" class="msg-clear-all">✕ Eliminar todos</button>
</form>
</div>
{% for m in mensajes %}
<div class="msg-item">
<div>
<div class="msg-fecha">{{ m['fecha'] | fecha_es_hora }}</div>
<div class="msg-texto">{{ m['texto'] }}</div>
</div>
<form method="POST" action="{{ url_for('mensaje_eliminar', id=m['id']) }}">
<button type="submit" class="msg-del-btn" title="Eliminar este mensaje">✕</button>
</form>
</div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div class="flash {{ category }}">{{ message }}</div>
{% endfor %}
{% endwith %}
{% block content %}{% endblock %}
</main>
<script>
var toggle = document.getElementById('themeToggle');
var html = document.documentElement;
function applyTheme(theme) {
html.setAttribute('data-theme', theme);
localStorage.setItem('nexus-theme', theme);
}
// Sync button state on load
applyTheme(localStorage.getItem('nexus-theme') || 'light');
toggle.addEventListener('click', function() {
var current = html.getAttribute('data-theme') === 'light' ? 'light' : 'dark';
var next = current === 'light' ? 'dark' : 'light';
applyTheme(next);
});
function toggleSubmenu(btn) {
var items = btn.nextElementSibling;
items.classList.toggle('open');
btn.querySelector('.chevron').style.transform =
items.classList.contains('open') ? 'rotate(180deg)' : '';
}
</script>
</body>
</html>