przebudowa systemu
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Dodaj wpłatę{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-warning text-dark">
|
||||
<h3 class="card-title mb-0">Dodaj wpłatę do zbiórki: {{ zbiorka.nazwa }}</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label for="kwota" class="form-label">Kwota wpłaty (PLN)</label>
|
||||
<input type="number" step="0.01" class="form-control" id="kwota" name="kwota" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="opis" class="form-label">Opis wpłaty (opcjonalnie)</label>
|
||||
<textarea class="form-control" id="opis" name="opis" rows="3"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success">Dodaj wpłatę</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@@ -1,51 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Dodaj zbiórkę{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-success text-white">
|
||||
<h3 class="card-title mb-0">Dodaj nową zbiórkę</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label for="nazwa" class="form-label">Nazwa zbiórki</label>
|
||||
<input type="text" class="form-control" id="nazwa" name="nazwa" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="opis" class="form-label">Opis</label>
|
||||
<textarea class="form-control" id="opis" name="opis" rows="6" required></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="numer_konta" class="form-label">Numer konta</label>
|
||||
<input type="text" class="form-control" id="numer_konta" name="numer_konta" value="{{ global_settings.numer_konta if global_settings else '' }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="numer_telefonu_blik" class="form-label">Numer telefonu BLIK</label>
|
||||
<input type="text" class="form-control" id="numer_telefonu_blik" name="numer_telefonu_blik" value="{{ global_settings.numer_telefonu_blik if global_settings else '' }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cel" class="form-label">Cel zbiórki (PLN)</label>
|
||||
<input type="number" step="0.01" class="form-control" id="cel" name="cel" required>
|
||||
</div>
|
||||
<div class="form-check mb-3">
|
||||
<input type="checkbox" class="form-check-input" id="ukryj_kwote" name="ukryj_kwote">
|
||||
<label class="form-check-label" for="ukryj_kwote">Ukryj kwoty (cel i stan)</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success">Dodaj zbiórkę</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Inicjalizacja edytora Markdown (SimpleMDE) -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
||||
<script>
|
||||
var simplemde = new SimpleMDE({
|
||||
element: document.getElementById("opis"),
|
||||
forceSync: true
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
@@ -1,110 +1,247 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Panel Admina{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
<h2 class="mb-4">Panel Admina</h2>
|
||||
|
||||
<div class="mb-3">
|
||||
<a href="{{ url_for('dodaj_zbiorka') }}" class="btn btn-success">Dodaj zbiórkę</a>
|
||||
<a href="{{ url_for('admin_settings') }}" class="btn btn-primary">Ustawienia</a>
|
||||
</div>
|
||||
|
||||
<!-- Tabela zbiórek aktywnych -->
|
||||
<h4>Aktywne zbiórki</h4>
|
||||
<div class="table-responsive mb-5">
|
||||
<table class="table table-dark table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nazwa</th>
|
||||
<th>Widoczność</th>
|
||||
<th>Opcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for z in active_zbiorki %}
|
||||
<tr>
|
||||
<td>{{ z.id }}</td>
|
||||
<td>{{ z.nazwa }}</td>
|
||||
<td>
|
||||
{% if z.ukryta %}
|
||||
<span class="badge bg-secondary">Ukryta</span>
|
||||
{% else %}
|
||||
<span class="badge bg-success">Widoczna</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('edytuj_zbiorka', zbiorka_id=z.id) }}" class="btn btn-primary btn-sm">Edytuj</a>
|
||||
<a href="{{ url_for('admin_dodaj_wplate', zbiorka_id=z.id) }}" class="btn btn-warning btn-sm">Dodaj wpłatę</a>
|
||||
<a href="{{ url_for('edytuj_stan', zbiorka_id=z.id) }}" class="btn btn-info btn-sm">Edytuj stan</a>
|
||||
<!-- Przycisk do oznaczenia jako zrealizowana -->
|
||||
<form action="{{ url_for('oznacz_zbiorka', zbiorka_id=z.id) }}" method="post" style="display: inline;">
|
||||
<button type="submit" class="btn btn-warning btn-sm">Oznacz jako zrealizowana</button>
|
||||
</form>
|
||||
<form action="{{ url_for('toggle_visibility', zbiorka_id=z.id) }}" method="post" style="display: inline;">
|
||||
<button type="submit" class="btn btn-secondary btn-sm">
|
||||
{% if z.ukryta %} Pokaż {% else %} Ukryj {% endif %}
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ url_for('usun_zbiorka', zbiorka_id=z.id) }}" method="post" style="display: inline;">
|
||||
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Czy na pewno chcesz usunąć tę zbiórkę?');">Usuń</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">Brak aktywnych zbiórek</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- Nagłówek + akcje globalne -->
|
||||
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-4">
|
||||
<h2 class="mb-0">Panel Admina</h2>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<a href="{{ url_for('dodaj_zbiorke') }}" class="btn btn-primary">
|
||||
➕ Dodaj zbiórkę
|
||||
</a>
|
||||
<a href="{{ url_for('admin_ustawienia') }}" class="btn btn-outline-light border">
|
||||
⚙️ Ustawienia
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabela zbiórek zrealizowanych -->
|
||||
<h4>Zrealizowane zbiórki</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-dark table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nazwa</th>
|
||||
<th>Widoczność</th>
|
||||
<th>Opcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for z in completed_zbiorki %}
|
||||
<tr>
|
||||
<td>{{ z.id }}</td>
|
||||
<td>{{ z.nazwa }}</td>
|
||||
<td>
|
||||
{% if z.ukryta %}
|
||||
<span class="badge bg-secondary">Ukryta</span>
|
||||
{% else %}
|
||||
<span class="badge bg-success">Widoczna</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('edytuj_zbiorka', zbiorka_id=z.id) }}" class="btn btn-primary btn-sm">Edytuj</a>
|
||||
<a href="{{ url_for('admin_dodaj_wplate', zbiorka_id=z.id) }}" class="btn btn-warning btn-sm">Dodaj wpłatę</a>
|
||||
<a href="{{ url_for('edytuj_stan', zbiorka_id=z.id) }}" class="btn btn-info btn-sm">Edytuj stan</a>
|
||||
<form action="{{ url_for('toggle_visibility', zbiorka_id=z.id) }}" method="post" style="display: inline;">
|
||||
<button type="submit" class="btn btn-secondary btn-sm">
|
||||
{% if z.ukryta %} Pokaż {% else %} Ukryj {% endif %}
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ url_for('usun_zbiorka', zbiorka_id=z.id) }}" method="post" style="display: inline;">
|
||||
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Czy na pewno chcesz usunąć tę zbiórkę?');">Usuń</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Pigułki: Aktywne / Zrealizowane (zakładki w obrębie panelu) -->
|
||||
<ul class="nav nav-pills mb-3" id="adminTabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="tab-aktywne" data-bs-toggle="tab" data-bs-target="#pane-aktywne"
|
||||
type="button" role="tab" aria-controls="pane-aktywne" aria-selected="true">
|
||||
Aktywne zbiórki
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="tab-zrealizowane" data-bs-toggle="tab" data-bs-target="#pane-zrealizowane"
|
||||
type="button" role="tab" aria-controls="pane-zrealizowane" aria-selected="false">
|
||||
Zrealizowane
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<!-- PANE: Aktywne -->
|
||||
<div class="tab-pane fade show active" id="pane-aktywne" role="tabpanel" aria-labelledby="tab-aktywne"
|
||||
tabindex="0">
|
||||
|
||||
{% if active_zbiorki and active_zbiorki|length > 0 %}
|
||||
<div class="table-responsive mb-5">
|
||||
<table class="table table-dark table-striped table-hover align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:72px;">ID</th>
|
||||
<th>Nazwa</th>
|
||||
<th style="width:140px;">Widoczność</th>
|
||||
<th style="width:1%;">Opcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for z in active_zbiorki %}
|
||||
<tr>
|
||||
<td class="text-muted">{{ z.id }}</td>
|
||||
<td>
|
||||
<div class="d-flex flex-column">
|
||||
<span class="fw-semibold">{{ z.nazwa }}</span>
|
||||
{# opcjonalnie: mini-meta z celem/stanem jeśli masz te pola #}
|
||||
{% if z.cel is defined or z.stan is defined %}
|
||||
<small class="text-muted">
|
||||
{% if z.cel is defined %} Cel: {{ z.cel|round(2) }} PLN {% endif %}
|
||||
{% if z.stan is defined %} · Stan: {{ z.stan|round(2) }} PLN {% endif %}
|
||||
</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{% if z.ukryta %}
|
||||
<span class="badge bg-secondary border"
|
||||
style="border-color: var(--border);">Ukryta</span>
|
||||
{% else %}
|
||||
<span class="badge rounded-pill"
|
||||
style="background: var(--accent); color:#111;">Widoczna</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<!-- Grupa akcji: główne + rozwijane -->
|
||||
<div class="btn-group">
|
||||
<a href="{{ url_for('edytuj_zbiorka', zbiorka_id=z.id) }}"
|
||||
class="btn btn-sm btn-outline-light">Edytuj</a>
|
||||
<button class="btn btn-sm btn-outline-light dropdown-toggle dropdown-toggle-split"
|
||||
data-bs-toggle="dropdown" aria-expanded="false" aria-label="Więcej opcji">
|
||||
<span class="visually-hidden">Więcej</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end shadow">
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="{{ url_for('dodaj_wplate', zbiorka_id=z.id) }}">Dodaj
|
||||
wpłatę</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="{{ url_for('edytuj_stan', zbiorka_id=z.id) }}">Edytuj stan</a>
|
||||
</li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li>
|
||||
<form action="{{ url_for('oznacz_zbiorka', zbiorka_id=z.id) }}"
|
||||
method="post" class="m-0">
|
||||
<button type="submit" class="dropdown-item">Oznacz jako
|
||||
zrealizowana</button>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<form action="{{ url_for('zmien_widzialnosc', zbiorka_id=z.id) }}"
|
||||
method="post" class="m-0">
|
||||
<button type="submit" class="dropdown-item">
|
||||
{% if z.ukryta %}Pokaż{% else %}Ukryj{% endif %}
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li>
|
||||
<form action="{{ url_for('usun_zbiorka', zbiorka_id=z.id) }}" method="post"
|
||||
class="m-0"
|
||||
onsubmit="return confirm('Czy na pewno chcesz usunąć tę zbiórkę?');">
|
||||
<button type="submit" class="dropdown-item text-danger">Usuń</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">Brak zbiórek zrealizowanych</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- Empty state -->
|
||||
<div class="card">
|
||||
<div class="card-body text-center py-5">
|
||||
<h5 class="mb-2">Brak aktywnych zbiórek</h5>
|
||||
<p class="text-muted mb-4">Wygląda na to, że teraz nic nie zbieramy.</p>
|
||||
<a href="{{ url_for('dodaj_zbiorka') }}" class="btn btn-primary">Utwórz nową zbiórkę</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- PANE: Zrealizowane -->
|
||||
<div class="tab-pane fade" id="pane-zrealizowane" role="tabpanel" aria-labelledby="tab-zrealizowane"
|
||||
tabindex="0">
|
||||
|
||||
{% if completed_zbiorki and completed_zbiorki|length > 0 %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-dark table-striped table-hover align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:72px;">ID</th>
|
||||
<th>Nazwa</th>
|
||||
<th style="width:180px;">Status</th>
|
||||
<th style="width:1%;">Opcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for z in completed_zbiorki %}
|
||||
<tr>
|
||||
<td class="text-muted">{{ z.id }}</td>
|
||||
<td>
|
||||
<div class="d-flex flex-column">
|
||||
<span class="fw-semibold">{{ z.nazwa }}</span>
|
||||
{% if z.cel is defined or z.stan is defined %}
|
||||
<small class="text-muted">
|
||||
{% if z.cel is defined %} Cel: {{ z.cel|round(2) }} PLN {% endif %}
|
||||
{% if z.stan is defined %} · Zebrano: {{ z.stan|round(2) }} PLN {% endif %}
|
||||
</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||
<span class="badge rounded-pill"
|
||||
style="background: var(--accent); color:#111;">Zrealizowana</span>
|
||||
{% if z.ukryta %}
|
||||
<span class="badge bg-secondary border"
|
||||
style="border-color: var(--border);">Ukryta</span>
|
||||
{% else %}
|
||||
<span class="badge bg-success">Widoczna</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<div class="btn-group">
|
||||
<a href="{{ url_for('edytuj_zbiorka', zbiorka_id=z.id) }}"
|
||||
class="btn btn-sm btn-outline-light">Edytuj</a>
|
||||
<button class="btn btn-sm btn-outline-light dropdown-toggle dropdown-toggle-split"
|
||||
data-bs-toggle="dropdown" aria-expanded="false" aria-label="Więcej opcji">
|
||||
<span class="visually-hidden">Więcej</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end shadow">
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="{{ url_for('dodaj_wplate', zbiorka_id=z.id) }}">Dodaj
|
||||
wpłatę</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="{{ url_for('edytuj_stan', zbiorka_id=z.id) }}">Edytuj stan</a>
|
||||
</li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li>
|
||||
<form action="{{ url_for('zmien_widzialnosc', zbiorka_id=z.id) }}"
|
||||
method="post" class="m-0">
|
||||
<button type="submit" class="dropdown-item">
|
||||
{% if z.ukryta %}Pokaż{% else %}Ukryj{% endif %}
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li>
|
||||
<form action="{{ url_for('usun_zbiorka', zbiorka_id=z.id) }}" method="post"
|
||||
class="m-0"
|
||||
onsubmit="return confirm('Czy na pewno chcesz usunąć tę zbiórkę?');">
|
||||
<button type="submit" class="dropdown-item text-danger">Usuń</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card">
|
||||
<div class="card-body text-center py-5">
|
||||
<h5 class="mb-2">Brak zbiórek zrealizowanych</h5>
|
||||
<p class="text-muted mb-3">Gdy jakaś zbiórka osiągnie 100%, pojawi się tutaj.</p>
|
||||
<a href="{{ url_for('dodaj_zbiorka') }}" class="btn btn-outline-light border">Utwórz nową
|
||||
zbiórkę</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
86
templates/admin/dodaj_wplate.html
Normal file
86
templates/admin/dodaj_wplate.html
Normal file
@@ -0,0 +1,86 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Dodaj wpłatę{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
|
||||
<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 border">← Powrót do
|
||||
zbiórki</a>
|
||||
</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">Dodaj wpłatę: <span class="fw-semibold">{{ zbiorka.nazwa }}</span></h3>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
{% if zbiorka.cel %}
|
||||
<span class="badge bg-dark border" style="border-color: var(--border);">Cel: {{ zbiorka.cel|round(2) }}
|
||||
PLN</span>
|
||||
{% endif %}
|
||||
<span class="badge bg-dark border" style="border-color: var(--border);">Stan: {{ zbiorka.stan|round(2) }}
|
||||
PLN</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set progress = (zbiorka.stan / zbiorka.cel * 100) if zbiorka.cel and zbiorka.cel > 0 else 0 %}
|
||||
|
||||
{% set progress_clamped = 100 if progress > 100 else (0 if progress < 0 else progress) %} <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">{{ progress|round(1) }}%</small>
|
||||
</div>
|
||||
|
||||
<div class="card-body pt-0">
|
||||
<form method="post" novalidate>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="kwota" class="form-label">Kwota wpłaty</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">PLN</span>
|
||||
<input type="number" step="0.01" min="0.01" inputmode="decimal" class="form-control" id="kwota" name="kwota"
|
||||
placeholder="0,00" required aria-describedby="kwotaHelp">
|
||||
</div>
|
||||
<div id="kwotaHelp" class="form-text">Podaj kwotę w złotówkach (min. 0,01).</div>
|
||||
|
||||
<div class="d-flex flex-wrap gap-2 mt-2">
|
||||
{% for preset in [10,25,50,100,200] %}
|
||||
<button type="button" class="btn btn-sm btn-outline-light border btn-kwota" data-amount="{{ preset }}">
|
||||
{{ preset }} PLN
|
||||
</button>
|
||||
{% endfor %}
|
||||
{% if zbiorka.cel and zbiorka.cel > 0 %}
|
||||
{% set brakujace = (zbiorka.cel - zbiorka.stan) if (zbiorka.cel - zbiorka.stan) > 0 else 0 %}
|
||||
<button type="button" class="btn btn-sm btn-outline-light border btn-kwota"
|
||||
data-amount="{{ brakujace|round(2) }}">
|
||||
Do celu: {{ brakujace|round(2) }} PLN
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="opis" class="form-label">Opis (opcjonalnie)</label>
|
||||
<textarea class="form-control" id="opis" name="opis" rows="3" maxlength="300"
|
||||
aria-describedby="opisHelp"></textarea>
|
||||
<div class="d-flex justify-content-between">
|
||||
<small id="opisHelp" class="form-text text-muted">Krótka notatka do wpłaty (widoczna w systemie).</small>
|
||||
<small class="text-muted"><span id="opisCount">0</span>/300</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<button type="submit" class="btn btn-success">Dodaj wpłatę</button>
|
||||
<a href="{{ url_for('zbiorka', zbiorka_id=zbiorka.id) }}" class="btn btn-outline-light border">Anuluj</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% block extra_scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ url_for('static', filename='js/dodaj_wplate.js') }}"></script>
|
||||
{% endblock %}
|
125
templates/admin/dodaj_zbiorke.html
Normal file
125
templates/admin/dodaj_zbiorke.html
Normal file
@@ -0,0 +1,125 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Dodaj zbiórkę{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
{{ super() }}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
|
||||
<!-- Powrót -->
|
||||
<div class="d-flex align-items-center gap-2 mb-3">
|
||||
<a href="{{ url_for('admin_dashboard') }}" class="btn btn-sm btn-outline-light border">← Panel Admina</a>
|
||||
</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">Dodaj nową zbiórkę</h3>
|
||||
<small class="opacity-75">Uzupełnij podstawowe dane i dane płatności</small>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="post" novalidate>
|
||||
{# {{ form.csrf_token }} jeśli używasz Flask-WTF #}
|
||||
|
||||
<!-- SEKCJA: Podstawowe -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-muted mb-2">Podstawowe</h6>
|
||||
<div class="row g-3">
|
||||
<div class="col-12">
|
||||
<label for="nazwa" class="form-label">Nazwa zbiórki</label>
|
||||
<input type="text" class="form-control" id="nazwa" name="nazwa" maxlength="120"
|
||||
placeholder="Np. Wsparcie dla schroniska 'Azor'" required aria-describedby="nazwaHelp">
|
||||
<div id="nazwaHelp" class="form-text">Krótki, zrozumiały tytuł. Max 120 znaków.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<label for="opis" class="form-label">Opis (Markdown)</label>
|
||||
<textarea class="form-control" id="opis" name="opis" rows="8" required
|
||||
aria-describedby="opisHelp"></textarea>
|
||||
<div class="d-flex justify-content-between">
|
||||
<small id="opisHelp" class="form-text text-muted">
|
||||
Możesz używać **Markdown** (nagłówki, listy, linki). W edytorze włącz podgląd 👁️.
|
||||
</small>
|
||||
<small class="text-muted"><span id="opisCount">0</span> znaków</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="my-4" />
|
||||
|
||||
<!-- SEKCJA: Płatności -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-muted mb-2">Dane płatności</h6>
|
||||
<div class="row g-3">
|
||||
<div class="col-12">
|
||||
<label for="numer_konta" class="form-label">Numer konta (IBAN)</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">PL</span>
|
||||
<input type="text" class="form-control" id="numer_konta" name="numer_konta"
|
||||
value="{{ global_settings.numer_konta if global_settings else '' }}" inputmode="numeric"
|
||||
autocomplete="off" placeholder="12 3456 7890 1234 5678 9012 3456" required
|
||||
aria-describedby="ibanHelp">
|
||||
</div>
|
||||
<div id="ibanHelp" class="form-text">Wpisz ciąg cyfr; spacje dodadzą się automatycznie dla czytelności.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6">
|
||||
<label for="numer_telefonu_blik" class="form-label">Numer telefonu BLIK</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">+48</span>
|
||||
<input type="tel" class="form-control" id="numer_telefonu_blik" name="numer_telefonu_blik"
|
||||
value="{{ global_settings.numer_telefonu_blik if global_settings else '' }}" inputmode="tel"
|
||||
pattern="[0-9 ]{9,13}" placeholder="123 456 789" required aria-describedby="blikHelp">
|
||||
</div>
|
||||
<div id="blikHelp" class="form-text">Dziewięć cyfr telefonu powiązanego z BLIK. Spacje opcjonalne.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="my-4" />
|
||||
|
||||
<!-- SEKCJA: Cel i widoczność -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-muted mb-2">Cel i widoczność</h6>
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-md-6">
|
||||
<label for="cel" class="form-label">Cel zbiórki</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">PLN</span>
|
||||
<input type="number" class="form-control" id="cel" name="cel" step="0.01" min="0.01" placeholder="0,00"
|
||||
required aria-describedby="celHelp">
|
||||
</div>
|
||||
<div id="celHelp" class="form-text">Minimalnie 0,01 PLN. Możesz to później edytować.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6 d-flex align-items-end">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="ukryj_kwote" name="ukryj_kwote">
|
||||
<label class="form-check-label" for="ukryj_kwote">Ukryj kwoty (cel i stan)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CTA -->
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<button type="submit" class="btn btn-success">Dodaj zbiórkę</button>
|
||||
<a href="{{ url_for('admin_dashboard') }}" class="btn btn-outline-light border">Anuluj</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
{{ super() }}
|
||||
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
||||
<script src="{{ url_for('static', filename='js/mde_custom.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/dodaj_zbiorke.js') }}"></script>
|
||||
{% endblock %}
|
@@ -1,67 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Edytuj zbiórkę{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-success text-white">
|
||||
<h3 class="card-title mb-0">Edytuj zbiórkę</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label for="nazwa" class="form-label">Nazwa zbiórki</label>
|
||||
<input type="text" class="form-control" id="nazwa" name="nazwa" value="{{ zbiorka.nazwa }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="opis" class="form-label">Opis</label>
|
||||
<textarea class="form-control" id="opis" name="opis" rows="6" required>{{ zbiorka.opis }}</textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="numer_konta" class="form-label">Numer konta</label>
|
||||
<input type="text" class="form-control" id="numer_konta" name="numer_konta"
|
||||
value="{{ zbiorka.numer_konta if zbiorka.numer_konta else (global_settings.numer_konta if global_settings else '') }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="numer_telefonu_blik" class="form-label">Numer telefonu BLIK</label>
|
||||
<input type="text" class="form-control" id="numer_telefonu_blik" name="numer_telefonu_blik"
|
||||
value="{{ zbiorka.numer_telefonu_blik if zbiorka.numer_telefonu_blik else (global_settings.numer_telefonu_blik if global_settings else '') }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cel" class="form-label">Cel zbiórki (PLN)</label>
|
||||
<input type="number" step="0.01" class="form-control" id="cel" name="cel" value="{{ zbiorka.cel }}" required>
|
||||
</div>
|
||||
<div class="form-check mb-3">
|
||||
<input type="checkbox" class="form-check-input" id="ukryj_kwote" name="ukryj_kwote" {% if zbiorka.ukryj_kwote %}checked{% endif %}>
|
||||
<label class="form-check-label" for="ukryj_kwote">Ukryj kwoty (cel i stan)</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Zaktualizuj zbiórkę</button>
|
||||
<button type="button" class="btn btn-primary" id="ustaw-globalne">Ustaw globalne</button>
|
||||
|
||||
|
||||
<form action="{{ url_for('oznacz_zbiorka', zbiorka_id=zbiorka.id) }}" method="post" style="display:inline;">
|
||||
<button type="submit" class="btn btn-warning">Oznacz jako zrealizowana</button>
|
||||
</form>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Inicjalizacja edytora Markdown (SimpleMDE) -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
||||
<script>
|
||||
var simplemde = new SimpleMDE({
|
||||
element: document.getElementById("opis"),
|
||||
forceSync: true
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('ustaw-globalne').addEventListener('click', function() {
|
||||
{% if global_settings %}
|
||||
document.getElementById('numer_konta').value = "{{ global_settings.numer_konta }}";
|
||||
document.getElementById('numer_telefonu_blik').value = "{{ global_settings.numer_telefonu_blik }}";
|
||||
{% endif %}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@@ -1,24 +1,128 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Edytuj stan zbiórki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-info text-white">
|
||||
<h3 class="card-title mb-0">Edytuj stan zbiórki: {{ zbiorka.nazwa }}</h3>
|
||||
|
||||
<!-- 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 border">← Szczegóły
|
||||
zbiórki</a>
|
||||
<a href="{{ url_for('admin_dashboard') }}" class="btn btn-sm btn-outline-light border">← 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 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 }}">
|
||||
<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">
|
||||
{% if has_cel %}
|
||||
<span class="badge bg-dark border" style="border-color: var(--border);">Cel: {{ zbiorka.cel|round(2) }}
|
||||
PLN</span>
|
||||
{% endif %}
|
||||
<span class="badge bg-dark border" style="border-color: var(--border);">Obecnie: {{ zbiorka.stan|round(2) }}
|
||||
PLN</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label for="stan" class="form-label">Nowy stan zbiórki (PLN)</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">PLN</span>
|
||||
<input type="number" step="0.01" class="form-control" id="stan" name="stan" value="{{ zbiorka.stan|round(2) }}" required>
|
||||
|
||||
<!-- Mini progress (aktualny) -->
|
||||
<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>
|
||||
|
||||
<div class="card-body pt-0">
|
||||
<form method="post" novalidate>
|
||||
{# {{ form.csrf_token }} #}
|
||||
|
||||
<!-- Nowy stan -->
|
||||
<div class="mb-3">
|
||||
<label for="stan" class="form-label">Nowy stan zbiórki</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">PLN</span>
|
||||
<input type="number" step="0.01" min="0" class="form-control" id="stan" name="stan"
|
||||
value="{{ zbiorka.stan|round(2) }}" required aria-describedby="stanHelp">
|
||||
</div>
|
||||
<div id="stanHelp" class="form-text">
|
||||
Wpisz łączną zebraną kwotę po zmianie (nie przyrost). Skorzystaj z szybkich korekt poniżej.
|
||||
</div>
|
||||
|
||||
<!-- 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 border btn-delta" data-delta="{{ delta }}">+{{
|
||||
delta }} PLN</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-light border btn-delta" data-delta="-{{ delta }}">-{{
|
||||
delta }} PLN</button>
|
||||
{% endfor %}
|
||||
{% if has_cel %}
|
||||
<button type="button" class="btn btn-sm btn-outline-light border 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 %}
|
||||
{% if brakujace > 0 %}
|
||||
<span class="badge bg-dark border" style="border-color: var(--border);">Brakuje: {{ brakujace|round(2) }}
|
||||
PLN</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<button type="button" class="btn btn-sm btn-outline-light border btn-set" data-value="0">Ustaw: 0</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Podgląd po zmianie -->
|
||||
<div class="mb-3">
|
||||
<div class="card bg-dark border" style="border-color: var(--border);">
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-wrap justify-content-between align-items-center gap-2">
|
||||
<div>
|
||||
<div class="small text-muted">Podgląd po zapisaniu</div>
|
||||
<div class="fw-semibold">
|
||||
Procent realizacji:
|
||||
<span id="previewPct">{{ progress|round(1) }}</span>%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<div class="progress" aria-hidden="true">
|
||||
<div class="progress-bar" style="width: {{ progress_clamped }}%;"></div>
|
||||
|
||||
</div>
|
||||
<small class="text-muted d-block mt-1" id="previewNote">
|
||||
{% if has_cel %}
|
||||
{% if brakujace > 0 %}
|
||||
Do celu brakuje: {{ brakujace|round(2) }} PLN
|
||||
{% elif brakujace == 0 %}
|
||||
Cel osiągnięty.
|
||||
{% else %}
|
||||
Przekroczono cel o: {{ (brakujace * -1)|round(2) }} PLN
|
||||
{% endif %}
|
||||
{% else %}
|
||||
Brak zdefiniowanego celu — procent nie jest wyliczany.
|
||||
{% endif %}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-info">Aktualizuj stan</button>
|
||||
<a href="{{ url_for('admin_dashboard') }}" class="btn btn-secondary">Powrót</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CTA -->
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<button type="submit" class="btn btn-success">Aktualizuj stan</button>
|
||||
<a href="{{ url_for('zbiorka', zbiorka_id=zbiorka.id) }}" class="btn btn-outline-light border">Anuluj</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ url_for('static', filename='js/edytuj_stan.js') }}"></script>
|
||||
{% endblock %}
|
154
templates/admin/edytuj_zbiorke.html
Normal file
154
templates/admin/edytuj_zbiorke.html
Normal file
@@ -0,0 +1,154 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Edytuj zbiórkę{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
{{ super() }}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
|
||||
<!-- 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 border">← Szczegóły
|
||||
zbiórki</a>
|
||||
<a href="{{ url_for('admin_dashboard') }}" class="btn btn-sm btn-outline-light border">← Panel Admina</a>
|
||||
</div>
|
||||
|
||||
<!-- Nagłówek + meta -->
|
||||
<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 zbiórkę</h3>
|
||||
<div class="d-flex flex-wrap align-items-center gap-2">
|
||||
{% if zbiorka.cel %}
|
||||
<span class="badge bg-dark border" style="border-color: var(--border);">Cel: {{ zbiorka.cel|round(2) }}
|
||||
PLN</span>
|
||||
{% endif %}
|
||||
{% if zbiorka.ukryj_kwote %}
|
||||
<span class="badge bg-secondary">Kwoty ukryte</span>
|
||||
{% else %}
|
||||
<span class="badge bg-success">Kwoty widoczne</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<!-- GŁÓWNY FORMULARZ -->
|
||||
<form method="post" novalidate id="form-edit-zbiorka">
|
||||
{# {{ form.csrf_token }} jeśli używasz Flask-WTF #}
|
||||
|
||||
<!-- SEKCJA: Podstawowe -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-muted mb-2">Podstawowe</h6>
|
||||
<div class="row g-3">
|
||||
<div class="col-12">
|
||||
<label for="nazwa" class="form-label">Nazwa zbiórki</label>
|
||||
<input type="text" class="form-control" id="nazwa" name="nazwa" value="{{ zbiorka.nazwa }}"
|
||||
maxlength="120" placeholder="Krótki, zrozumiały tytuł" required aria-describedby="nazwaHelp">
|
||||
<div id="nazwaHelp" class="form-text">Max 120 znaków. Użyj konkretów.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<label for="opis" class="form-label">Opis (Markdown)</label>
|
||||
<textarea class="form-control" id="opis" name="opis" rows="8" required
|
||||
aria-describedby="opisHelp">{{ zbiorka.opis }}</textarea>
|
||||
<div class="d-flex justify-content-between">
|
||||
<small id="opisHelp" class="form-text text-muted">Wspieramy **Markdown** — użyj nagłówków, list, linków.
|
||||
Włącz podgląd w edytorze 👁️.</small>
|
||||
<small class="text-muted"><span id="opisCount">0</span> znaków</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="my-4" />
|
||||
|
||||
<!-- SEKCJA: Dane płatności -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-muted mb-2">Dane płatności</h6>
|
||||
<div class="row g-3">
|
||||
<div class="col-12">
|
||||
<label for="numer_konta" class="form-label">Numer konta (IBAN)</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">PL</span>
|
||||
<input type="text" class="form-control" id="numer_konta" name="numer_konta"
|
||||
value="{{ zbiorka.numer_konta if zbiorka.numer_konta else (global_settings.numer_konta if global_settings else '') }}"
|
||||
inputmode="numeric" autocomplete="off" placeholder="12 3456 7890 1234 5678 9012 3456" required
|
||||
aria-describedby="ibanHelp">
|
||||
</div>
|
||||
<div id="ibanHelp" class="form-text">Wpisz same cyfry — spacje dodadzą się automatycznie co 4 znaki.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6">
|
||||
<label for="numer_telefonu_blik" class="form-label">Numer telefonu BLIK</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">+48</span>
|
||||
<input type="tel" class="form-control" id="numer_telefonu_blik" name="numer_telefonu_blik"
|
||||
value="{{ zbiorka.numer_telefonu_blik if zbiorka.numer_telefonu_blik else (global_settings.numer_telefonu_blik if global_settings else '') }}"
|
||||
inputmode="tel" pattern="[0-9 ]{9,13}" placeholder="123 456 789" required aria-describedby="blikHelp">
|
||||
</div>
|
||||
<div id="blikHelp" class="form-text">9 cyfr. Spacje dodadzą się automatycznie (format 3-3-3).</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6 d-flex align-items-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-light border" id="ustaw-globalne"
|
||||
title="Wstaw wartości z ustawień globalnych" {% if global_settings %}
|
||||
data-iban="{{ global_settings.numer_konta }}" data-blik="{{ global_settings.numer_telefonu_blik }}" {%
|
||||
endif %}>Ustaw globalne</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="my-4" />
|
||||
|
||||
<!-- SEKCJA: Cel i widoczność -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-muted mb-2">Cel i widoczność</h6>
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-md-6">
|
||||
<label for="cel" class="form-label">Cel zbiórki</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">PLN</span>
|
||||
<input type="number" class="form-control" id="cel" name="cel" step="0.01" min="0.01"
|
||||
value="{{ zbiorka.cel }}" placeholder="0,00" required aria-describedby="celHelp">
|
||||
</div>
|
||||
<div id="celHelp" class="form-text">Minimalnie 0,01 PLN. W razie potrzeby zmienisz to później.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6 d-flex align-items-end">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="ukryj_kwote" name="ukryj_kwote" {% if
|
||||
zbiorka.ukryj_kwote %}checked{% endif %}>
|
||||
<label class="form-check-label" for="ukryj_kwote">Ukryj kwoty (cel i stan)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CTA: zapisz/anuluj + osobna akcja „zrealizowana” -->
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<button type="submit" class="btn btn-success">Zaktualizuj zbiórkę</button>
|
||||
<a href="{{ url_for('zbiorka', zbiorka_id=zbiorka.id) }}" class="btn btn-outline-light border">Anuluj</a>
|
||||
|
||||
<!-- Osobny formularz dla oznaczenia „zrealizowana” -->
|
||||
<form action="{{ url_for('oznacz_zbiorka', zbiorka_id=zbiorka.id) }}" method="post" class="ms-auto">
|
||||
<button type="submit" class="btn btn-outline-light"
|
||||
onclick="return confirm('Oznaczyć zbiórkę jako zrealizowaną?');">
|
||||
Oznacz jako zrealizowana
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
{{ super() }}
|
||||
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
||||
<script src="{{ url_for('static', filename='js/mde_custom.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/edytuj_zbiorke.js') }}"></script>
|
||||
{% endblock %}
|
@@ -1,55 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Ustawienia globalne{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
<form method="post">
|
||||
<!-- Blok ustawień konta -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h3 class="card-title mb-0">Ustawienia konta</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label for="numer_konta" class="form-label">Globalny numer konta</label>
|
||||
<input type="text" class="form-control" id="numer_konta" name="numer_konta" value="{{ settings.numer_konta if settings else '' }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="numer_telefonu_blik" class="form-label">Globalny numer telefonu BLIK</label>
|
||||
<input type="text" class="form-control" id="numer_telefonu_blik" name="numer_telefonu_blik" value="{{ settings.numer_telefonu_blik if settings else '' }}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Blok dozwolonych adresów IP -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-secondary text-white d-flex justify-content-between align-items-center">
|
||||
<h3 class="card-title mb-0">Dozwolone adresy IP</h3>
|
||||
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label for="allowed_login_hosts" class="form-label">Dozwolone hosty logowania</label>
|
||||
<textarea class="form-control" id="allowed_login_hosts" name="allowed_login_hosts" rows="4" placeholder="Podaj adresy IP lub nazwy domen oddzielone przecinkami lub nowymi liniami">{{ settings.allowed_login_hosts if settings and settings.allowed_login_hosts else '' }}</textarea>
|
||||
</div>
|
||||
<p class="text-muted">Twój aktualny adres IP: <strong>{{ client_ip }}</strong></p>
|
||||
<button type="button" class="btn btn-sm btn-light text-dark" onclick="dodajMojeIP()">Dodaj moje IP</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<button type="submit" class="btn btn-primary">Zapisz ustawienia</button>
|
||||
<a href="{{ url_for('admin_dashboard') }}" class="btn btn-secondary">Powrót</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
function dodajMojeIP() {
|
||||
const mojeIP = "{{ client_ip }}";
|
||||
const textarea = document.getElementById("allowed_login_hosts");
|
||||
if (!textarea.value.includes(mojeIP)) {
|
||||
const separator = textarea.value.trim() === "" ? "" : "\n";
|
||||
textarea.value += separator + mojeIP;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
125
templates/admin/ustawienia.html
Normal file
125
templates/admin/ustawienia.html
Normal file
@@ -0,0 +1,125 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Ustawienia globalne{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-4">
|
||||
<form method="post" novalidate id="form-global-settings">
|
||||
{# {{ form.csrf_token }} jeśli używasz Flask-WTF #}
|
||||
|
||||
<!-- SEKCJA: Dane płatności -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-secondary text-white d-flex align-items-center justify-content-between gap-2">
|
||||
<h3 class="card-title mb-0">Dane płatności</h3>
|
||||
<small class="opacity-75">Używane jako wartości domyślne przy dodawaniu/edycji zbiórek</small>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-12">
|
||||
<label for="numer_konta" class="form-label">Globalny numer konta (IBAN)</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">PL</span>
|
||||
<input type="text" class="form-control" id="numer_konta" name="numer_konta"
|
||||
value="{{ settings.numer_konta if settings else '' }}" inputmode="numeric" autocomplete="off"
|
||||
placeholder="12 3456 7890 1234 5678 9012 3456" required aria-describedby="ibanHelp">
|
||||
</div>
|
||||
<div id="ibanHelp" class="form-text">Wpisz ciąg cyfr — spacje dodadzą się automatycznie co 4 znaki.</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-6">
|
||||
<label for="numer_telefonu_blik" class="form-label">Globalny numer telefonu BLIK</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">+48</span>
|
||||
<input type="tel" class="form-control" id="numer_telefonu_blik" name="numer_telefonu_blik"
|
||||
value="{{ settings.numer_telefonu_blik if settings else '' }}" inputmode="tel" pattern="[0-9 ]{9,13}"
|
||||
placeholder="123 456 789" required aria-describedby="blikHelp">
|
||||
</div>
|
||||
<div id="blikHelp" class="form-text">9 cyfr. Spacje i format 3-3-3 dodajemy dla czytelności.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SEKCJA: Dostępy / biała lista IP -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-secondary text-white d-flex align-items-center justify-content-between gap-2">
|
||||
<h3 class="card-title mb-0">Dostęp — dozwolone adresy IP / hosty</h3>
|
||||
<small class="opacity-75">Zależnie od konfiguracji, logowanie może wymagać dopasowania do białej listy</small>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row g-3 align-items-end">
|
||||
<div class="col-12 col-md-6">
|
||||
<label for="host_input" class="form-label">Dodaj pojedynczy IP/host</label>
|
||||
<input type="text" class="form-control" id="host_input" placeholder="np. 203.0.113.42 lub corp.example.com"
|
||||
aria-describedby="hostAddHelp">
|
||||
<div id="hostAddHelp" class="form-text">Po wpisaniu kliknij „Dodaj do listy”. Duplikaty są pomijane.</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 d-flex gap-2">
|
||||
<button type="button" class="btn btn-outline-light border" id="btn-add-host">Dodaj do listy</button>
|
||||
<button type="button" class="btn btn-light text-dark" id="btn-add-my-ip" data-my-ip="{{ client_ip }}">Dodaj
|
||||
moje IP ({{ client_ip }})</button>
|
||||
<button type="button" class="btn btn-outline-light border" id="btn-dedupe">Usuń duplikaty</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
<label for="allowed_login_hosts" class="form-label">Dozwolone hosty logowania (jeden na linię lub rozdzielone
|
||||
przecinkami)</label>
|
||||
<textarea class="form-control" id="allowed_login_hosts" name="allowed_login_hosts" rows="6"
|
||||
placeholder="Adresy IP lub nazwy domen — każdy w osobnej linii lub rozdzielony przecinkiem">{{ settings.allowed_login_hosts if settings and settings.allowed_login_hosts else '' }}</textarea>
|
||||
<div class="d-flex justify-content-between mt-1">
|
||||
<small class="text-muted">Akceptowane separatory: przecinek (`,`), średnik (`;`) i nowa linia.</small>
|
||||
<small class="text-muted">Pozycji na liście: <span id="hostsCount">0</span></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<h6 class="text-muted mb-2">Branding</h6>
|
||||
<div class="row g-3 align-items-end">
|
||||
<!-- Logo -->
|
||||
<div class="col-md-6">
|
||||
<label for="logo_url" class="form-label">Logo (adres URL PNG/SVG)</label>
|
||||
<input type="text" class="form-control" id="logo_url" name="logo_url"
|
||||
value="{{ settings.logo_url if settings else '' }}" placeholder="https://example.com/logo.png">
|
||||
<div class="form-text">Najlepiej transparentne, do 60px wysokości.</div>
|
||||
</div>
|
||||
|
||||
<!-- Tekst -->
|
||||
<div class="col-md-6">
|
||||
<label for="site_title" class="form-label">Tytuł w navbarze</label>
|
||||
<input type="text" class="form-control" id="site_title" name="site_title"
|
||||
value="{{ settings.site_title if settings else '' }}" placeholder="Np. Zbiórki unitraklub.pl">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Checkbox: logo w navbarze -->
|
||||
<div class="form-check mt-3">
|
||||
<input class="form-check-input" type="checkbox" id="show_logo_in_navbar" name="show_logo_in_navbar" {% if
|
||||
settings and settings.show_logo_in_navbar %}checked{% endif %}>
|
||||
<label class="form-check-label" for="show_logo_in_navbar">Wyświetlaj logo w navbarze</label>
|
||||
</div>
|
||||
|
||||
{% if settings and settings.logo_url %}
|
||||
<div class="mt-3">
|
||||
<span class="form-text d-block mb-1">Podgląd logo:</span>
|
||||
<img src="{{ settings.logo_url }}" alt="Logo preview" style="max-height:50px;">
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- CTA -->
|
||||
<div class="d-flex justify-content-between">
|
||||
<a href="{{ url_for('admin_dashboard') }}" class="btn btn-outline-light border">Powrót</a>
|
||||
<button type="submit" class="btn btn-primary">Zapisz ustawienia</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ url_for('static', filename='js/ustawienia.js') }}"></script>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user