podzial dzienny

This commit is contained in:
Mateusz Gruszczyński
2025-09-17 21:36:13 +02:00
parent 1326d5b4ef
commit 866f9ca2fd

View File

@@ -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");
// }
});