rendiciones a modal yipi

This commit is contained in:
2026-03-21 00:19:31 -03:00
parent 2de00bc77f
commit 9700993735
4 changed files with 152 additions and 185 deletions

View File

@@ -117,18 +117,126 @@
</div>
{% endmacro %}
{% macro view_rendicion_modal() %}
<div class="modal fade" id="viewRendicionModal" tabindex="-1" aria-hidden="true">
{% macro rendicion_detail_modal(rendicion, items, total_calculado, comision_total) %}
<div class="modal fade" id="viewRendicion{{ rendicion[0] }}" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header bg-dark text-white">
<h5 class="modal-title" id="rendicionModalTitle">Detalle de Rendición</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
<div class="modal-header">
<h5 class="modal-title">Detalle de Rendición #{{ rendicion[0] }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="rendicionModalBody">
<div class="text-center py-5">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">Cargando</span>
<div class="modal-body text-start">
<div class="row">
<div class="col-md-8 mb-4">
<div class="card shadow-sm h-100">
<div class="card-header bg-secondary text-white">Productos Vendidos</div>
<div class="card-body p-0">
<table class="table table-striped mb-0">
<thead class="table-dark">
<tr>
<th>Producto</th>
<th class="text-center">Cant.</th>
<th class="text-end">Precio Un.</th>
<th class="text-end">Total Línea</th>
<th class="text-end">Comisión</th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<td>{{ item[0] }}</td>
<td class="text-center fw-bold">{{ item[1] }}</td>
<td class="text-end text-muted">${{ "{:,.0f}".format(item[2]).replace(',', '.') }}</td>
<td class="text-end fw-bold">${{ "{:,.0f}".format(item[4]).replace(',', '.') }}</td>
<td class="text-end text-success">${{ "{:,.0f}".format(item[5]).replace(',', '.') }}</td>
</tr>
{% else %}
<tr>
<td colspan="5" class="text-center py-3">No se registraron productos en esta rendición.</td>
</tr>
{% endfor %}
</tbody>
<tfoot class="table-group-divider">
<tr>
<td colspan="3" class="text-end fw-bold">Total Calculado por Sistema:</td>
<td class="text-end fw-bold fs-5">${{ "{:,.0f}".format(total_calculado or 0).replace(',', '.') }}</td>
<td class="text-end fw-bold text-success">${{ "{:,.0f}".format(comision_total or 0).replace(',', '.') }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card shadow-sm mb-4 border-info">
<div class="card-header bg-info text-dark fw-bold">Declaración del Trabajador</div>
<div class="card-body">
<dl class="row mb-0">
<dt class="col-sm-5 text-muted">Fecha</dt>
<dd class="col-sm-7">{{ rendicion[1] }}</dd>
<dt class="col-sm-5 text-muted">Trabajador</dt>
<dd class="col-sm-7">{{ rendicion[2] }}</dd>
<dt class="col-sm-5 text-muted">Acompañante</dt>
<dd class="col-sm-7">
{% if rendicion[10] %}
{{ rendicion[10] }}
{% else %}
<span class="text-muted italic small">Sin acompañante</span>
{% endif %}
</dd>
<dt class="col-sm-5 text-muted">Módulo</dt>
<dd class="col-sm-7"><span class="badge bg-secondary">{{ rendicion[3] }}</span></dd>
<dt class="col-sm-5 text-muted">Turno</dt>
<dd class="col-sm-7">{{ rendicion[4] }}</dd>
</dl>
<hr>
<div class="d-flex justify-content-between mb-2">
<span class="text-muted">Tarjetas:</span>
<span>${{ "{:,.0f}".format(rendicion[5] or 0).replace(',', '.') }}</span>
</div>
<div class="d-flex justify-content-between mb-2">
<span class="text-muted">Mercado Pago:</span>
<span>${{ "{:,.0f}".format(rendicion[6] or 0).replace(',', '.') }}</span>
</div>
<div class="d-flex justify-content-between mb-2">
<span class="text-muted">Efectivo:</span>
<span>${{ "{:,.0f}".format(rendicion[7] or 0).replace(',', '.') }}</span>
</div>
{% set total_declarado = rendicion[5] + rendicion[6] + rendicion[7] %}
<div class="d-flex justify-content-between mt-3 pt-2 border-top">
<strong class="fs-5">Total Declarado:</strong>
<strong class="fs-5">${{ "{:,.0f}".format(total_declarado).replace(',', '.') }}</strong>
</div>
{% if total_declarado != total_calculado %}
<div class="alert alert-warning mt-3 mb-0 py-2">
<small>Discrepancia: El total declarado (${{ "{:,.0f}".format(total_declarado).replace(',', '.') }}) no coincide con la suma de los productos vendidos (${{ "{:,.0f}".format(total_calculado).replace(',', '.') }}).</small>
</div>
{% endif %}
</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>
<strong class="text-danger">-${{ "{:,.0f}".format(rendicion[8] or 0).replace(',', '.') }}</strong>
</div>
<div>
<span class="text-muted d-block mb-1">Observaciones:</span>
<p class="mb-0 bg-dark p-2 rounded border border-secondary" style="font-size: 0.9em;">
{{ rendicion[9] if rendicion[9] else "Sin observaciones." }}
</p>
</div>
</div>
</div>
</div>
</div>
</div>