From 866f9ca2fdd12d99faca17710f0791df85323954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Wed, 17 Sep 2025 21:36:13 +0200 Subject: [PATCH] podzial dzienny --- static/js/expense_chart.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/static/js/expense_chart.js b/static/js/expense_chart.js index c05e1d7..24149aa 100644 --- a/static/js/expense_chart.js +++ b/static/js/expense_chart.js @@ -165,12 +165,20 @@ document.addEventListener("DOMContentLoaded", function () { // Automatyczne ładowanie danych po przełączeniu na zakładkę Wykres document.getElementById('chart-tab').addEventListener('shown.bs.tab', function () { - loadExpenses(); + // Sprawdź jaki tryb jest aktywny (domyślnie dzienny lub miesięczny) + if (document.getElementById('toggleDailySplit').classList.contains('btn-primary')) { + loadExpenses('daily'); + } else if (document.getElementById('toggleMonthlySplit').classList.contains('btn-primary')) { + loadExpenses('monthly'); + } else { + loadExpenses('currentmonth'); // Albo inna domyślna wartość + } }); + // Jeśli jesteśmy od razu na zakładce Wykres - if (document.getElementById('chart-tab').classList.contains('active')) { - loadExpenses("currentmonth"); - } + //if (document.getElementById('chart-tab').classList.contains('active')) { + // loadExpenses("currentmonth"); + // } });