From c96a0763a720985db4113752bb66d90ae4546525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Wed, 9 Jul 2025 17:04:34 +0200 Subject: [PATCH] ukrycie sekcji paragonow --- static/js/functions.js | 19 +++++++++++++++++++ templates/list_share.html | 7 +++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/static/js/functions.js b/static/js/functions.js index 7625209..e1ea2a7 100644 --- a/static/js/functions.js +++ b/static/js/functions.js @@ -238,3 +238,22 @@ function updateListSmoothly(newItems) { updateProgressBar(); } + +document.addEventListener("DOMContentLoaded", function() { + const receiptSection = document.getElementById("receiptSection"); + const toggleBtn = document.querySelector('[data-bs-target="#receiptSection"]'); + + if (!receiptSection || !toggleBtn) return; + + if (localStorage.getItem("receiptSectionOpen") === "true") { + new bootstrap.Collapse(receiptSection, { toggle: true }); + } + + receiptSection.addEventListener('shown.bs.collapse', function () { + localStorage.setItem("receiptSectionOpen", "true"); + }); + + receiptSection.addEventListener('hidden.bs.collapse', function () { + localStorage.setItem("receiptSectionOpen", "false"); + }); +}); diff --git a/templates/list_share.html b/templates/list_share.html index e33a7bf..6f29f73 100644 --- a/templates/list_share.html +++ b/templates/list_share.html @@ -59,9 +59,12 @@ {% endif %}

💸 Łącznie wydano: {{ '%.2f'|format(total_expense) }} PLN

+ +
{% set receipt_pattern = 'list_' ~ list.id %} {% if receipt_files %} -
📸 Paragony dodane do tej listy
{% for file in receipt_files %} @@ -73,7 +76,6 @@ {% endfor %}
{% else %} -

Brak wgranych paragonów do tej listy.

{% endif %} @@ -87,6 +89,7 @@
{% endif %} +