universal filters v1 + more sample data

This commit is contained in:
2026-03-28 01:11:23 -03:00
parent 41ceba5237
commit 313ae9a15a
9 changed files with 351 additions and 428 deletions

View File

@@ -573,4 +573,46 @@
</div>
</div>
</div>
{% endmacro %}
{% macro report_filters(action_url, workers, selected_worker, selected_dia, meses, mes_act, anios, anio_act) %}
<div class="card shadow-sm mb-4 border-0 bg-dark-subtle">
<div class="card-body p-3">
<form method="GET" action="{{ action_url }}" class="row g-2 align-items-end">
<div class="col-md-2">
<label class="form-label small text-muted mb-1">Año/Mes</label>
<div class="input-group input-group-sm">
<select name="anio" class="form-select">
{% for a in anios %}<option value="{{ a }}" {{ 'selected' if a|string == anio_act|string }}>{{ a }}</option>{% endfor %}
</select>
<select name="mes" class="form-select">
{% for m_num, m_name in meses %}<option value="{{ m_num }}" {{ 'selected' if m_num == mes_act }}>{{ m_name }}</option>{% endfor %}
</select>
</div>
</div>
<div class="col-md-2">
<label class="form-label small text-muted mb-1">Día (Opcional)</label>
<select name="dia" class="form-select form-select-sm">
<option value="">Todos los días</option>
{% for d in range(1, 32) %}
{% set d_str = "%02d"|format(d) %}
<option value="{{ d_str }}" {{ 'selected' if d_str == selected_dia }}>{{ d_str }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<label class="form-label small text-muted mb-1">Trabajador</label>
<select name="worker_id" class="form-select form-select-sm">
<option value="">Todos los trabajadores</option>
{% for w in workers %}
<option value="{{ w[0] }}" {{ 'selected' if w[0]|string == selected_worker|string }}>{{ w[1] }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-primary btn-sm w-100"><i class="bi bi-filter"></i> Aplicar Filtros</button>
</div>
</form>
</div>
</div>
{% endmacro %}