diff --git a/app/apps/insights/views.py b/app/apps/insights/views.py index 1495d05..b6ee79b 100644 --- a/app/apps/insights/views.py +++ b/app/apps/insights/views.py @@ -168,6 +168,12 @@ def category_sum_by_currency(request): @login_required @require_http_methods(["GET"]) def category_overview(request): + view_type = request.session.get("insights_category_explorer_view_type", "table") + + if "view_type" in request.GET: + view_type = request.GET["view_type"] + request.session["insights_category_explorer_view_type"] = view_type + # Get filtered transactions transactions = get_transactions(request, include_silent=True) @@ -178,7 +184,7 @@ def category_overview(request): return render( request, "insights/fragments/category_overview/index.html", - {"total_table": total_table}, + {"total_table": total_table, "view_type": view_type}, ) diff --git a/app/templates/insights/fragments/category_overview/index.html b/app/templates/insights/fragments/category_overview/index.html index 360b2f9..6fbff4b 100644 --- a/app/templates/insights/fragments/category_overview/index.html +++ b/app/templates/insights/fragments/category_overview/index.html @@ -1,226 +1,252 @@ {% load i18n %}
| {% trans 'Category' %} | -{% trans 'Income' %} | -{% trans 'Expense' %} | -{% trans 'Total' %} | -
|---|
| {% if category.name %}{{ category.name }}{% else %}{% trans 'Uncategorized' %}{% endif %} | -
- {% for currency in category.currencies.values %}
- {% if currency.total_income != 0 %}
- -
- {% endif %}
- {% endfor %}
- |
-
- {% for currency in category.currencies.values %}
- {% if currency.total_expense != 0 %}
- -
- {% endif %}
- {% endfor %}
- |
-
- {% for currency in category.currencies.values %}
- {% if currency.total_final != 0 %}
- -
- {% endif %}
- {% endfor %}
- |
+ {% trans 'Category' %} | +{% trans 'Income' %} | +{% trans 'Expense' %} | +{% trans 'Total' %} |
|---|