{% if zbiorka.typ_zbiorki == 'rezerwa' %}
Lista rezerwowa
{% endif %}
{% if is_done and zbiorka.typ_zbiorki != 'rezerwa' %}
Zrealizowana
{% endif %}
{% if zbiorka.ukryj_kwote %}
Kwoty niepubliczne
{% else %}
Kwoty widoczne
{% endif %}
Opis
{{ zbiorka.opis | markdown }}
{# Czy są produkty? #}
{% set items = zbiorka.przedmioty or [] %}
{% set has_items = (items|length > 0) %}
{% if has_items %}
Lista zakupów
{% set posortowane = items|sort(attribute='kupione') %}
{% for it in posortowane %}
{% if it.kupione %}
Kupione
{% else %}
Do kupienia
{% endif %}
{{ it.nazwa }}
{% if it.link %}
Sklep
↗
{% endif %}
{% if not zbiorka.ukryj_kwote %}
{% if it.cena is not none %}
{{ it.cena|round(2) }} PLN
{% else %}
—
{% endif %}
{% else %}
—
{% endif %}
{% endfor %}
{% endif %}
{# Dodatkowe wyliczenia do postępu zakupów #}
{% set total_cnt = items|length %}
{% set kupione_cnt = (items|selectattr('kupione')|list|length) %}
{% set items_pct = (kupione_cnt / total_cnt * 100) if total_cnt > 0 else 0 %}
{% if not zbiorka.ukryj_kwote %}
{% set suma_all = (items|selectattr('cena')|map(attribute='cena')|sum) or 0 %}
{% set suma_kupione = (items|selectattr('kupione')|selectattr('cena')|map(attribute='cena')|sum) or 0 %}
{% 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' %}
Postęp
{% if has_cel and not zbiorka.ukryj_kwote and zbiorka.pokaz_postep_finanse %}
Finanse: {{ zbiorka.stan|round(2) }} / {{ zbiorka.cel|round(2) }} PLN
{% endif %}
{% if has_items and zbiorka.pokaz_postep_pozycje %}
Pozycje: {{ kupione_cnt }}/{{ total_cnt }}
{% endif %}
{% if has_items and not zbiorka.ukryj_kwote and (suma_all or 0) > 0 and zbiorka.pokaz_postep_kwotowo %}
Zakupy (kwotowo): {{ (suma_kupione or 0)|round(2) }} / {{ (suma_all or 0)|round(2) }} PLN
{% endif %}
{# Pasek: Finanse #}
{% if zbiorka.pokaz_postep_finanse %}
Finanse
{% if zbiorka.ukryj_kwote %}—{% else %}{{ progress|round(1) }}%{% endif %}
{% endif %}
{# Pasek: Zakupy sztukami #}
{% if has_items and zbiorka.pokaz_postep_pozycje %}
Zakupy (liczba pozycji)
{{ items_pct|round(1) }}%
{% endif %}
{# Pasek: Zakupy kwotowo #}
{% if has_items and not zbiorka.ukryj_kwote and (suma_all or 0) > 0 and zbiorka.pokaz_postep_kwotowo %}
Zakupy (kwotowo)
{{ suma_pct|round(1) }}%
{% endif %}
{% endif %}
{# Koniec warunku dla typu zbiórki #}
{% set show_iban = zbiorka.uzyj_konta and zbiorka.numer_konta %}
{% set show_blik = zbiorka.uzyj_blik and zbiorka.numer_telefonu_blik %}
{% if zbiorka.typ_zbiorki == 'rezerwa' %}
Wsparcie mona kierować na
{% else %}
Jak wspomóc?
{% endif %}
{% if has_cel and not zbiorka.ukryj_kwote and zbiorka.typ_zbiorki != 'rezerwa' %}
{% set brak = (zbiorka.cel - zbiorka.stan) %}
{% if brak > 0 %}
Brakuje: {{ brak|round(2) }} PLN
{% else %}
Zrealizowana
{% endif %}
{% endif %}
{% if show_iban or show_blik %}
{% if show_iban %}
{% endif %}
{% if show_blik %}
{% endif %}
{% else %}
Kanały płatności są wyłączone dla tej zbiórki.
{% endif %}
{% if not zbiorka.ukryj_kwote %}
{% if zbiorka.typ_zbiorki != 'rezerwa' %}
{% if has_cel %}
Cel{{ zbiorka.cel|round(2) }} PLN
{% endif %}
{% endif %}
Stan{{ zbiorka.stan|round(2) }} PLN
{% if zbiorka.typ_zbiorki != 'rezerwa' and has_cel %}
{% if brak > 0 %}Brakuje{% elif brak == 0 %}Cel{% else %}Nadwyżka{% endif %}
{% if brak > 0 %}
{{ brak|round(2) }} PLN
{% elif brak == 0 %}
osiągnięty
{% else %}
{{ (-brak)|round(2) }} PLN
{% endif %}
{% endif %}
{% endif %}
{% if current_user.is_authenticated and current_user.czy_admin %}