171 lines
8.7 KiB
HTML
171 lines
8.7 KiB
HTML
{# templates/admin/formularz_rezerwy.html #}
|
|
{% extends 'base.html' %}
|
|
|
|
{% set has_obj = zbiorka is not none %}
|
|
{% set is_edit = has_obj and zbiorka.id is not none %}
|
|
|
|
{% block title %}{{ 'Edytuj listę rezerwową' if is_edit else 'Dodaj listę rezerwową' }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container my-4">
|
|
|
|
<!-- Nawigacja / powrót -->
|
|
<div class="d-flex align-items-center gap-2 mb-3">
|
|
{% if is_edit and zbiorka and zbiorka.id %}
|
|
<a href="{{ url_for('zbiorka', zbiorka_id=zbiorka.id) }}" class="btn btn-sm btn-outline-light">← Szczegóły
|
|
listy</a>
|
|
{% else %}
|
|
<a href="{{ url_for('lista_rezerwowych') }}" class="btn btn-sm btn-outline-light">← Listy rezerwowe</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="card shadow-sm">
|
|
<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 listę rezerwową' if is_edit else 'Dodaj nową listę rezerwową' }}
|
|
</h3>
|
|
|
|
{% if is_edit %}
|
|
<div class="d-flex flex-wrap align-items-center gap-2">
|
|
<span class="badge bg-dark border" style="border-color: var(--border);">
|
|
Stan: {{ (zbiorka.stan or 0)|round(2) }} PLN
|
|
</span>
|
|
<span class="badge bg-info">Lista rezerwowa</span>
|
|
</div>
|
|
{% else %}
|
|
<small class="opacity-75">Utwórz dedykowaną listę do zarządzania środkami</small>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
<form method="post" novalidate id="{{ 'form-edit-rezerwa' if is_edit else 'form-add-rezerwa' }}">
|
|
|
|
<!-- ======================================== -->
|
|
<!-- PODSTAWOWE DANE -->
|
|
<!-- ======================================== -->
|
|
<h5 class="mb-3">Podstawowe dane</h5>
|
|
|
|
<div class="row g-3 mb-4">
|
|
<div class="col-md-6">
|
|
<label for="nazwa" class="form-label">Nazwa listy <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="nazwa" name="nazwa" required
|
|
value="{{ zbiorka.nazwa if is_edit else '' }}"
|
|
placeholder="np. Nadpłaty, Środki rezerwowe">
|
|
<small class="form-text text-muted">Unikalny identyfikator tej listy rezerwowej</small>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="opis" class="form-label">Opis (opcjonalny)</label>
|
|
<textarea class="form-control" id="opis" name="opis" rows="3"
|
|
placeholder="Krótki opis przeznaczenia tej listy">{{ zbiorka.opis if is_edit else '' }}</textarea>
|
|
<small class="form-text text-muted">Krótki opis, który pomoże w identyfikacji</small>
|
|
</div>
|
|
</div>
|
|
|
|
<hr class="my-4">
|
|
|
|
<!-- ======================================== -->
|
|
<!-- KANAŁY PŁATNOŚCI -->
|
|
<!-- ======================================== -->
|
|
<h5 class="mb-3">Kanały płatności</h5>
|
|
<p class="text-muted small mb-3">
|
|
Określ, czy ta lista ma akceptować bezpośrednie wpłaty od użytkowników.
|
|
</p>
|
|
|
|
<div class="row g-3 mb-4">
|
|
<!-- Przelew -->
|
|
<div class="col-md-6">
|
|
<div class="border rounded p-3 h-100">
|
|
<div class="form-check mb-2">
|
|
<input class="form-check-input" type="checkbox" id="uzyj_konta" name="uzyj_konta"
|
|
{% if is_edit and zbiorka.uzyj_konta %}checked{% endif %}>
|
|
<label class="form-check-label fw-bold" for="uzyj_konta">
|
|
Włącz wpłaty przelewem
|
|
</label>
|
|
</div>
|
|
|
|
<div id="konto-field" style="display: {% if is_edit and zbiorka.uzyj_konta %}block{% else %}none{% endif %};">
|
|
<label for="numer_konta" class="form-label small">Numer konta</label>
|
|
<input type="text" class="form-control form-control-sm" id="numer_konta"
|
|
name="numer_konta"
|
|
value="{{ zbiorka.numer_konta if is_edit else (global_settings.numer_konta if global_settings else '') }}"
|
|
placeholder="26 cyfr numeru konta">
|
|
<small class="form-text text-muted">
|
|
{% if global_settings and global_settings.numer_konta %}
|
|
Domyślnie: {{ global_settings.numer_konta }}
|
|
{% else %}
|
|
Zostaw puste dla globalnego numeru
|
|
{% endif %}
|
|
</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- BLIK -->
|
|
<div class="col-md-6">
|
|
<div class="border rounded p-3 h-100">
|
|
<div class="form-check mb-2">
|
|
<input class="form-check-input" type="checkbox" id="uzyj_blik" name="uzyj_blik"
|
|
{% if is_edit and zbiorka.uzyj_blik %}checked{% endif %}>
|
|
<label class="form-check-label fw-bold" for="uzyj_blik">
|
|
Włącz wpłaty przez BLIK
|
|
</label>
|
|
</div>
|
|
|
|
<div id="blik-field" style="display: {% if is_edit and zbiorka.uzyj_blik %}block{% else %}none{% endif %};">
|
|
<label for="numer_telefonu_blik" class="form-label small">Numer telefonu BLIK</label>
|
|
<input type="text" class="form-control form-control-sm" id="numer_telefonu_blik"
|
|
name="numer_telefonu_blik"
|
|
value="{{ zbiorka.numer_telefonu_blik if is_edit else (global_settings.numer_telefonu_blik if global_settings else '') }}"
|
|
placeholder="9 cyfr numeru telefonu">
|
|
<small class="form-text text-muted">
|
|
{% if global_settings and global_settings.numer_telefonu_blik %}
|
|
Domyślnie: {{ global_settings.numer_telefonu_blik }}
|
|
{% else %}
|
|
Zostaw puste dla globalnego numeru
|
|
{% endif %}
|
|
</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if not is_edit %}
|
|
<!-- Alert informacyjny tylko przy tworzeniu -->
|
|
<div class="alert alert-info mb-4">
|
|
<strong>Wskazówka:</strong> Lista rezerwowa to pomocnicze miejsce do gromadzenia środków,
|
|
które mogą być później przesuwane do konkretnych zbiórek. Jest ukryta dla użytkowników
|
|
nieadministracyjnych i nie pojawia się na stronie głównej.
|
|
</div>
|
|
{% endif %}
|
|
|
|
<hr class="my-4">
|
|
|
|
<!-- Przyciski akcji -->
|
|
<div class="d-flex flex-wrap gap-2 justify-content-between align-items-center">
|
|
<div class="d-flex gap-2">
|
|
<button type="submit" class="btn btn-primary">
|
|
{{ 'Zapisz zmiany' if is_edit else 'Utwórz listę rezerwową' }}
|
|
</button>
|
|
<a href="{{ url_for('lista_rezerwowych') }}" class="btn btn-outline-light">Anuluj</a>
|
|
</div>
|
|
|
|
{% if is_edit %}
|
|
<div>
|
|
<a href="{{ url_for('transakcje_zbiorki', zbiorka_id=zbiorka.id) }}"
|
|
class="btn btn-outline-light btn-sm">Zobacz transakcje</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
{% block extra_scripts %}
|
|
{{ super() }}
|
|
<script src="{{ url_for('static', filename='js/formularz_rezerwy.js') }}?v={{ APP_VERSION }}"></script>
|
|
{% endblock %}
|