refactor + macro fixes + theme system

This commit is contained in:
2026-03-19 22:58:34 -03:00
parent c0acb64028
commit 6624733756
25 changed files with 308 additions and 66 deletions

View File

@@ -1,4 +1,13 @@
{% extends "base.html" %}
{% extends "macros/base.html" %}
{% block title %}Catálogo de Productos{% endblock %}
{% block head %}
<!-- HEAD -->
{% endblock %}
{% block content %}
<h2 class="mb-4">Catálogo de Productos por Zona</h2>

View File

@@ -1,4 +1,11 @@
{% extends "base.html" %}
{% extends "macros/base.html" %}
{% block title %}Detalle de Rendición{% endblock %}
{% block head %}
<!-- HEAD -->
{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">

View File

@@ -1,4 +1,12 @@
{% extends "base.html" %}
{% extends "macros/base.html" %}
{% block title %}Historial de Rendiciones{% endblock %}
{% block head %}
<!-- HEAD -->
{% endblock %}
{% block content %}
<h2 class="mb-4">Historial de Rendiciones</h2>

View File

@@ -1,4 +1,12 @@
{% extends "base.html" %}
{% extends "macros/base.html" %}
{% block title %}Estructura Operativa{% endblock %}
{% block head %}
<!-- HEAD -->
{% endblock %}
{% block content %}
<h2 class="mb-4">Estructura Operativa</h2>

View File

@@ -1,4 +1,12 @@
{% extends "base.html" %}
{% extends "macros/base.html" %}
{% block title %}Gestión de Trabajadores{% endblock %}
{% block head %}
<!-- HEAD -->
{% endblock %}
{% block content %}
<h2 class="mb-4">Gestión de Trabajadores</h2>

View File

@@ -1,19 +0,0 @@
<!DOCTYPE html>
<html lang="es" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sistema de Rendiciones</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
{% include 'navbar.html' %}
<div class="container">
{% block content %}{% endblock %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@@ -1,4 +1,12 @@
{% extends "base.html" %}
{% extends "macros/base.html" %}
{% block title %}Editar Producto{% endblock %}
{% block head %}
<!-- HEAD -->
{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-md-8">

View File

@@ -1,4 +1,13 @@
{% extends "base.html" %}
{% extends "macros/base.html" %}
{% block title %}Editar Trabajador{% endblock %}
{% block head %}
<!-- HEAD -->
{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-md-8">

View File

@@ -1,37 +1,48 @@
{% extends "base.html" %}
{% block content %}
<div class="row justify-content-center mt-5">
<div class="col-md-5">
<div class="card shadow">
<div class="card-header bg-primary text-white text-center py-3">
<h4 class="mb-0">Iniciar Sesión</h4>
</div>
<div class="card-body p-4">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }}">{{ message|safe }}</div>
{% endfor %}
{% endif %}
{% endwith %}
{% extends "macros/base.html" %}
<form method="POST">
<div class="mb-3">
<label class="form-label">RUT</label>
<input type="text" class="form-control" name="rut" id="rutInput" placeholder="12.345.678-9" required autofocus>
</div>
<div class="mb-4">
<label class="form-label">Contraseña</label>
<input type="password" class="form-control" name="password" required>
</div>
<button type="submit" class="btn btn-primary w-100">Ingresar</button>
</form>
{% block title %}Inicio de sesión{% endblock %}
{% block content %}
<div class="d-flex align-items-center justify-content-center vh-100">
<div class="col-md-5">
<div class="card shadow">
<div class="card-header bg-primary text-white text-center py-3">
<h4 class="mb-0">Iniciar Sesión</h4>
</div>
<div class="card-body p-4">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }}">{{ message|safe }}</div>
{% endfor %}
{% endif %}
{% endwith %}
<form method="POST">
<div class="mb-3">
<label class="form-label">RUT</label>
<input type="text"
class="form-control"
name="rut"
id="rutInput"
placeholder="12.345.678-9"
required
autofocus>
</div>
<div class="mb-4">
<label class="form-label">Contraseña</label>
<input type="password" class="form-control" name="password" required>
</div>
<button type="submit" class="btn btn-primary w-100">Ingresar</button>
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
<script>
{% block scripts %}
<script>
document.getElementById('rutInput').addEventListener('input', function(e) {
let value = this.value.replace(/[^0-9kK]/g, '').toUpperCase();
if (value.length > 1) {
@@ -43,5 +54,5 @@
this.value = value;
}
});
</script>
</script>
{% endblock %}

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="es" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sistema de Rendiciones - {% block title %}{% endblock %}</title>
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}" type="image/x-icon">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
</head>
<body>
{% if session.get('user_id') %}
{% include 'macros/navbar.html' %}
{% endif %}
<main class="container-fluid px-3">
{% block content %}{% endblock %}
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="{{ url_for('static', filename='cookieStuff.js') }}"></script>
<script src="{{ url_for('static', filename='themeStuff.js') }}"></script>
{% block scripts %}{% endblock %}
</body>
</html>

View File

@@ -1,4 +1,4 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark border-bottom mb-4">
<nav class="navbar navbar-expand-lg border-bottom mb-4">
<div class="container">
<a class="navbar-brand" href="#">Rendiciones App</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
@@ -26,12 +26,26 @@
</li>
{% endif %}
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<span class="nav-link text-muted">RUT: {{ session.get('rut', 'Admin') }}</span>
</li>
<li class="nav-item">
<a class="nav-link text-danger" href="{{ url_for('logout') }}">Cerrar Sesión</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-person-circle me-1"></i> {{ session.get('rut', 'Admin') }}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="userDropdown">
<li>
<button class="dropdown-item d-flex align-items-center" onclick="toggleTheme()">
<i id="theme-icon" class="bi bi-sun me-2"></i>
<span id="theme-label">Modo Claro</span>
</button>
</li>
<li><hr class="dropdown-divider"></li>
<li>
<a class="dropdown-item text-danger d-flex align-items-center" href="{{ url_for('logout') }}">
<i class="bi bi-box-arrow-right me-2"></i> Cerrar Sesión
</a>
</li>
</ul>
</li>
</ul>
{% endif %}

View File

@@ -1,4 +1,12 @@
{% extends "base.html" %}
{% extends "macros/base.html" %}
{% block title %}Rendición de Caja{% endblock %}
{% block head %}
<!-- HEAD -->
{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">