ukrycie sekcji paragonow

This commit is contained in:
Mateusz Gruszczyński
2025-07-09 17:04:34 +02:00
parent 4c91c1842f
commit c96a0763a7
2 changed files with 24 additions and 2 deletions

View File

@@ -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");
});
});

View File

@@ -59,9 +59,12 @@
{% endif %}
<p id="total-expense2"><b>💸 Łącznie wydano:</b> {{ '%.2f'|format(total_expense) }} PLN</p>
<button class="btn btn-outline-light mb-3" type="button" data-bs-toggle="collapse" data-bs-target="#receiptSection" aria-expanded="false" aria-controls="receiptSection">
📄 Pokaż sekcję paragonów
</button>
<div class="collapse" id="receiptSection">
{% set receipt_pattern = 'list_' ~ list.id %}
{% if receipt_files %}
<hr>
<h5 class="mt-4">📸 Paragony dodane do tej listy</h5>
<div class="row g-3 mt-2">
{% for file in receipt_files %}
@@ -73,7 +76,6 @@
{% endfor %}
</div>
{% else %}
<hr>
<p><span class="badge bg-secondary">Brak wgranych paragonów do tej listy.</span></p>
{% endif %}
@@ -87,6 +89,7 @@
</div>
</form>
{% endif %}
</div>
<!-- Modal notatki -->
<div class="modal fade" id="noteModal" tabindex="-1" aria-hidden="true">