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-03-10 07:11:43 +00:00
|
|
|
<div class="row mt-4">
|
2020-03-12 23:11:33 +00:00
|
|
|
<div class="col-sm-5 col-md-4" id="infos_div">
|
2020-03-10 07:11:43 +00:00
|
|
|
<div class="row">
|
|
|
|
{# User details column #}
|
2020-04-10 21:40:19 +00:00
|
|
|
<div class="col">
|
2020-03-28 16:44:22 +00:00
|
|
|
<div class="card border-success shadow mb-4 text-center">
|
2020-08-05 17:52:36 +00:00
|
|
|
<a id="profile_pic_link" href="#">
|
|
|
|
<img src="/media/pic/default.png"
|
|
|
|
id="profile_pic" alt="" class="card-img-top">
|
|
|
|
</a>
|
2020-03-10 07:11:43 +00:00
|
|
|
<div class="card-body text-center">
|
2020-03-11 22:35:38 +00:00
|
|
|
<span id="user_note"></span>
|
2020-02-21 21:40:58 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-03-10 07:11:43 +00:00
|
|
|
</div>
|
2020-02-21 21:40:58 +00:00
|
|
|
|
2020-03-10 07:11:43 +00:00
|
|
|
{# User selection column #}
|
2020-03-12 23:11:33 +00:00
|
|
|
<div class="col-xl-7" id="user_select_div">
|
2020-03-10 07:11:43 +00:00
|
|
|
<div class="card border-success shadow mb-4">
|
|
|
|
<div class="card-header">
|
|
|
|
<p class="card-text font-weight-bold">
|
2020-03-28 16:44:22 +00:00
|
|
|
{% trans "Consum" %}
|
2020-03-10 07:11:43 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2020-04-10 21:15:25 +00:00
|
|
|
<div class="card-body p-0" style="min-height:125px;">
|
2020-04-10 18:21:26 +00:00
|
|
|
<ul class="list-group list-group-flush" id="note_list">
|
|
|
|
</ul>
|
2020-03-28 16:44:22 +00:00
|
|
|
</div>
|
2020-04-10 18:21:26 +00:00
|
|
|
|
|
|
|
{# User search with autocompletion #}
|
2020-04-10 20:47:59 +00:00
|
|
|
<div class="card-footer">
|
2020-04-10 18:21:26 +00:00
|
|
|
<input class="form-control mx-auto d-block"
|
2020-04-10 20:43:55 +00:00
|
|
|
placeholder="{% trans "Name or alias..." %}" type="text" id="note" autofocus />
|
2020-03-10 07:11:43 +00:00
|
|
|
</div>
|
2020-02-21 21:40:58 +00:00
|
|
|
</div>
|
2020-03-10 07:11:43 +00:00
|
|
|
</div>
|
2020-03-12 23:11:33 +00:00
|
|
|
|
2020-04-10 17:50:42 +00:00
|
|
|
<div class="col-xl-5 d-none" id="consos_list_div">
|
2020-03-12 23:11:33 +00:00
|
|
|
<div class="card border-info shadow mb-4">
|
|
|
|
<div class="card-header">
|
|
|
|
<p class="card-text font-weight-bold">
|
2020-03-14 16:40:31 +00:00
|
|
|
{% trans "Select consumptions" %}
|
2020-03-12 23:11:33 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2020-04-10 21:15:25 +00:00
|
|
|
<div class="card-body p-0" style="min-height:125px;">
|
|
|
|
<ul class="list-group list-group-flush" id="consos_list">
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div class="card-footer text-center">
|
2020-08-03 08:03:51 +00:00
|
|
|
<span id="consume_all" class="btn btn-primary">
|
2020-04-10 21:15:25 +00:00
|
|
|
{% trans "Consume!" %}
|
2020-08-03 08:03:51 +00:00
|
|
|
</span>
|
2020-04-10 21:15:25 +00:00
|
|
|
</div>
|
2020-03-12 23:11:33 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-03-10 07:11:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{# Buttons column #}
|
2020-04-10 21:40:19 +00:00
|
|
|
<div class="col">
|
2020-03-10 07:11:43 +00:00
|
|
|
{# Show last used buttons #}
|
|
|
|
<div class="card shadow mb-4">
|
2020-03-14 18:00:20 +00:00
|
|
|
<div class="card-header">
|
|
|
|
<p class="card-text font-weight-bold">
|
2020-07-25 15:25:57 +00:00
|
|
|
{% trans "Highlighted buttons" %}
|
2020-03-10 07:11:43 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2020-03-14 18:00:20 +00:00
|
|
|
<div class="card-body text-nowrap" style="overflow:auto hidden">
|
2020-07-25 15:25:57 +00:00
|
|
|
<div class="d-inline-flex flex-wrap justify-content-center" id="highlighted">
|
|
|
|
{% for button in highlighted %}
|
2020-03-14 18:00:20 +00:00
|
|
|
{% if button.display %}
|
|
|
|
<button class="btn btn-outline-dark rounded-0 flex-fill"
|
2020-07-25 15:25:57 +00:00
|
|
|
id="highlighted_button{{ button.id }}" name="button" value="{{ button.name }}">
|
2020-03-14 18:00:20 +00:00
|
|
|
{{ button.name }} ({{ button.amount | pretty_money }})
|
|
|
|
</button>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-03-10 07:11:43 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{# Regroup buttons under categories #}
|
2020-07-25 15:25:57 +00:00
|
|
|
{# {% regroup transaction_templates by category as categories %} #}
|
2020-02-21 21:40:58 +00:00
|
|
|
|
2020-03-10 07:11:43 +00:00
|
|
|
<div class="card border-primary text-center shadow mb-4">
|
|
|
|
{# Tabs for button categories #}
|
|
|
|
<div class="card-header">
|
|
|
|
<ul class="nav nav-tabs nav-fill card-header-tabs">
|
2020-03-11 19:59:15 +00:00
|
|
|
{% for category in categories %}
|
2020-03-10 07:11:43 +00:00
|
|
|
<li class="nav-item">
|
2020-07-25 15:25:57 +00:00
|
|
|
<a class="nav-link font-weight-bold" data-toggle="tab" href="#{{ category.name|slugify }}">
|
|
|
|
{{ category.name }}
|
2020-03-10 07:11:43 +00:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{# Tabs content #}
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="tab-content">
|
2020-03-11 19:59:15 +00:00
|
|
|
{% for category in categories %}
|
2020-07-25 15:25:57 +00:00
|
|
|
<div class="tab-pane" id="{{ category.name|slugify }}">
|
2020-03-10 07:11:43 +00:00
|
|
|
<div class="d-inline-flex flex-wrap justify-content-center">
|
2020-07-25 15:25:57 +00:00
|
|
|
{% for button in category.templates_filtered %}
|
2020-03-11 21:51:46 +00:00
|
|
|
{% if button.display %}
|
2020-03-12 00:10:52 +00:00
|
|
|
<button class="btn btn-outline-dark rounded-0 flex-fill"
|
|
|
|
id="button{{ button.id }}" name="button" value="{{ button.name }}">
|
|
|
|
{{ button.name }} ({{ button.amount | pretty_money }})
|
|
|
|
</button>
|
2020-03-11 21:51:46 +00:00
|
|
|
{% endif %}
|
2020-03-10 07:11:43 +00:00
|
|
|
{% endfor %}
|
2020-02-21 21:40:58 +00:00
|
|
|
</div>
|
2020-03-10 07:11:43 +00:00
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{# Mode switch #}
|
|
|
|
<div class="card-footer border-primary">
|
|
|
|
<a class="btn btn-sm btn-secondary float-left" href="{% url 'note:template_list' %}">
|
2020-03-14 16:40:31 +00:00
|
|
|
<i class="fa fa-edit"></i> {% trans "Edit" %}
|
2020-03-10 07:11:43 +00:00
|
|
|
</a>
|
|
|
|
<div class="btn-group btn-group-toggle float-right" data-toggle="buttons">
|
2020-03-16 12:06:02 +00:00
|
|
|
<label for="single_conso" class="btn btn-sm btn-outline-primary active">
|
2020-03-12 23:11:33 +00:00
|
|
|
<input type="radio" name="conso_type" id="single_conso" checked>
|
2020-04-10 20:22:07 +00:00
|
|
|
<i class="fa fa-long-arrow-left" aria-hidden="true"></i>
|
2020-03-14 16:40:31 +00:00
|
|
|
{% trans "Single consumptions" %}
|
2020-03-10 07:11:43 +00:00
|
|
|
</label>
|
2020-03-16 12:06:02 +00:00
|
|
|
<label for="double_conso" class="btn btn-sm btn-outline-primary">
|
2020-03-12 23:11:33 +00:00
|
|
|
<input type="radio" name="conso_type" id="double_conso">
|
2020-04-10 20:22:07 +00:00
|
|
|
<i class="fa fa-arrows-h" aria-hidden="true"></i>
|
2020-03-14 16:40:31 +00:00
|
|
|
{% trans "Double consumptions" %}
|
2020-03-10 07:11:43 +00:00
|
|
|
</label>
|
2020-02-04 00:18:03 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-21 21:40:58 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-03-10 07:11:43 +00:00
|
|
|
</div>
|
|
|
|
|
2020-03-12 09:53:06 +00:00
|
|
|
<div class="card shadow mb-4" id="history">
|
2020-03-10 07:11:43 +00:00
|
|
|
<div class="card-header">
|
|
|
|
<p class="card-text font-weight-bold">
|
2020-03-14 16:40:31 +00:00
|
|
|
{% trans "Recent transactions history" %}
|
2020-03-10 07:11:43 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
{% render_table table %}
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
2020-02-22 09:17:24 +00:00
|
|
|
{% block extrajavascript %}
|
2020-04-10 17:50:42 +00:00
|
|
|
<script type="text/javascript" src="{% static "js/consos.js" %}"></script>
|
2020-02-21 21:40:58 +00:00
|
|
|
<script type="text/javascript">
|
2020-07-25 15:25:57 +00:00
|
|
|
{% for button in highlighted %}
|
2020-03-16 08:32:39 +00:00
|
|
|
{% if button.display %}
|
2020-07-25 15:25:57 +00:00
|
|
|
$("#highlighted_button{{ button.id }}").click(function() {
|
|
|
|
addConso({{ button.destination_id }}, {{ button.amount }},
|
2020-07-31 17:00:19 +00:00
|
|
|
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
|
|
|
|
{{ button.id }}, "{{ button.name|escapejs }}");
|
2020-03-16 08:32:39 +00:00
|
|
|
});
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2020-03-13 00:34:20 +00:00
|
|
|
|
2020-07-25 15:25:57 +00:00
|
|
|
{% for category in categories %}
|
|
|
|
{% for button in category.templates_filtered %}
|
2020-03-12 15:53:35 +00:00
|
|
|
{% if button.display %}
|
|
|
|
$("#button{{ button.id }}").click(function() {
|
2020-07-25 15:25:57 +00:00
|
|
|
addConso({{ button.destination_id }}, {{ button.amount }},
|
2020-07-31 17:00:19 +00:00
|
|
|
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
|
|
|
|
{{ button.id }}, "{{ button.name|escapejs }}");
|
2020-03-11 22:35:38 +00:00
|
|
|
});
|
2020-03-12 15:53:35 +00:00
|
|
|
{% endif %}
|
2020-07-25 15:25:57 +00:00
|
|
|
{% endfor %}
|
2020-03-12 15:53:35 +00:00
|
|
|
{% endfor %}
|
2020-02-21 21:40:58 +00:00
|
|
|
</script>
|
2020-02-04 00:18:03 +00:00
|
|
|
{% endblock %}
|