dropbna poprawka w stringu

This commit is contained in:
Mateusz Gruszczyński
2025-08-12 22:55:52 +02:00
parent 8c627affe5
commit 740c02b42b

View File

@@ -127,49 +127,55 @@
</div>
</div>
{% if not show_all %}
{% set current_date = now.replace(day=1) %}
{% set prev_month = (current_date - timedelta(days=1)).strftime('%Y-%m') %}
{% set next_month = (current_date + timedelta(days=31)).replace(day=1).strftime('%Y-%m') %}
{# panel wyboru miesiąca zawsze widoczny #}
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
{# LEWA STRONA — przyciski ← → TYLKO gdy nie show_all #}
<div class="d-flex gap-2">
{% if not show_all %}
{% set current_date = now.replace(day=1) %}
{% set prev_month = (current_date - timedelta(days=1)).strftime('%Y-%m') %}
{% set next_month = (current_date + timedelta(days=31)).replace(day=1).strftime('%Y-%m') %}
{% if prev_month in month_options %}
<a href="{{ url_for('admin_panel', m=prev_month) }}" class="btn btn-outline-light btn-sm">
← {{ prev_month }}
</a>
{% else %}
<button class="btn btn-outline-light btn-sm opacity-50" disabled>← {{ prev_month }}</button>
{% endif %}
{# LEWA STRONA - Przyciski #}
<div class="d-flex gap-2">
{% if prev_month in month_options %}
<a href="{{ url_for('admin_panel', m=prev_month) }}" class="btn btn-outline-light btn-sm">
← {{ prev_month }}
</a>
{% else %}
<button class="btn btn-outline-light btn-sm opacity-50" disabled>← {{ prev_month }}</button>
{% endif %}
{% if next_month in month_options %}
<a href="{{ url_for('admin_panel', m=next_month) }}" class="btn btn-outline-light btn-sm">
{{ next_month }} →
</a>
{% else %}
<button class="btn btn-outline-light btn-sm opacity-50" disabled>{{ next_month }} →</button>
{% endif %}
</div>
{% if next_month in month_options %}
<a href="{{ url_for('admin_panel', m=next_month) }}" class="btn btn-outline-light btn-sm">
{{ next_month }} →
</a>
{% else %}
<button class="btn btn-outline-light btn-sm opacity-50" disabled>{{ next_month }} →</button>
{% endif %}
{% else %}
{# Tryb wszystkie miesiące — możemy pokazać skrót do bieżącego miesiąca #}
<a href="{{ url_for('admin_panel', m=now.strftime('%Y-%m')) }}" class="btn btn-outline-light btn-sm">
📅 Przejdź do bieżącego miesiąca
</a>
{% endif %}
</div>
{# PRAWA STRONA - Picker #}
<form method="get" class="m-0">
<div class="input-group input-group-sm">
<span class="input-group-text bg-secondary text-white">📅</span>
<select name="m" class="form-select bg-dark text-white border-secondary" onchange="this.form.submit()">
<option value="all" {% if show_all %}selected{% endif %}>Wszystkie miesiące</option>
{% for val in month_options %}
{% set date_obj = (val ~ '-01') | todatetime %}
<option value="{{ val }}" {% if month_str==val %}selected{% endif %}>
{{ date_obj.strftime('%B %Y')|capitalize }}
</option>
{% endfor %}
</select>
</div>
</form>
{# PRAWA STRONA — picker miesięcy zawsze widoczny #}
<form method="get" class="m-0">
<div class="input-group input-group-sm">
<span class="input-group-text bg-secondary text-white">📅</span>
<select name="m" class="form-select bg-dark text-white border-secondary" onchange="this.form.submit()">
<option value="all" {% if show_all %}selected{% endif %}>Wszystkie miesiące</option>
{% for val in month_options %}
{% set date_obj = (val ~ '-01') | todatetime %}
<option value="{{ val }}" {% if month_str == val %}selected{% endif %}>
{{ date_obj.strftime('%B %Y')|capitalize }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
</form>
</div>
<div class="card bg-dark text-white mb-5">
<div class="card-body">
@@ -193,8 +199,8 @@
<th>Utworzono</th>
<th>Właściciel</th>
<th>Produkty</th>
<th>Wypełnienie</th>
<th>Komentarze</th>
<th>Progress</th>
<th>Koment.</th>
<th>Paragony</th>
<th>Wydatki</th>
<th>Akcje</th>
@@ -257,10 +263,10 @@
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
<a href="{{ url_for('edit_list', list_id=l.id) }}" class="btn btn-outline-primary">✏️ Edytuj</a>
<a href="{{ url_for('edit_list', list_id=l.id) }}" class="btn btn-outline-primary">✏️</a>
<a href="{{ url_for('delete_list', list_id=l.id) }}"
class="btn btn-outline-danger"
onclick="return confirm('Na pewno usunąć tę listę?')">🗑️ Usuń</a>
onclick="return confirm('Na pewno usunąć tę listę?')">🗑️</a>
</div>
</td>
</tr>
@@ -268,7 +274,9 @@
</tbody>
</table>
</div>
<button type="submit" class="btn btn-danger mt-2">🗑️ Usuń zaznaczone listy</button>
<div class="d-flex justify-content-end mt-2">
<button type="submit" class="btn btn-danger">🗑️ Usuń zaznaczone listy</button>
</div>
</form>
</div>
</div>