wizualne
This commit is contained in:
@@ -6,16 +6,18 @@
|
||||
|
||||
<!-- Nawigacja -->
|
||||
<div class="d-flex align-items-center gap-2 mb-3">
|
||||
<a href="{{ url_for('zbiorka', zbiorka_id=zbiorka.id) }}" class="btn btn-sm btn-outline-light">← Szczegóły
|
||||
zbiórki</a>
|
||||
<a href="{{ url_for('zbiorka', zbiorka_id=zbiorka.id) }}" class="btn btn-sm btn-outline-light">← Szczegóły zbiórki</a>
|
||||
<a href="{{ url_for('admin_dashboard') }}" class="btn btn-sm btn-outline-light">← Panel Admina</a>
|
||||
</div>
|
||||
|
||||
{# Obliczenia wstępne (do inicjalnego podglądu) #}
|
||||
{% set has_cel = (zbiorka.cel is defined and zbiorka.cel and zbiorka.cel > 0) %}
|
||||
{% set has_cel = (zbiorka.cel is defined and zbiorka.cel and zbiorka.cel > 0 and zbiorka.typ_zbiorki != 'rezerwa') %}
|
||||
{% 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) %} <div class="card shadow-sm"
|
||||
data-module="edit-stan" data-cel="{{ (zbiorka.cel|round(2)) if has_cel else 0 }}">
|
||||
{% set progress_clamped = 100 if progress > 100 else (0 if progress < 0 else progress) %}
|
||||
|
||||
<div class="card shadow-sm" data-module="edit-stan"
|
||||
data-cel="{{ (zbiorka.cel|round(2)) if has_cel else 0 }}"
|
||||
data-typ-zbiorki="{{ zbiorka.typ_zbiorki }}">
|
||||
<div class="card-header bg-secondary text-white d-flex flex-wrap align-items-center justify-content-between gap-2">
|
||||
<h3 class="card-title mb-0">Edytuj stan: <span class="fw-semibold">{{ zbiorka.nazwa }}</span></h3>
|
||||
<div class="d-flex align-items-center flex-wrap gap-2">
|
||||
@@ -43,17 +45,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mini progress (aktualny) -->
|
||||
<!-- Mini progress (aktualny) - tylko dla standardowych zbiórek -->
|
||||
{% if zbiorka.typ_zbiorki != 'rezerwa' %}
|
||||
<div class="px-3 pt-3">
|
||||
<div class="progress" role="progressbar" aria-valuenow="{{ progress_clamped|round(2) }}" aria-valuemin="0"
|
||||
aria-valuemax="100" aria-label="Postęp zbiórki {{ progress_clamped|round(0) }} procent">
|
||||
<div class="progress-bar" style="width: {{ progress_clamped }}%;"></div>
|
||||
|
||||
</div>
|
||||
<small class="text-muted d-block mt-1 mb-2">Aktualnie: {{ progress|round(1) }}%</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-body pt-0">
|
||||
<div class="card-body {% if zbiorka.typ_zbiorki == 'rezerwa' %}pt-3{% else %}pt-0{% endif %}">
|
||||
<form method="post" novalidate>
|
||||
{# {{ form.csrf_token }} #}
|
||||
|
||||
@@ -72,22 +75,19 @@
|
||||
<!-- Szybkie korekty -->
|
||||
<div class="d-flex flex-wrap gap-2 mt-2">
|
||||
{% for delta in [10,50,100,200] %}
|
||||
<button type="button" class="btn btn-sm btn-outline-light btn-delta" data-delta="{{ delta }}">+{{
|
||||
delta }} PLN</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-light btn-delta" data-delta="-{{ delta }}">-{{
|
||||
delta }} PLN</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-light btn-delta" data-delta="{{ delta }}">+{{ delta }} PLN</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-light btn-delta" data-delta="-{{ delta }}">-{{ delta }} PLN</button>
|
||||
{% endfor %}
|
||||
{% if has_cel %}
|
||||
<button type="button" class="btn btn-sm btn-outline-light btn-set"
|
||||
data-value="{{ zbiorka.cel|round(2) }}">Ustaw: do celu</button>
|
||||
{% set brakujace = (zbiorka.cel - zbiorka.stan) if (zbiorka.cel - zbiorka.stan) > 0 else 0 %}
|
||||
|
||||
{% endif %}
|
||||
<button type="button" class="btn btn-sm btn-outline-light btn-set" data-value="0">Ustaw: 0</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Podgląd po zmianie -->
|
||||
<!-- Podgląd po zmianie - tylko dla standardowych zbiórek -->
|
||||
{% if zbiorka.typ_zbiorki != 'rezerwa' %}
|
||||
<div class="mb-3">
|
||||
<div class="card bg-dark border" style="border-color: var(--border);">
|
||||
<div class="card-body">
|
||||
@@ -106,6 +106,7 @@
|
||||
</div>
|
||||
<small class="text-muted d-block mt-1" id="previewNote">
|
||||
{% if has_cel %}
|
||||
{% set brakujace = (zbiorka.cel - zbiorka.stan) %}
|
||||
{% if brakujace > 0 %}
|
||||
Do celu brakuje: {{ brakujace|round(2) }} PLN
|
||||
{% elif brakujace == 0 %}
|
||||
@@ -121,6 +122,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- CTA -->
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
@@ -129,11 +131,11 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ url_for('static', filename='js/edytuj_stan.js') }}?v={{ APP_VERSION }}"></script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user