mirror of https://gitlab.crans.org/bde/nk20
transaction_type -> category
This commit is contained in:
parent
b18e5b03a4
commit
7230f9c535
|
@ -138,8 +138,8 @@ class ConsoView(LoginRequiredMixin, CreateView):
|
||||||
Add some context variables in template such as page title
|
Add some context variables in template such as page title
|
||||||
"""
|
"""
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['transaction_templates'] = TransactionTemplate.objects.all() \
|
context['transaction_templates'] = TransactionTemplate.objects.filter(display=True) \
|
||||||
.order_by('template_type')
|
.order_by('category')
|
||||||
context['title'] = _("Consommations")
|
context['title'] = _("Consommations")
|
||||||
|
|
||||||
# select2 compatibility
|
# select2 compatibility
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{# Regroup buttons under categories #}
|
{# Regroup buttons under categories #}
|
||||||
{% regroup transaction_templates by template_type as template_types %}
|
{% regroup transaction_templates by category as categories %}
|
||||||
|
|
||||||
<form method="post" onsubmit="window.onbeforeunload=null">
|
<form method="post" onsubmit="window.onbeforeunload=null">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -44,10 +44,10 @@
|
||||||
{# Tabs for button categories #}
|
{# Tabs for button categories #}
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<ul class="nav nav-tabs nav-fill card-header-tabs">
|
<ul class="nav nav-tabs nav-fill card-header-tabs">
|
||||||
{% for template_type in template_types %}
|
{% for category in categories %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#{{ template_type.grouper|slugify }}">
|
<a class="nav-link" data-toggle="tab" href="#{{ category.grouper|slugify }}">
|
||||||
{{ template_type.grouper }}
|
{{ category.grouper }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -57,10 +57,10 @@
|
||||||
{# Tabs content #}
|
{# Tabs content #}
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
{% for template_type in template_types %}
|
{% for category in categories %}
|
||||||
<div class="tab-pane" id="{{ template_type.grouper|slugify }}">
|
<div class="tab-pane" id="{{ category.grouper|slugify }}">
|
||||||
<div class="d-inline-flex flex-wrap justify-content-center">
|
<div class="d-inline-flex flex-wrap justify-content-center">
|
||||||
{% for button in template_type.list %}
|
{% for button in category.list %}
|
||||||
<button class="btn btn-outline-dark rounded-0 flex-fill"
|
<button class="btn btn-outline-dark rounded-0 flex-fill"
|
||||||
name="button" value="{{ button.name }}">
|
name="button" value="{{ button.name }}">
|
||||||
{{ button.name }} ({{ button.amount | pretty_money }})
|
{{ button.name }} ({{ button.amount | pretty_money }})
|
||||||
|
|
Loading…
Reference in New Issue