Add support for account_read history

This commit is contained in:
Ludovic Stephan 2017-03-18 22:48:50 -03:00
parent 951932a6c8
commit 7a00096170
2 changed files with 19 additions and 24 deletions

View file

@ -4,11 +4,17 @@
{% load l10n %}
{% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/jquery-ui.min.css' %}">
<script type="text/javascript" src="{% static 'kfet/js/js.cookie.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/reconnecting-websocket.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/jquery-ui.min.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/jquery-confirm.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/moment.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/moment-fr.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/moment-timezone-with-data-2010-2020.js' %}"></script>
<script type="text/javascript" src="{% url 'js_reverse' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/kfet.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/kfet.api.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/history.js' %}"></script>
{% endblock %}
@ -62,33 +68,19 @@
<script type="text/javascript">
$(document).ready(function() {
settings = { 'subvention_cof': parseFloat({{ settings.subvention_cof|unlocalize }})}
'use strict';
khistory = new KHistory({
display_trigramme: false,
});
// Lock to avoid multiple requests
window.lock = 0;
function getHistory() {
var data = {
var history = new History();
history.api_options = {
'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);
});
}
//TODO: add ws support ?
getHistory();
history.reset();
});
</script>

View file

@ -55,7 +55,10 @@ $(document).ready(function() {
// Lock to avoid multiple requests
window.lock = 0;
var history = new History({'transfersonly': true}, {});
var history = new History();
history.api_options = {
'transfersonly': true,
};
// -----
// Synchronization