zmiany w edycji listy przez usera

This commit is contained in:
Mateusz Gruszczyński
2025-08-15 12:51:23 +02:00
parent e2468c299d
commit e7c0dae7a1
2 changed files with 100 additions and 63 deletions

View File

@@ -20,31 +20,52 @@
value="{{ list.title }}" required>
</div>
<!-- Statusy listy -->
<!-- Wydatek i właściciel -->
<div class="row mb-3">
<div class="col-md-6">
<label for="amount" class="form-label">💰 Całkowity wydatek (PLN)</label>
<input type="number" step="0.01" min="0" class="form-control bg-dark text-white border-secondary rounded"
id="amount" name="amount" value="{{ '%.2f'|format(total_expense) }}">
</div>
<div class="col-md-6">
<label for="owner_id" class="form-label">👤 Właściciel</label>
<select class="form-select bg-dark text-white border-secondary" id="owner_id" name="owner_id">
{% for user in users %}
<option value="{{ user.id }}" {% if list.owner_id==user.id %}selected{% endif %}>
{{ user.username }}
</option>
{% endfor %}
</select>
</div>
</div>
<!-- Statusy -->
<div class="mb-4">
<label class="form-label">⚙️ Statusy listy</label>
<div class="d-flex flex-wrap gap-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="public" name="is_public"
{% if list.is_public %}checked{% endif %}>
<input class="form-check-input" type="checkbox" id="archived" name="archived" {% if list.is_archived
%}checked{% endif %}>
<label class="form-check-label" for="archived">📦 Archiwalna</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="public" name="public" {% if list.is_public %}checked{%
endif %}>
<label class="form-check-label" for="public">🌐 Publiczna</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="temporary" name="is_temporary"
{% if list.is_temporary %}checked{% endif %}>
<label class="form-check-label" for="temporary">⏳ Tymczasowa</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="archived" name="is_archived"
{% if list.is_archived %}checked{% endif %}>
<label class="form-check-label" for="archived">📦 Archiwalna</label>
<input class="form-check-input" type="checkbox" id="temporary" name="temporary" {% if list.is_temporary
%}checked{% endif %}>
<label class="form-check-label" for="temporary">⏳ Tymczasowa (podaj date i godzine wygasania)</label>
</div>
</div>
</div>
<!-- Data/Godzina wygaśnięcia -->
<!-- Data/godzina wygaśnięcia -->
<div class="row mb-4">
<div class="col-md-6">
<label for="expires_date" class="form-label">📅 Data wygaśnięcia</label>
@@ -58,17 +79,17 @@
</div>
</div>
<!-- Data utworzenia / Przenieś miesiąc -->
<!-- Utworzono / Zmień miesiąc -->
<div class="row mb-4">
<div class="col-md-6">
<label class="form-label">📆 Utworzono</label>
<span class="badge bg-success rounded-pill text-dark ms-1">
<p class="form-control-plaintext text-white">
{{ list.created_at.strftime('%Y-%m-%d') }}
</span>
</p>
</div>
<div class="col-md-6">
<label for="move_to_month" class="form-label">📁 Przenieś do miesiąca</label>
<input type="month" id="move_to_month" name="move_to_month"
<label for="created_month" class="form-label">📁 Przenieś do miesiąca</label>
<input type="month" id="created_month" name="created_month"
class="form-control bg-dark text-white border-secondary rounded">
</div>
</div>
@@ -87,13 +108,16 @@
</select>
</div>
<!-- Przyciski -->
<div class="btn-group mt-4" role="group">
<button type="submit" class="btn btn-outline-light">💾 Zapisz</button>
<a href="{{ url_for('main_page') }}" class="btn btn-outline-light">❌ Anuluj</a>
<!-- Link udostępnienia -->
<div class="mb-4">
<label class="form-label">🔗 Link do udostępnienia</label>
<input type="text" class="form-control bg-dark text-white border-secondary rounded" readonly
value="{{ request.url_root }}share/{{ list.share_token }}">
</div>
<button type="submit" class="btn btn-success me-2">💾 Zapisz zmiany</button>
</form>
</div>
</div>

View File

