kpsul/kfet/templates/kfet/account_read.html
Aurélien Delobelle b8110c11a4 kfet.open
kfet.open app
- Base data (raw_open, last_update...) is stored and shared through cache system.
- 2 websockets groups: one for team users, one for other users.
- UI is initialized and kept up-to-date with WS.
- raw_open and force_close can be updated with standard HTTP requests.
  At this time, there isn't any restriction on raw_open view. Common sense tell us
  to change this behavior.

Misc
- Clean channels routing.
- 'PermConsumerMixin': user who sent the message is available as argument in
connection_groups method, which returns groups to which the user should be
appended on websocket connection (and discarded on disconnection).
- New kfet.utils module: should be used for mixins, whatever is useful and not concerns
the kfet app.
- Clean JS dependencies.
2017-06-21 07:08:28 +02:00

110 lines
2.9 KiB
HTML

{% extends "kfet/base_col_2.html" %}
{% load staticfiles %}
{% load kfet_tags %}
{% load l10n %}
{% block extra_head %}
<script type="text/javascript" src="{% static 'kfet/js/history.js' %}"></script>
{% if account.user == request.user %}
<script type="text/javascript" src="{% static 'kfet/js/Chart.bundle.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/statistic.js' %}"></script>
<script type="text/javascript">
$(document).ready(function() {
var stat_last = new StatsGroup(
"{% url 'kfet.account.stat.operation.list' trigramme=account.trigramme %}",
$("#stat_last")
);
var stat_balance = new StatsGroup(
"{% url 'kfet.account.stat.balance.list' trigramme=account.trigramme %}",
$("#stat_balance")
);
});
</script>
{% endif %}
{% endblock %}
{% block title %}
{% if account.user == request.user %}
Mon compte
{% else %}
Compte - {{ account.trigramme }}
{% endif %}
{% endblock %}
{% block header-title %}
{% if account.user == request.user %}
Mon compte
{% else %}
Informations du compte {{ account.trigramme }}
{% endif %}
{% endblock %}
{% block fixed-content %}
{% include "kfet/left_account.html" %}
{% endblock %}
{% block main-content %}
<div class="tab-content">
{% if account.user == request.user %}
<div class="content-right-block tab-pane fade in active" id="tab_stats">
<h2>Statistiques</h2>
<div>
<h3>Ma balance</h3>
<div id="stat_balance"></div>
<h3>Ma consommation</h3>
<div id="stat_last"></div>
</div>
</div><!-- content-right-block -->
{% endif %}
<div class="content-right-block tab-pane fade {% if account.user != request.user %}in active{% endif %}" id="tab_history">
{% if addcosts %}
<h2>Gagné des majorations</h2>
<div>
<ul>
{% for addcost in addcosts %}
<li>{{ addcost.date|date:'l j F' }}: +{{ addcost.sum_addcosts }}€</li>
{% endfor %}
</ul>
</div>
{% endif %}
<h2>Historique</h2>
<div id="history"></div>
</div><!-- content-right-block -->
</div><!-- tab-content -->
<script type="text/javascript">
$(document).ready(function() {
settings = { 'subvention_cof': parseFloat({{ kfet_config.subvention_cof|unlocalize }})}
khistory = new KHistory({
display_trigramme: false,
});
function getHistory() {
var data = {
'accounts': [{{ account.pk }}],
}
$.ajax({
dataType: "json",
url : "{% url 'kfet.history.json' %}",
method : "POST",
data : data,
})
.done(function(data) {
for (var i=0; i<data['opegroups'].length; i++) {
khistory.addOpeGroup(data['opegroups'][i]);
}
var nb_opes = khistory.$container.find('.ope:not(.canceled)').length;
$('#nb_opes').text(nb_opes);
});
}
getHistory();
});
</script>
{% endblock %}