mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
179 lines
7.4 KiB
HTML
179 lines
7.4 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% load i18n static pretty_money django_tables2 %}
|
|
|
|
{# Remove page title #}
|
|
{% block contenttitle %}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="row mt-4">
|
|
<div class="col-sm-5 col-md-4" id="infos_div">
|
|
<div class="row">
|
|
{# User details column #}
|
|
<div class="col-xl-5" id="note_infos_div">
|
|
<div class="card border-success shadow mb-4">
|
|
<img src="/media/pic/default.png"
|
|
id="profile_pic" alt="" class="img-fluid rounded mx-auto d-block">
|
|
<div class="card-body text-center">
|
|
<span id="user_note"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{# User selection column #}
|
|
<div class="col-xl-7" id="user_select_div">
|
|
<div class="card border-success shadow mb-4">
|
|
<div class="card-header">
|
|
<p class="card-text font-weight-bold">
|
|
Sélection des émetteurs
|
|
</p>
|
|
</div>
|
|
<ul class="list-group list-group-flush" id="note_list">
|
|
</ul>
|
|
<div class="card-body">
|
|
<input class="form-control mx-auto d-block" type="text" id="note" />
|
|
<ul class="list-group list-group-flush" id="alias_matched">
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-xl-5" id="consos_list_div">
|
|
<div class="card border-info shadow mb-4">
|
|
<div class="card-header">
|
|
<p class="card-text font-weight-bold">
|
|
Sélection des consommations
|
|
</p>
|
|
</div>
|
|
<ul class="list-group list-group-flush" id="consos_list">
|
|
</ul>
|
|
<button id="consume_all" class="form-control btn btn-primary">Consommer !</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{# Buttons column #}
|
|
<div class="col-sm-7 col-md-8" id="buttons_div">
|
|
{# Show last used buttons #}
|
|
<div class="card shadow mb-4">
|
|
<div class="card-body text-nowrap" style="overflow:auto hidden">
|
|
<p class="card-text text-muted font-weight-light font-italic">
|
|
Les boutons les plus utilisés s'afficheront ici.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{# Regroup buttons under categories #}
|
|
{% regroup transaction_templates by category as categories %}
|
|
|
|
<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">
|
|
{% for category in categories %}
|
|
<li class="nav-item">
|
|
<a class="nav-link font-weight-bold" data-toggle="tab" href="#{{ category.grouper|slugify }}">
|
|
{{ category.grouper }}
|
|
</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
|
|
{# Tabs content #}
|
|
<div class="card-body">
|
|
<div class="tab-content">
|
|
{% for category in categories %}
|
|
<div class="tab-pane" id="{{ category.grouper|slugify }}">
|
|
<div class="d-inline-flex flex-wrap justify-content-center">
|
|
{% for button in category.list %}
|
|
{% if button.display %}
|
|
<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>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</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' %}">
|
|
<i class="fa fa-edit"></i> Éditer
|
|
</a>
|
|
<div class="btn-group btn-group-toggle float-right" data-toggle="buttons">
|
|
<label class="btn btn-sm btn-outline-primary active">
|
|
<input type="radio" name="conso_type" id="single_conso" checked>
|
|
Consomations simples
|
|
</label>
|
|
<label class="btn btn-sm btn-outline-primary">
|
|
<input type="radio" name="conso_type" id="double_conso">
|
|
Consomations doubles
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow mb-4" id="history">
|
|
<div class="card-header">
|
|
<p class="card-text font-weight-bold">
|
|
Historique des transactions récentes
|
|
</p>
|
|
</div>
|
|
{% render_table table %}
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extracss %}
|
|
<style>
|
|
.select2-container{
|
|
max-width: 100%;
|
|
min-width: 100%;
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block extrajavascript %}
|
|
<script type="text/javascript" src="/static/js/consos.js"></script>
|
|
<script type="text/javascript">
|
|
var CSRF_TOKEN = "{{ csrf_token }}";
|
|
|
|
$("#double_conso").click(function() {
|
|
$("#consos_list_div").show();
|
|
$("#infos_div").attr('class', 'col-sm-5 col-xl-6');
|
|
$("#note_infos_div").attr('class', 'col-xl-3');
|
|
$("#user_select_div").attr('class', 'col-xl-4');
|
|
$("#buttons_div").attr('class', 'col-sm-7 col-xl-6');
|
|
});
|
|
|
|
$("#single_conso").click(function() {
|
|
$("#consos_list_div").hide();
|
|
$("#infos_div").attr('class', 'col-sm-5 col-md-4');
|
|
$("#note_infos_div").attr('class', 'col-xl-5');
|
|
$("#user_select_div").attr('class', 'col-xl-7');
|
|
$("#buttons_div").attr('class', 'col-sm-7 col-md-8');
|
|
});
|
|
|
|
$("#consos_list_div").hide();
|
|
|
|
$("#consume_all").click(consumeAll);
|
|
|
|
{% for button in transaction_templates %}
|
|
{% if button.display %}
|
|
$("#button{{ button.id }}").click(function() {
|
|
addConso({{ button.destination.id }}, {{ button.amount }},
|
|
{{ polymorphic_ctype }}, {{ button.category.id }}, "{{ button.category.name }}",
|
|
{{ button.id }}, "{{ button.name }}");
|
|
});
|
|
{% endif %}
|
|
{% endfor %}
|
|
</script>
|
|
{% endblock %}
|