@@ -9,77 +9,90 @@
<div class="card bg-dark text-white mb-5">
<div class="card-body">
<form method="post">
<!-- Nazwa listy -->
<div class="mb-3">
<label for="title" class="form-label">Nazwa listy</label>
<input type="text" name="title" id="title" class="form-control bg-dark text-white border-secondary rounded"
<label for="title" class="form-label">📝 Nazwa listy</label>
<input type="text" class="form-control bg-dark text-white border-secondary rounded" id="title" name="title"
value="{{ list.title }}" required>
</div>
<div class="form-check mb-3">
<input class="form-check-input rounded" type="checkbox" name="is_public" id="is_public" {% if list.is_public
%}checked{% endif %}>
<label class="form-check-label" for="is_public">Lista publiczna</label>
<!-- Statusy listy -->
<div class="mb-4">
<label class="form-label">⚙️ Statusy listy</label>
<div class="d-flex flex-wrap gap-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="public" name="is_public"
{% if list.is_public %}checked{% endif %}>
<label class="form-check-label" for="public">🌐 Publiczna</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="temporary" name="is_temporary"
{% if list.is_temporary %}checked{% endif %}>
<label class="form-check-label" for="temporary">⏳ Tymczasowa</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="archived" name="is_archived"
{% if list.is_archived %}checked{% endif %}>
<label class="form-check-label" for="archived">📦 Archiwalna</label>
</div>
</div>
</div>
<div class="form-check mb-3">
<input class="form-check-input rounded" type="checkbox" name="is_temporary" id="is_temporary" {% if
list.is_temporary %}checked{% endif %}>
<label class="form-check-label" for="is_temporary">Lista tymczasowa</label>
</div>
<div class="row mb-3">
<!-- Data/Godzina wygaśnięcia -->
<div class="row mb-4">
<div class="col-md-6">
<label for="expires_date" class="form-label">Data wygaśnięcia</label>
<label for="expires_date" class="form-label">📅 Data wygaśnięcia</label>
<input type="date" class="form-control bg-dark text-white border-secondary rounded" id="expires_date"
name="expires_date" value="{{ list.expires_at.strftime('%Y-%m-%d') if list.expires_at else '' }}">
</div>
<div class="col-md-6">
<label for="expires_time" class="form-label">Godzina wygaśnięcia</label>
<label for="expires_time" class="form-label">Godzina wygaśnięcia</label>
<input type="time" class="form-control bg-dark text-white border-secondary rounded" id="expires_time"
name="expires_time" value="{{ list.expires_at.strftime('%H:%M') if list.expires_at else '' }}">
</div>
</div>
<div class="row mb-3">
<!-- Data utworzenia / Przenieś miesiąc -->
<div class="row mb-4">
<div class="col-md-6">
<label class="form-label">Aktualna data utworzenia:</label>
<p class="form-control-plaintext text-white">
<span class="badge bg-success rounded-pill text-dark ms-1">
{{ list.created_at.strftime('%Y-%m-%d') }}
</span>
</p>
<label class="form-label">📆 Utworzono</label>
<span class="badge bg-success rounded-pill text-dark ms-1">
{{ list.created_at.strftime('%Y-%m-%d') }}
</span>
</div>
<div class="col-md-6">
<label for="move_to_month" class="form-label">Przenieś listę do miesiąca</label>
<label for="move_to_month" class="form-label">📁 Przenieś do miesiąca</label>
<input type="month" id="move_to_month" name="move_to_month"
class="form-control bg-dark text-white border-secondary rounded">
</div>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="is_archived" id="is_archived" {% if list.is_archived
%}checked{% endif %}>
<label class="form-check-label" for="is_archived">Zarchiwizowana</label>
<!-- Kategorie -->
<div class="mb-4">
<label for="categories" class="form-label">🏷️ Kategorie</label>
<select id="categories" name="categories"
class="form-select tom-dark bg-dark text-white border-secondary rounded">
<option value=""> brak </option>
{% for cat in categories %}
<option value="{{ cat.id }}" {% if cat.id in selected_categories %}selected{% endif %}>
{{ cat.name }}
</option>
{% endfor %}
</select>
</div>
<label for="title" class="form-label">Kategoria</label>
<select id="categories" name="categories"
class="form-select tom-dark bg-dark text-white border-secondary rounded">
<option value=""> brak </option>
{% for cat in categories %}
<option value="{{ cat.id }}" {% if cat.id in selected_categories %}selected{% endif %}>
{{ cat.name }}
</option>
{% endfor %}
</select>
<!-- Przyciski -->
<div class="btn-group mt-4" role="group">
<button type="submit" class="btn btn-outline-light">💾 Zapisz</button>
<a href="{{ url_for('main_page') }}" class="btn btn-outline-light">Anuluj</a>
<a href="{{ url_for('main_page') }}" class="btn btn-outline-light">Anuluj</a>
</div>
</form>
</div>
</div>
{% if receipts %}
<hr class="my-4">