zbiorki_app/templates/admin/edit_zbiorka.html
Mateusz Gruszczyński 14bf893cb0 drone zmiany
2025-03-17 09:35:14 +01:00

61 lines
3.0 KiB
HTML

{% 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>
</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 %}