Borra JS muerto y la seccion comparativa duplicada del dashboard
El bloque <script> del formulario de periodo definia clearPeriodPreset y
tres consts, y no lo llamaba nadie: no hay ningun onchange ni listener que
lo use. Debajo habia ademas un segundo <script> entero comentado, de una
version anterior de los presets. Los ids hiddenPeriod, yearSelect y
monthSelect siguen en el formulario, que los usa para las etiquetas.
La seccion "Comparativa" del final mostraba la misma diferencia y el mismo
porcentaje que "Resumen comparativo" ya ensena arriba, y ambas salen bajo
el mismo {% if compare_enabled %}. Es un subconjunto estricto: la de arriba
anade los totales de los dos periodos. La de abajo ademas imprimia
kpi_difference_abs con un "+" condicional, asi que una bajada se veia como
"12,00 € (-13,3%)", sin signo en la cifra y con el porcentaje en negativo.
Se queda la de arriba, que imprime "-12,00 €".
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
f074005a7f
commit
1cc13bae57
@ -95,34 +95,6 @@
|
||||
<button type="submit" class="btn btn-primary">Aplicar Filtros</button>
|
||||
</form>
|
||||
</section>
|
||||
<script>
|
||||
const yearSelect = document.getElementById('yearSelect');
|
||||
const monthSelect = document.getElementById('monthSelect');
|
||||
const hiddenPeriod = document.getElementById('hiddenPeriod');
|
||||
|
||||
function clearPeriodPreset() {
|
||||
if (hiddenPeriod) {
|
||||
hiddenPeriod.value = ""
|
||||
}
|
||||
document.querySelectorAll('.preset').forEach(btn => btn.classList.remove('active'));
|
||||
}
|
||||
</script>
|
||||
<!-- <script>
|
||||
document.querySelectorAll('.dashboard-presets a').forEach(link => {
|
||||
link.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
|
||||
const period = link.dataset.period;
|
||||
const isActive = link.classList.contains('active');
|
||||
|
||||
if (isActive) {
|
||||
window.location.href = link.href;
|
||||
} else {
|
||||
window.location.href = `${link.href}?period=${period}`
|
||||
}
|
||||
});
|
||||
});
|
||||
</script> -->
|
||||
|
||||
<!-- ========================= -->
|
||||
<!-- KPIs -->
|
||||
@ -393,23 +365,6 @@
|
||||
</script>
|
||||
|
||||
|
||||
{% if compare_enabled %}
|
||||
<section class="comparison">
|
||||
<h3>Comparativa</h3>
|
||||
|
||||
<p>
|
||||
Diferencia:
|
||||
<strong class="{% if kpi_trend == 'up' %}positive{% endif %}">
|
||||
{% if kpi_trend == "up" %}+{% endif %}
|
||||
{{ kpi_difference_abs|floatformat:2 }} €
|
||||
</strong>
|
||||
{% if kpi_percentage %}
|
||||
({{ kpi_percentage|floatformat:1 }}%)
|
||||
{% endif %}
|
||||
</p>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<!-- ========================= -->
|
||||
<!-- Goals -->
|
||||
<!-- ========================= -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user