modified: routes_admin.py
modified: templates/admin_rendiciones.html modified: templates/macros/modals.html
This commit is contained in:
@@ -7,7 +7,75 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2 class="mb-4">Historial de Rendiciones</h2>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h2 class="mb-0">Historial de Rendiciones</h2>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm mb-4 border-0">
|
||||
<div class="card-body bg-body-tertiary rounded p-3">
|
||||
<form method="GET" action="{{ url_for('admin_rendiciones') }}" id="filterForm">
|
||||
<div class="row g-2 align-items-end">
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small text-muted mb-1">Año</label>
|
||||
<select name="anio" class="form-select form-select-sm">
|
||||
{% for anio in anios_disponibles %}
|
||||
<option value="{{ anio }}" {% if anio_actual == anio %}selected{% endif %}>{{ anio }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small text-muted mb-1">Mes</label>
|
||||
<select name="mes" class="form-select form-select-sm">
|
||||
<option value="01" {% if mes_actual == '01' %}selected{% endif %}>Enero</option>
|
||||
<option value="02" {% if mes_actual == '02' %}selected{% endif %}>Febrero</option>
|
||||
<option value="03" {% if mes_actual == '03' %}selected{% endif %}>Marzo</option>
|
||||
<option value="04" {% if mes_actual == '04' %}selected{% endif %}>Abril</option>
|
||||
<option value="05" {% if mes_actual == '05' %}selected{% endif %}>Mayo</option>
|
||||
<option value="06" {% if mes_actual == '06' %}selected{% endif %}>Junio</option>
|
||||
<option value="07" {% if mes_actual == '07' %}selected{% endif %}>Julio</option>
|
||||
<option value="08" {% if mes_actual == '08' %}selected{% endif %}>Agosto</option>
|
||||
<option value="09" {% if mes_actual == '09' %}selected{% endif %}>Septiembre</option>
|
||||
<option value="10" {% if mes_actual == '10' %}selected{% endif %}>Octubre</option>
|
||||
<option value="11" {% if mes_actual == '11' %}selected{% endif %}>Noviembre</option>
|
||||
<option value="12" {% if mes_actual == '12' %}selected{% endif %}>Diciembre</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<label class="form-label small text-muted mb-1">Día</label>
|
||||
<select name="dia" class="form-select form-select-sm">
|
||||
<option value="">Todos</option>
|
||||
{% for d in dias_disponibles %}
|
||||
<option value="{{ d }}" {% if dia_actual == d %}selected{% endif %}>{{ d }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small text-muted mb-1">Zona</label>
|
||||
<select name="zona_id" id="zonaSelect" class="form-select form-select-sm">
|
||||
<option value="">Todas las Zonas</option>
|
||||
{% for z in zonas %}
|
||||
<option value="{{ z[0] }}" {% if zona_actual|string == z[0]|string %}selected{% endif %}>{{ z[1] }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small text-muted mb-1">Módulo</label>
|
||||
<select name="modulo_id" id="moduloSelect" class="form-select form-select-sm">
|
||||
<option value="">Todos los Módulos</option>
|
||||
{% for m in modulos %}
|
||||
<option value="{{ m[0] }}" data-zona="{{ m[2] }}" {% if modulo_actual|string == m[0]|string %}selected{% endif %}>{{ m[1] }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<button type="submit" class="btn btn-primary btn-sm w-100"><i class="bi bi-search"></i> Filtrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
@@ -105,7 +173,11 @@
|
||||
const toggleSwitch = document.getElementById(toggleId);
|
||||
|
||||
if (toggleSwitch && tipoJornada) {
|
||||
// Explicitly set to true if Full Time, false otherwise
|
||||
toggleSwitch.checked = (tipoJornada === 'Full Time');
|
||||
} else if (toggleSwitch && !selectElement.value) {
|
||||
// If "Sin acompañante" is selected, turn it off
|
||||
toggleSwitch.checked = false;
|
||||
}
|
||||
|
||||
// Actualizar el badge también
|
||||
@@ -206,4 +278,35 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const zonaSelect = document.getElementById('zonaSelect');
|
||||
const moduloSelect = document.getElementById('moduloSelect');
|
||||
const moduloOptions = Array.from(moduloSelect.options);
|
||||
|
||||
function filterModulos() {
|
||||
const selectedZona = zonaSelect.value;
|
||||
|
||||
moduloOptions.forEach(option => {
|
||||
if (option.value === "") {
|
||||
// Siempre mostramos "Todos los Módulos"
|
||||
option.style.display = '';
|
||||
} else if (!selectedZona || option.dataset.zona === selectedZona) {
|
||||
option.style.display = '';
|
||||
} else {
|
||||
option.style.display = 'none';
|
||||
// Si el módulo seleccionado acaba de ocultarse, reseteamos el select
|
||||
if (option.selected) {
|
||||
moduloSelect.value = "";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
zonaSelect.addEventListener('change', filterModulos);
|
||||
// Ejecutar al cargar la página por si ya viene con una zona filtrada
|
||||
filterModulos();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -269,11 +269,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm border-danger">
|
||||
<div class="card-header bg-danger text-white">Gastos y Observaciones</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between mb-3">
|
||||
<strong class="text-danger">Monto Gastos:</strong>
|
||||
<div class="card shadow-sm border-danger mb-0"> <div class="card-header bg-danger text-white fw-bold py-1">Gastos y Observaciones</div> <div class="card-body py-2">
|
||||
<div class="mb-1"> <label class="small text-danger fw-bold mb-0">Monto Gastos</label> ```
|
||||
<strong class="text-danger">-${{ "{:,.0f}".format(rendicion[8] or 0).replace(',', '.') }}</strong>
|
||||
</div>
|
||||
<div>
|
||||
@@ -303,14 +300,14 @@
|
||||
<h5 class="modal-title">Editar Rendición #{{ rendicion[0] }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST" action="{{ url_for('edit_rendicion', id=rendicion[0]) }}">
|
||||
<div class="modal-body text-start">
|
||||
<div class="modal-body text-start">
|
||||
<form method="POST" action="{{ url_for('edit_rendicion', id=rendicion[0]) }}" id="editRendicionForm_{{ rendicion[0] }}">
|
||||
<div class="row">
|
||||
<div class="col-md-8 mb-3">
|
||||
<div class="card shadow-sm h-100">
|
||||
<div class="card-header bg-secondary text-white">Productos Vendidos</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive custom-scrollbar" style="max-height: 450px;">
|
||||
<table class="table table-striped mb-0 text-nowrap">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
@@ -341,7 +338,7 @@
|
||||
<tr>
|
||||
<td colspan="3" class="text-end fw-bold">Total Calculado por Sistema:</td>
|
||||
<td class="text-end fw-bold fs-6 text-primary" id="sys_total_{{ rendicion[0] }}">
|
||||
${{ "{:,.0f}".format(rendicion[17] or 0).replace(',', '.') }}
|
||||
${{ "{:,.0f}".format(rendicion[21] or 0).replace(',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@@ -372,9 +369,9 @@
|
||||
</select>
|
||||
<div class="d-flex justify-content-between align-items-center mt-1">
|
||||
<div id="badge_worker_{{ rendicion[0] }}"></div>
|
||||
<div class="form-check form-switch m-0">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="worker_comision" id="wc_{{ rendicion[0] }}" {% if rendicion[14] %}checked{% endif %}>
|
||||
<label class="form-check-label text-warning small" for="wc_{{ rendicion[0] }}">$ Sí</label>
|
||||
<div class="form-check m-0">
|
||||
<input class="form-check-input" type="checkbox" name="worker_comision" id="wc_{{ rendicion[0] }}" {% if rendicion[14] %}checked{% endif %}>
|
||||
<label class="form-check-label text-warning small fw-bold" for="wc_{{ rendicion[0] }}">Recive Comisión</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -391,9 +388,9 @@
|
||||
</select>
|
||||
<div class="d-flex justify-content-between align-items-center mt-1" id="comp_com_div_{{ rendicion[0] }}" {% if not rendicion[12] %}style="display:none;"{% endif %}>
|
||||
<div id="badge_comp_{{ rendicion[0] }}"></div>
|
||||
<div class="form-check form-switch m-0">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="companion_comision" id="cc_{{ rendicion[0] }}" {% if rendicion[15] %}checked{% endif %}>
|
||||
<label class="form-check-label text-warning small" for="cc_{{ rendicion[0] }}">$ Sí</label>
|
||||
<div class="form-check m-0">
|
||||
<input class="form-check-input" type="checkbox" name="companion_comision" id="cc_{{ rendicion[0] }}" {% if rendicion[15] %}checked{% endif %}>
|
||||
<label class="form-check-label text-warning small fw-bold" for="cc_{{ rendicion[0] }}">Recive Comisión</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -458,11 +455,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <div class="modal-footer py-2">
|
||||
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Cancelar</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm px-4">Guardar Cambios</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer py-2">
|
||||
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Cancelar</button>
|
||||
<button type="submit" form="editRendicionForm_{{ rendicion[0] }}" class="btn btn-primary btn-sm px-4">Guardar Cambios</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user