podzial dzienny
This commit is contained in:
@@ -28,12 +28,29 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
// Obsługa kliknięć przycisków czasu
|
||||
toggleMonthlySplit.addEventListener('click', function() {
|
||||
setActiveTimeSplit('monthly');
|
||||
loadExpenses('monthly');
|
||||
|
||||
const startDate = document.getElementById('startDate')?.value || null;
|
||||
const endDate = document.getElementById('endDate')?.value || null;
|
||||
|
||||
if (startDate && endDate) {
|
||||
loadExpenses('monthly', startDate, endDate);
|
||||
} else {
|
||||
loadExpenses('monthly');
|
||||
}
|
||||
});
|
||||
|
||||
toggleDailySplit.addEventListener('click', function() {
|
||||
setActiveTimeSplit('daily');
|
||||
loadExpenses('daily');
|
||||
|
||||
const startDate = document.getElementById('startDate')?.value || null;
|
||||
const endDate = document.getElementById('endDate')?.value || null;
|
||||
|
||||
// Przy podziale dziennym, jeśli zakres dat jest podany, użyj 'custom'
|
||||
if (startDate && endDate) {
|
||||
loadExpenses('custom', startDate, endDate);
|
||||
} else {
|
||||
loadExpenses('daily');
|
||||
}
|
||||
});
|
||||
|
||||
// Obsługa kliknięcia przycisku podziału kategorii
|
||||
@@ -54,5 +71,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
// Inicjalizacja - domyślnie ustaw podział dzienny
|
||||
setActiveTimeSplit('daily');
|
||||
loadExpenses('daily');
|
||||
|
||||
const startDate = document.getElementById('startDate')?.value || null;
|
||||
const endDate = document.getElementById('endDate')?.value || null;
|
||||
|
||||
if (startDate && endDate) {
|
||||
loadExpenses('custom', startDate, endDate);
|
||||
} else {
|
||||
loadExpenses('daily');
|
||||
}
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user