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 %} +