kategorie list i wykresy

This commit is contained in:
Mateusz Gruszczyński
2025-07-30 23:20:03 +02:00
parent 437f7a26e3
commit 978bcbe051
12 changed files with 711 additions and 32 deletions

View File

@@ -79,6 +79,16 @@
</div>
</div>
<div class="mb-4">
<label class="form-label">Kategorie</label>
<select id="categories" name="categories" multiple>
{% for cat in categories %}
<option value="{{ cat.id }}" {% if cat.id in selected_categories %}selected{% endif %}>
{{ cat.name }}
</option>
{% endfor %}
</select>
</div>
<div class="mb-4">
<label class="form-label">Link do udostępnienia</label>
@@ -267,4 +277,7 @@
</div>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static_bp.serve_js', filename='select.js') }}"></script>
{% endblock %}

View File

@@ -12,9 +12,13 @@
<link href="{{ url_for('static_bp.serve_css_lib', filename='sort_table.min.css') }}" rel="stylesheet">
{% endif %}
<link href="{{ url_for('static_bp.serve_css_lib', filename='bootstrap.min.css') }}" rel="stylesheet">
{% if '/admin/' in request.path %}
{% if '/admin/receipts' in request.path or '/edit_my_list' in request.path %}
<link href="{{ url_for('static_bp.serve_css_lib', filename='cropper.min.css') }}" rel="stylesheet">
{% endif %}
{% if '/edit_my_list' or '/admin/edit_list' in request.path %}
<link href="{{ url_for('static_bp.serve_css_lib', filename='tom-select.bootstrap5.min.css') }}" rel="stylesheet">
{% endif %}
</head>
<body class="bg-dark text-white">
@@ -102,6 +106,9 @@
{% if '/admin/receipts' in request.path or '/edit_my_list' in request.path %}
<script src="{{ url_for('static_bp.serve_js_lib', filename='cropper.min.js') }}"></script>
{% endif %}
{% if '/edit_my_list' or '/admin/edit_list' in request.path %}
<script src="{{ url_for('static_bp.serve_js_lib', filename='tom-select.complete.min.js') }}"></script>
{% endif %}
{% endif %}

View File

@@ -58,6 +58,15 @@
<label class="form-check-label" for="is_archived">Zarchiwizowana</label>
</div>
<label for="title" class="form-label">Kategorie</label>
<select id="categories" name="categories[]" multiple>
{% for cat in categories %}
<option value="{{ cat.id }}" {% if cat.id in selected_categories %}selected{% endif %}>
{{ cat.name }}
</option>
{% endfor %}
</select>
<div class="btn-group mt-4" role="group">
<button type="submit" class="btn btn-outline-success">Zapisz</button>
<a href="{{ url_for('main_page') }}" class="btn btn-outline-light">Anuluj</a>
@@ -167,4 +176,5 @@
<script src="{{ url_for('static_bp.serve_js', filename='confirm_delete.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='user_receipt_crop.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='receipt_crop_logic.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='select.js') }}"></script>
{% endblock %}

View File

@@ -11,6 +11,18 @@
<label class="form-check-label ms-2 text-white" for="showAllLists">Pokaż wszystkie publiczne listy
innych</label>
</div>
<div class="d-flex flex-wrap gap-2 mb-3">
<a href="{{ url_for('user_expenses', show_all='true') }}"
class="btn btn-sm {% if not selected_category %}btn-success{% else %}btn-outline-light{% endif %}">🌐 Wszystkie</a>
{% for cat in categories %}
<a href="{{ url_for('user_expenses', category_id=cat.id) }}"
class="btn btn-sm {% if selected_category == cat.id %}btn-success{% else %}btn-outline-light{% endif %}">
{{ cat.name }}
</a>
{% endfor %}
</div>
<div class="card bg-dark text-white mb-5">
<div class="card-body">
<ul class="nav nav-tabs mb-3" id="expenseTabs" role="tablist">
@@ -79,7 +91,10 @@
{% for list in lists_data %}
<tr data-date="{{ list.created_at.strftime('%Y-%m-%d') }}"
data-week="{{ list.created_at.isocalendar()[0] }}-{{ '%02d' % list.created_at.isocalendar()[1] }}"
data-month="{{ list.created_at.strftime('%Y-%m') }}" data-year="{{ list.created_at.year }}">
data-month="{{ list.created_at.strftime('%Y-%m') }}" data-year="{{ list.created_at.year }}"
data-categories="{{ ','.join(list.categories | map('string')) }}">
<td>
<input type="checkbox" class="form-check-input list-checkbox"
data-amount="{{ '%.2f'|format(list.total_expense) }}">
@@ -142,4 +157,5 @@
<script src="{{ url_for('static_bp.serve_js_lib', filename='chart.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='user_expenses.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='user_expense_lists.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='user_expense_category.js') }}"></script>
{% endblock %}