pervenir boton de volver si se cerro sesion, colores, navbar, calculo tarjeta + mp
This commit is contained in:
@@ -106,6 +106,8 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
|
||||
<script>
|
||||
const editWorkerModal = document.getElementById('editWorkerModal');
|
||||
@@ -154,4 +156,4 @@
|
||||
inp.addEventListener('input', () => formatPhone(inp));
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
10
templates/index.html
Normal file
10
templates/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{% extends "macros/base.html" %}
|
||||
|
||||
{% block title %}Dashboad?{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2 class="mb-4">Poner algo aqui?</h2>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
{% endblock %}
|
||||
@@ -1,12 +1,14 @@
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark shadow-sm border-bottom border-secondary mb-4">
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary shadow-sm border-bottom mb-4">
|
||||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center fw-bold text-info" href="{{ url_for('index') }}">
|
||||
<i class="bi bi-receipt-cutoff me-2 fs-4"></i>
|
||||
<a class="navbar-brand d-flex align-items-center fw-bold text-primary-emphasis" href="{{ url_for('index') }}">
|
||||
<i class="bi bi-receipt-cutoff me-2 fs-4 text-info"></i>
|
||||
<span>SekiPOS</span>
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
{% if session.get('user_id') %}
|
||||
<ul class="navbar-nav me-auto">
|
||||
@@ -41,17 +43,16 @@
|
||||
</ul>
|
||||
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<button class="btn btn-link nav-link p-2 border-0" id="themeSwitcher" onclick="toggleTheme()" title="Cambiar tema">
|
||||
<i id="theme-icon" class="bi bi-sun-fill fs-5 text-warning"></i>
|
||||
<button class="btn btn-link nav-link p-2 border-0" onclick="toggleTheme()" title="Cambiar tema">
|
||||
<i id="theme-icon" class="bi bi-sun fs-5"></i>
|
||||
</button>
|
||||
|
||||
<span class="navbar-text text-light d-none d-md-block border-start ps-3 border-secondary">
|
||||
<i class="bi bi-person-badge me-1 text-info"></i>
|
||||
<span class="fw-bold">{{ session.get('rut') }}</span>
|
||||
|
||||
<span class="navbar-text d-none d-md-block border-start ps-3 border-secondary-subtle">
|
||||
<i class="bi bi-person-circle me-1 text-info"></i> {{ session.get('rut') }}
|
||||
</span>
|
||||
|
||||
<a href="{{ url_for('logout') }}" class="btn btn-outline-danger btn-sm rounded-pill px-3">
|
||||
<i class="bi bi-box-arrow-right me-1"></i> Salir
|
||||
Salir
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{% extends "macros/base.html" %}
|
||||
|
||||
|
||||
{% block title %}Rendición de Caja{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
@@ -90,33 +89,43 @@
|
||||
<div class="card mb-4 shadow-sm border-info">
|
||||
<div class="card-header bg-info text-dark">Resumen Financiero</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Total Tarjetas (Crédito/Débito)</label>
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Venta Tarjeta</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="text" class="form-control money-input" name="venta_tarjeta" placeholder="0">
|
||||
<input type="text" class="form-control money-input sale-input" name="venta_tarjeta" id="venta_tarjeta" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Total Mercado Pago</label>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Venta Mercado Pago</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="text" class="form-control money-input" name="venta_mp" placeholder="0">
|
||||
<input type="text" class="form-control money-input sale-input" name="venta_mp" id="venta_mp" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Total Efectivo</label>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Venta Efectivo</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="text" class="form-control money-input" name="venta_efectivo" placeholder="0">
|
||||
<input type="text" class="form-control money-input sale-input" name="venta_efectivo" id="venta_efectivo" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Gastos del Módulo</label>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 mb-4 p-3 bg-body-secondary rounded shadow-sm">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label text-info fw-bold">Total Digital (Tarjeta + MP)</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text text-danger">-$</span>
|
||||
<input type="text" class="form-control money-input" name="gastos" placeholder="0">
|
||||
<span class="input-group-text bg-info text-white border-info">$</span>
|
||||
<input type="text" class="form-control bg-dark-subtle fw-bold" id="total_digital" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label text-success fw-bold">Total Ventas (Todos los medios)</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text bg-success text-white border-success">$</span>
|
||||
<input type="text" class="form-control bg-dark-subtle fw-bold" id="total_general" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -129,8 +138,54 @@
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100 py-3 mb-5" onclick="return confirm('¿Enviar rendición? Revisa bien las cantidades.');">Enviar Rendición Diaria</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
const inputsVenta = document.querySelectorAll('.sale-input');
|
||||
const displayDigital = document.getElementById('total_digital');
|
||||
const displayGeneral = document.getElementById('total_general');
|
||||
|
||||
function calcularTotales() {
|
||||
// Limpiamos los puntos para sumar números puros
|
||||
const getVal = (id) => parseInt(document.getElementById(id).value.replace(/\D/g, '')) || 0;
|
||||
|
||||
const tarjeta = getVal('venta_tarjeta');
|
||||
const mp = getVal('venta_mp');
|
||||
const efectivo = getVal('venta_efectivo');
|
||||
|
||||
const totalDigital = tarjeta + mp;
|
||||
const totalGeneral = totalDigital + efectivo;
|
||||
|
||||
// Formateamos de vuelta a moneda chilena para mostrar
|
||||
displayDigital.value = totalDigital.toLocaleString('es-CL');
|
||||
displayGeneral.value = totalGeneral.toLocaleString('es-CL');
|
||||
}
|
||||
|
||||
inputsVenta.forEach(input => {
|
||||
input.addEventListener('input', calcularTotales);
|
||||
});
|
||||
|
||||
// Validación antes de enviar el formulario
|
||||
document.querySelector('form').addEventListener('submit', function(e) {
|
||||
const requiredInputs = this.querySelectorAll('[required]');
|
||||
let valid = true;
|
||||
|
||||
requiredInputs.forEach(input => {
|
||||
if (!input.value.trim()) {
|
||||
input.classList.add('is-invalid');
|
||||
valid = false;
|
||||
} else {
|
||||
input.classList.remove('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
if (!valid) {
|
||||
e.preventDefault();
|
||||
alert("Por favor, rellena todos los campos obligatorios antes de enviar.");
|
||||
}
|
||||
});
|
||||
|
||||
// Reuse our formatting script for the summary money inputs
|
||||
document.querySelectorAll('.money-input').forEach(function(input) {
|
||||
input.addEventListener('input', function(e) {
|
||||
|
||||
Reference in New Issue
Block a user