zakresy z kubelkow w backendzie

This commit is contained in:
Mateusz Gruszczyński
2025-09-18 22:16:06 +02:00
parent 7eb29b271a
commit 0120feff33
2 changed files with 3 additions and 21 deletions

View File

@@ -96,31 +96,13 @@ document.addEventListener("DOMContentLoaded", function () {
const r = this.getAttribute("data-range"); // last30days/currentmonth/monthly/quarterly/halfyearly/yearly
// Zakresy kubełkowane bez start/end, bez "daily"
if (["monthly", "quarterly", "halfyearly", "yearly"].includes(r)) {
if (["monthly", "quarterly", "halfyearly", "yearly", "currentmonth", "last30days"].includes(r)) {
if (startDateInput) startDateInput.value = "";
if (endDateInput) endDateInput.value = "";
window.loadExpenses(r); // => /expenses_data?range=monthly|quarterly|halfyearly|yearly
window.loadExpenses(r); // => /expenses_data?range=<r>
return;
}
if (r === "currentmonth") {
const t = today();
const first = new Date(t.getFullYear(), t.getMonth(), 1);
if (isDailyActive()) {
window.loadExpenses("daily", iso(first), iso(t));
} else {
window.loadExpenses("monthly", iso(first), iso(t));
}
return;
}
if (r === "last30days") {
if (isDailyActive()) {
window.loadExpenses("daily", iso(daysAgo(30)), iso(today()));
} else {
window.loadExpenses("last30days");
}
return;
}
// reset pickera
if (startDateInput) startDateInput.value = "";

View File

@@ -150,7 +150,7 @@
</div>
<p id="chartRangeLabel" class="fw-bold mb-3">Wybrany zakres: miesięczne</p>
<p id="chartRangeLabel" class="fw-bold mb-3">Widok: miesięczne</p>
<canvas id="expensesChart" height="120"></canvas>
</div>
</div>