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 %} {% load l10n %}
{% block extra_head %} {% 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/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.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/moment-fr.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="{% 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.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> <script type="text/javascript" src="{% static 'kfet/js/history.js' %}"></script>
{% endblock %} {% endblock %}
@ -62,33 +68,19 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
settings = { 'subvention_cof': parseFloat({{ settings.subvention_cof|unlocalize }})} 'use strict';
khistory = new KHistory({ // Lock to avoid multiple requests
display_trigramme: false, window.lock = 0;
});
function getHistory() { var history = new History();
var data = { history.api_options = {
'accounts': [{{ account.pk }}], 'accounts': [{{ account.pk }}],
} };
$.ajax({ //TODO: add ws support ?
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(); history.reset();
}); });
</script> </script>

View file

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