funkcje rezerw i przesuniec
This commit is contained in:
@@ -7,14 +7,22 @@
|
||||
{# Wyliczenia postępu finansowego #}
|
||||
{% set has_cel = (zbiorka.cel is defined and zbiorka.cel and zbiorka.cel > 0) %}
|
||||
{% set progress = (zbiorka.stan / zbiorka.cel * 100) if has_cel else 0 %}
|
||||
{% set progress_clamped = 100 if progress > 100 else (0 if progress < 0 else progress) %} {% set
|
||||
is_done=(progress_clamped>= 100) %}
|
||||
{% set progress_clamped = 100 if progress > 100 else (0 if progress < 0 else progress) %}
|
||||
{% set is_done=(progress_clamped>= 100) %}
|
||||
|
||||
<!-- Nagłówek -->
|
||||
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-3">
|
||||
<h2 class="mb-0">{{ zbiorka.nazwa }}</h2>
|
||||
<h2 class="mb-0">
|
||||
{% if zbiorka.typ_zbiorki == 'rezerwa' %}
|
||||
<i class="bi bi-wallet2"></i>
|
||||
{% endif %}
|
||||
{{ zbiorka.nazwa }}
|
||||
</h2>
|
||||
<div class="d-flex flex-wrap align-items-center gap-2">
|
||||
{% if is_done %}
|
||||
{% if zbiorka.typ_zbiorki == 'rezerwa' %}
|
||||
<span class="badge bg-info">Lista rezerwowa</span>
|
||||
{% endif %}
|
||||
{% if is_done and zbiorka.typ_zbiorki != 'rezerwa' %}
|
||||
<span class="badge rounded-pill" style="background: var(--accent); color:#111;">Zrealizowana</span>
|
||||
{% endif %}
|
||||
{% if zbiorka.ukryj_kwote %}
|
||||
@@ -97,6 +105,8 @@
|
||||
{% set suma_pct = (suma_kupione / suma_all * 100) if suma_all > 0 else 0 %}
|
||||
{% endif %}
|
||||
|
||||
{# Pokazuj sekcję postępu TYLKO dla standardowych zbiórek, NIE dla rezerwowych #}
|
||||
{% if zbiorka.typ_zbiorki != 'rezerwa' %}
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-2">
|
||||
@@ -162,6 +172,8 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{# Koniec warunku dla typu zbiórki #}
|
||||
|
||||
</div>
|
||||
|
||||
@@ -174,8 +186,14 @@
|
||||
<div class="card-body d-flex flex-column gap-3">
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
<h5 class="mb-0">Jak wspomóc?</h5>
|
||||
{% if has_cel and not zbiorka.ukryj_kwote %}
|
||||
<h5 class="mb-0">
|
||||
{% if zbiorka.typ_zbiorki == 'rezerwa' %}
|
||||
Wpłaty
|
||||
{% else %}
|
||||
Jak wspomóc?
|
||||
{% endif %}
|
||||
</h5>
|
||||
{% if has_cel and not zbiorka.ukryj_kwote and zbiorka.typ_zbiorki != 'rezerwa' %}
|
||||
{% set brak = (zbiorka.cel - zbiorka.stan) %}
|
||||
{% if brak > 0 %}
|
||||
<span class="badge bg-warning text-dark border border-warning">Brakuje: {{ brak|round(2) }} PLN</span>
|
||||
@@ -223,17 +241,21 @@
|
||||
|
||||
{% if not zbiorka.ukryj_kwote %}
|
||||
<ul class="list-group list-group-flush small">
|
||||
{% if has_cel %}
|
||||
<li class="list-group-item bg-transparent d-flex justify-content-between">
|
||||
<span>Cel</span>
|
||||
<span class="fw-semibold">{{ zbiorka.cel|round(2) }} PLN</span>
|
||||
</li>
|
||||
{% if zbiorka.typ_zbiorki != 'rezerwa' %}
|
||||
{% if has_cel %}
|
||||
<li class="list-group-item bg-transparent d-flex justify-content-between">
|
||||
<span>Cel</span>
|
||||
<span class="fw-semibold">{{ zbiorka.cel|round(2) }} PLN</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<li class="list-group-item bg-transparent d-flex justify-content-between">
|
||||
<span>Stan</span>
|
||||
<span class="fw-semibold text-success">{{ zbiorka.stan|round(2) }} PLN</span>
|
||||
</li>
|
||||
{% if has_cel %}
|
||||
|
||||
{% if zbiorka.typ_zbiorki != 'rezerwa' and has_cel %}
|
||||
<li class="list-group-item bg-transparent d-flex justify-content-between">
|
||||
<span>
|
||||
{% if brak > 0 %}Brakuje{% elif brak == 0 %}Cel{% else %}Nadwyżka{% endif %}
|
||||
@@ -259,10 +281,18 @@
|
||||
wpłatę</a>
|
||||
<a href="{{ url_for('dodaj_wydatek', zbiorka_id=zbiorka.id) }}" class="btn btn-outline-light btn-sm">Dodaj
|
||||
wydatek</a>
|
||||
<a href="{{ url_for('dodaj_przesuniecie', zbiorka_id=zbiorka.id) }}" class="btn btn-outline-light btn-sm">
|
||||
<i class="bi bi-arrow-left-right"></i> Przesuń środki
|
||||
</a>
|
||||
<a href="{{ url_for('edytuj_stan', zbiorka_id=zbiorka.id) }}" class="btn btn-outline-light btn-sm">Edytuj
|
||||
stan</a>
|
||||
{% if zbiorka.typ_zbiorki != 'rezerwa' %}
|
||||
<a href="{{ url_for('formularz_zbiorek', zbiorka_id=zbiorka.id) }}"
|
||||
class="btn btn-outline-light btn-sm">Edytuj opis</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('edytuj_rezerwe', rezerwa_id=zbiorka.id) }}"
|
||||
class="btn btn-outline-light btn-sm">Edytuj rezerwę</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -293,16 +323,41 @@
|
||||
<li class="list-group-item bg-transparent d-flex flex-wrap justify-content-between align-items-center">
|
||||
<div class="me-3">
|
||||
<strong>{{ a.data|dt("%d.%m.%Y %H:%M") }}</strong>
|
||||
<span class="badge {% if a.typ == 'wpłata' %}bg-success{% else %}bg-danger{% endif %} ms-2">
|
||||
{{ a.typ|capitalize }}
|
||||
</span>
|
||||
|
||||
{% if a.typ == 'wpłata' %}
|
||||
<span class="badge bg-success ms-2">Wpłata</span>
|
||||
{% elif a.typ == 'wydatek' %}
|
||||
<span class="badge bg-danger ms-2">Wydatek</span>
|
||||
{% elif a.typ == 'przesunięcie_przych' %}
|
||||
<span class="badge bg-info ms-2">Przesunięcie (↓ przychód)</span>
|
||||
{% elif a.typ == 'przesunięcie_wych' %}
|
||||
<span class="badge bg-warning text-dark ms-2">Przesunięcie (↑ wychód)</span>
|
||||
{% endif %}
|
||||
|
||||
{% if a.opis %}
|
||||
<span class="text-muted">— {{ a.opis }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if a.typ in ['przesunięcie_przych', 'przesunięcie_wych'] and a.zbiorka_id %}
|
||||
<a href="{{ url_for('zbiorka', zbiorka_id=a.zbiorka_id) }}"
|
||||
class="ms-2 text-decoration-none small">
|
||||
<i class="bi bi-link-45deg"></i>
|
||||
{% if a.typ == 'przesunięcie_przych' %}
|
||||
z: {{ a.zbiorka_nazwa }}
|
||||
{% else %}
|
||||
do: {{ a.zbiorka_nazwa }}
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if not zbiorka.ukryj_kwote %}
|
||||
<span class="badge bg-dark border ms-auto" style="border-color: var(--border);">
|
||||
{% if a.typ == 'wpłata' %}+{% else %}-{% endif %} {{ a.kwota|round(2) }} PLN
|
||||
{% if a.typ == 'wpłata' or a.typ == 'przesunięcie_przych' %}
|
||||
+{{ a.kwota|round(2) }} PLN
|
||||
{% else %}
|
||||
-{{ a.kwota|round(2) }} PLN
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
@@ -317,7 +372,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Akcje dolne -->
|
||||
<div class="d-flex gap-2 justify-content-between mt-3">
|
||||
<div></div>
|
||||
@@ -325,10 +379,10 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ url_for('static', filename='js/zbiorka.js') }}?v={{ APP_VERSION }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/progress.js') }}?v={{ APP_VERSION }}"></script>
|
||||
{% endblock %}
|
||||
{% block extra_scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ url_for('static', filename='js/zbiorka.js') }}?v={{ APP_VERSION }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/progress.js') }}?v={{ APP_VERSION }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user