nk20/templates/note/conso_form.html

98 lines
3.9 KiB
HTML
Raw Normal View History

2020-02-04 00:18:03 +00:00
{% extends "base.html" %}
2020-03-10 07:07:09 +00:00
{% load i18n static pretty_money django_tables2 %}
2020-02-04 00:18:03 +00:00
2020-02-21 21:40:58 +00:00
{# Remove page title #}
{% block contenttitle %}{% endblock %}
2020-02-04 00:18:03 +00:00
{% block content %}
2020-02-21 21:40:58 +00:00
{# Regroup buttons under categories #}
2020-02-23 17:56:03 +00:00
{% regroup transaction_templates by category as categories %}
2020-02-21 21:40:58 +00:00
<form method="post" onsubmit="window.onbeforeunload=null">
{% csrf_token %}
<div class="row">
2020-02-22 09:17:24 +00:00
<div class="col-sm-5 mb-4">
2020-02-21 21:40:58 +00:00
{% if form.non_field_errors %}
<p class="errornote">
{% for error in form.non_field_errors %}
{{ error }}
{% endfor %}
</p>
{% endif %}
{% for field in form %}
<div class="form-row{% if field.errors %} errors{% endif %}">
{{ field.errors }}
<div>
{{ field.label_tag }}
{% if field.is_readonly %}
<div class="readonly">{{ field.contents }}</div>
{% else %}
{{ field }}
{% endif %}
{% if field.field.help_text %}
<div class="help">{{ field.field.help_text|safe }}</div>
{% endif %}
</div>
</div>
2020-02-04 00:18:03 +00:00
{% endfor %}
2020-02-21 21:40:58 +00:00
</div>
<div class="col-sm-7">
2020-02-22 09:17:24 +00:00
<div class="card text-center shadow">
2020-02-21 21:40:58 +00:00
{# Tabs for button categories #}
<div class="card-header">
<ul class="nav nav-tabs nav-fill card-header-tabs">
2020-02-23 17:56:03 +00:00
{% for category in categories %}
2020-02-21 21:40:58 +00:00
<li class="nav-item">
2020-02-23 17:56:03 +00:00
<a class="nav-link" data-toggle="tab" href="#{{ category.grouper|slugify }}">
{{ category.grouper }}
2020-02-21 21:40:58 +00:00
</a>
</li>
{% endfor %}
</ul>
</div>
{# Tabs content #}
<div class="card-body">
<div class="tab-content">
2020-02-23 17:56:03 +00:00
{% for category in categories %}
<div class="tab-pane" id="{{ category.grouper|slugify }}">
2020-02-22 09:17:24 +00:00
<div class="d-inline-flex flex-wrap justify-content-center">
2020-02-23 17:56:03 +00:00
{% for button in category.list %}
2020-02-22 09:17:24 +00:00
<button class="btn btn-outline-dark rounded-0 flex-fill"
name="button" value="{{ button.name }}">
{{ button.name }} ({{ button.amount | pretty_money }})
</button>
{% endfor %}
</div>
2020-02-21 21:40:58 +00:00
</div>
{% endfor %}
</div>
2020-02-04 00:18:03 +00:00
</div>
</div>
2020-02-21 21:40:58 +00:00
</div>
</div>
2020-02-04 00:18:03 +00:00
</form>
2020-02-22 09:17:24 +00:00
{% endblock %}
2020-02-21 21:40:58 +00:00
2020-02-22 09:17:24 +00:00
{% block extrajavascript %}
2020-02-21 21:40:58 +00:00
<script type="text/javascript">
$(document).ready(function() {
// If hash of a category in the URL, then select this category
// else select the first one
if (location.hash) {
$("a[href='" + location.hash + "']").tab("show");
} else {
$("a[data-toggle='tab']").first().tab("show");
}
// When selecting a category, change URL
$(document.body).on("click", "a[data-toggle='tab']", function(event) {
location.hash = this.getAttribute("href");
});
});
</script>
2020-02-04 00:18:03 +00:00
{% endblock %}