diff --git a/static/js/clickable_row.js b/static/js/clickable_row.js index 4ab51af..55b3f43 100644 --- a/static/js/clickable_row.js +++ b/static/js/clickable_row.js @@ -6,7 +6,6 @@ document.addEventListener("DOMContentLoaded", () => { const row = e.target.closest('.clickable-item'); if (!row || !itemsContainer.contains(row)) return; - // Ignoruj kliknięcia w przyciski i inputy if (e.target.closest('button') || e.target.tagName.toLowerCase() === 'input') { return; } diff --git a/static/js/product_suggestion.js b/static/js/product_suggestion.js index cde7cf7..56efd97 100644 --- a/static/js/product_suggestion.js +++ b/static/js/product_suggestion.js @@ -1,5 +1,4 @@ document.addEventListener("DOMContentLoaded", function () { - // Odśwież eventy document.querySelectorAll('.sync-btn').forEach(btn => { btn.replaceWith(btn.cloneNode(true)); }); @@ -7,7 +6,6 @@ document.addEventListener("DOMContentLoaded", function () { btn.replaceWith(btn.cloneNode(true)); }); - // Synchronizacja sugestii document.querySelectorAll('.sync-btn').forEach(btn => { btn.addEventListener('click', function (e) { e.preventDefault(); @@ -41,7 +39,6 @@ document.addEventListener("DOMContentLoaded", function () { }); }); - // Usuwanie sugestii document.querySelectorAll('.delete-suggestion-btn').forEach(btn => { btn.addEventListener('click', function (e) { e.preventDefault(); diff --git a/static/js/receipt_upload.js b/static/js/receipt_upload.js index 38c4f2b..af89725 100644 --- a/static/js/receipt_upload.js +++ b/static/js/receipt_upload.js @@ -17,8 +17,8 @@ if (!window.receiptUploaderInitialized) { const isDesktop = window.matchMedia("(pointer: fine)").matches; if (isDesktop) { - if (cameraBtn) cameraBtn.remove(); // całkowicie usuń przycisk - if (inputCamera) inputCamera.remove(); // oraz input + if (cameraBtn) cameraBtn.remove(); + if (inputCamera) inputCamera.remove(); if (galleryBtnText) galleryBtnText.textContent = "➕ Dodaj paragon"; } @@ -79,7 +79,6 @@ if (!window.receiptUploaderInitialized) { } lightbox = GLightbox({ selector: ".glightbox" }); - // Pokaż sekcję OCR jeśli była ukryta const analysisBlock = document.getElementById("receiptAnalysisBlock"); if (analysisBlock) { analysisBlock.classList.remove("d-none"); diff --git a/static/js/select.js b/static/js/select.js index 546ccf1..60384ef 100644 --- a/static/js/select.js +++ b/static/js/select.js @@ -1,7 +1,7 @@ document.addEventListener("DOMContentLoaded", function () { new TomSelect("#categories", { plugins: ['remove_button'], - maxItems: 3, // limit wyboru + maxItems: 4, placeholder: 'Wybierz kategorie...', create: false, sortField: { diff --git a/static/js/sockets.js b/static/js/sockets.js index 3a9977b..e9ef140 100644 --- a/static/js/sockets.js +++ b/static/js/sockets.js @@ -82,13 +82,11 @@ socket.on('receipt_added', function (data) { const gallery = document.getElementById("receiptGallery"); if (!gallery) return; - // Usuń placeholder, jeśli istnieje const alert = gallery.querySelector(".alert"); if (alert) { alert.remove(); } - // Sprawdź, czy już istnieje obraz z tym URL const existing = Array.from(gallery.querySelectorAll("img")).find(img => img.src === data.url); if (!existing) { const col = document.createElement("div"); diff --git a/static/js/sort_mode.js b/static/js/sort_mode.js index fad6e84..efa90c4 100644 --- a/static/js/sort_mode.js +++ b/static/js/sort_mode.js @@ -11,12 +11,10 @@ function enableSortMode() { const listId = window.LIST_ID; if (!itemsContainer || !listId) return; - // Odśwież widok listy z uchwytami (☰) if (window.currentItems) { updateListSmoothly(window.currentItems); } - // Poczekaj na DOM po odświeżeniu listy setTimeout(() => { if (sortable) sortable.destroy(); diff --git a/static/js/toggle_button.js b/static/js/toggle_button.js index d441f64..57b6386 100644 --- a/static/js/toggle_button.js +++ b/static/js/toggle_button.js @@ -1,11 +1,8 @@ document.addEventListener("DOMContentLoaded", function () { const toggleBtn = document.getElementById("tempToggle"); const hiddenInput = document.getElementById("temporaryHidden"); - - // Inicjalizacja tooltipa const tooltip = new bootstrap.Tooltip(toggleBtn); - // Funkcja aktualizująca wygląd function updateToggle(isActive) { if (isActive) { toggleBtn.classList.remove("btn-outline-secondary"); @@ -18,11 +15,9 @@ document.addEventListener("DOMContentLoaded", function () { } } - // Inicjalizacja stanu let active = toggleBtn.getAttribute("data-active") === "1"; updateToggle(active); - // Obsługa kliknięcia toggleBtn.addEventListener("click", function () { active = !active; toggleBtn.setAttribute("data-active", active ? "1" : "0"); diff --git a/static/js/user_expense_category.js b/static/js/user_expense_category.js index a12e546..926ead1 100644 --- a/static/js/user_expense_category.js +++ b/static/js/user_expense_category.js @@ -6,7 +6,6 @@ document.addEventListener("DOMContentLoaded", function () { btn.addEventListener("click", function () { const selectedCat = this.dataset.category; - // Zmiana stylu przycisku aktywnego categoryButtons.forEach(b => b.classList.remove("active")); this.classList.add("active"); diff --git a/static/js/user_expense_lists.js b/static/js/user_expense_lists.js index f7ef99d..012a3e4 100644 --- a/static/js/user_expense_lists.js +++ b/static/js/user_expense_lists.js @@ -8,7 +8,6 @@ document.addEventListener('DOMContentLoaded', () => { const customStart = document.getElementById('customStart'); const customEnd = document.getElementById('customEnd'); - // Przywróć zapisane daty if (localStorage.getItem('customStart')) { customStart.value = localStorage.getItem('customStart'); } @@ -40,7 +39,6 @@ document.addEventListener('DOMContentLoaded', () => { btn.classList.add('active'); const range = btn.dataset.range; - // Czyść lokalne daty przy kliknięciu zakresu localStorage.removeItem('customStart'); localStorage.removeItem('customEnd'); diff --git a/static/js/user_expenses.js b/static/js/user_expenses.js index 9519554..f934bed 100644 --- a/static/js/user_expenses.js +++ b/static/js/user_expenses.js @@ -1,7 +1,7 @@ document.addEventListener("DOMContentLoaded", function () { let expensesChart = null; let selectedCategoryId = ""; - let categorySplit = false; // <-- nowy tryb + let categorySplit = false; const rangeLabel = document.getElementById("chartRangeLabel"); function loadExpenses(range = "monthly", startDate = null, endDate = null) { @@ -35,13 +35,21 @@ document.addEventListener("DOMContentLoaded", function () { type: 'bar', data: { labels: data.labels, - datasets: data.datasets // <-- gotowe z backendu + datasets: data.datasets }, options: { responsive: true, plugins: { tooltip: { mode: 'index', intersect: false }, - legend: { position: 'top' } + legend: { + position: 'top', + labels: { + filter: function(legendItem, chart) { + const data = chart.chart.data.datasets[legendItem.datasetIndex].data; + return data.some(value => value !== 0); + } + } + } }, scales: { x: { stacked: true }, @@ -99,7 +107,6 @@ document.addEventListener("DOMContentLoaded", function () { loadExpenses(); // przeładuj wykres }); - // Reszta Twojego kodu bez zmian... const startDateInput = document.getElementById("startDate"); const endDateInput = document.getElementById("endDate"); const today = new Date(); diff --git a/templates/user_expenses.html b/templates/user_expenses.html index db48d63..dd44e6a 100644 --- a/templates/user_expenses.html +++ b/templates/user_expenses.html @@ -7,7 +7,6 @@ ← Powrót -
@@ -30,7 +29,6 @@ {% endfor %}
-
-
💰 Suma zaznaczonych: 0.00 PLN
-
@@ -148,7 +144,6 @@
-