podzial dzienny
This commit is contained in:
@@ -173,15 +173,52 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
loadExpenses("currentmonth");
|
||||
}
|
||||
|
||||
document.getElementById('toggleDailySplit').addEventListener('click', function() {
|
||||
// Pobierz aktualne daty jeśli są ustawione w inputach
|
||||
const startDateInput = document.getElementById('startDate');
|
||||
const endDateInput = document.getElementById('endDate');
|
||||
let startDate = startDateInput ? startDateInput.value : null;
|
||||
let endDate = endDateInput ? endDateInput.value : null;
|
||||
|
||||
// Wywołaj funkcję z "daily" jako typ zakresu
|
||||
loadExpenses('daily', startDate, endDate);
|
||||
// podzial casu
|
||||
const toggleMonthlySplit = document.getElementById('toggleMonthlySplit');
|
||||
const toggleDailySplit = document.getElementById('toggleDailySplit');
|
||||
const toggleCategorySplit = document.getElementById('toggleCategorySplit');
|
||||
|
||||
toggleMonthlySplit.addEventListener('click', function() {
|
||||
this.classList.add('btn-primary');
|
||||
this.classList.remove('btn-outline-light');
|
||||
this.setAttribute('aria-pressed', 'true');
|
||||
|
||||
toggleDailySplit.classList.remove('btn-primary');
|
||||
toggleDailySplit.classList.add('btn-outline-light');
|
||||
toggleDailySplit.setAttribute('aria-pressed', 'false');
|
||||
|
||||
loadExpenses('monthly');
|
||||
});
|
||||
|
||||
toggleDailySplit.addEventListener('click', function() {
|
||||
this.classList.add('btn-primary');
|
||||
this.classList.remove('btn-outline-light');
|
||||
this.setAttribute('aria-pressed', 'true');
|
||||
|
||||
toggleMonthlySplit.classList.remove('btn-primary');
|
||||
toggleMonthlySplit.classList.add('btn-outline-light');
|
||||
toggleMonthlySplit.setAttribute('aria-pressed', 'false');
|
||||
|
||||
loadExpenses('daily');
|
||||
});
|
||||
|
||||
toggleCategorySplit.addEventListener('click', function() {
|
||||
const isActive = this.classList.contains('btn-primary');
|
||||
if (isActive) {
|
||||
this.classList.remove('btn-primary');
|
||||
this.classList.add('btn-outline-light');
|
||||
this.setAttribute('aria-pressed', 'false');
|
||||
// Wyłącz podział na kategorie
|
||||
loadExpenses(); // bez podziału na kategorie
|
||||
} else {
|
||||
this.classList.add('btn-primary');
|
||||
this.classList.remove('btn-outline-light');
|
||||
this.setAttribute('aria-pressed', 'true');
|
||||
// Włącz podział na kategorie
|
||||
loadExpenses({ bycategory: true });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user