Ajout historique d'un compte
- Création d'un style général pour les historiques - Reprise de l'affichage historique K-Psul
This commit is contained in:
parent
50ed08dd72
commit
ee583c3cfb
9 changed files with 239 additions and 100 deletions
|
@ -69,7 +69,66 @@
|
|||
</div>
|
||||
<div class="col-sm-8 col-md-9 col-content-right">
|
||||
{% include "kfet/base_messages.html" %}
|
||||
<div class="content-right">
|
||||
<div class="content-right-block">
|
||||
<h2>Historique</h2>
|
||||
<div id="history">
|
||||
{% spaceless %}
|
||||
{% for ope in history %}
|
||||
{% ifchanged ope.group.at|date:'dmY' %}
|
||||
<div class="day">
|
||||
{{ ope.group.at|date:'l j F' }}
|
||||
</div>
|
||||
{% endifchanged %}
|
||||
{% ifchanged ope.group.pk %}
|
||||
<div class="opegroup" data-opegroup="{{ ope.group.pk }}">
|
||||
<span class="time">{{ ope.group.at|date:'H:i:s' }}</span>
|
||||
<span class="amount">
|
||||
{% if ope.group.on_acc.trigramme == 'LIQ' %}
|
||||
{{ ope.group.amount|floatformat:2 }}
|
||||
{% else %}
|
||||
{{ ope.group.amount|ukf:ope.group.is_cof }}
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% endifchanged %}
|
||||
<div class="ope {% if ope.canceled_at %}canceled{% endif %}" data-ope="{{ ope.pk }}" data-opegroup="{{ ope.group.pk }}">
|
||||
{% if ope.group.on_acc.trigramme == 'LIQ' %}
|
||||
<span class="amount">{{ ope.amount|floatformat:2 }}€</span>
|
||||
{% else %}
|
||||
<span class="amount">{{ ope.amount|ukf:ope.group.is_cof }}</span>
|
||||
{% endif %}
|
||||
{% if ope.type == "purchase" %}
|
||||
<span class="infos1">{{ ope.article_nb }}</span>
|
||||
<span class="infos2">{{ ope.article.name }}</span>
|
||||
{% else %}
|
||||
<span class="infos1">{{ ope.amount|floatformat:2 }}€</span>
|
||||
<span class="infos2">
|
||||
{% if ope.type == "deposit" %}Charge{% else %}Retrait{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endspaceless %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(window).scroll(function() {
|
||||
console.log($(this).scrollTop());
|
||||
if ($(window).width() >= 768 && $(this).scrollTop() > 72.6) {
|
||||
$('.col-content-left').css({'position':'fixed', 'top':'50px'});
|
||||
$('.col-content-right').addClass('col-sm-offset-4 col-md-offset-3');
|
||||
} else {
|
||||
$('.col-content-left').css({'position':'relative', 'top':'0'});
|
||||
$('.col-content-right').removeClass('col-sm-offset-4 col-md-offset-3');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -867,9 +867,8 @@ $(document).ready(function() {
|
|||
// -----
|
||||
|
||||
var history_container = $('#history');
|
||||
var history_operationgroup_html = '<div class="opegroup"></div>';
|
||||
var history_operationgroupgeneral_html = '<div class="general"><span class="at"></span><span class="trigramme"></span><span class="amount"></span></div>';
|
||||
var history_operation_html = '<div class="ope"><span class="amountukf"></span><span class="infos1"></span><span class="infos2"></span></div>';
|
||||
var history_operationgroup_html = '<div class="opegroup"><span class="time"></span><span class="trigramme"></span><span class="amount"></span></div>';
|
||||
var history_operation_html = '<div class="ope"><span class="amount"></span><span class="infos1"></span><span class="infos2"></span></div>';
|
||||
|
||||
function getOpeHtml(ope, is_cof=false, trigramme='') {
|
||||
var ope_html = $(history_operation_html);
|
||||
|
@ -893,7 +892,7 @@ $(document).ready(function() {
|
|||
|
||||
ope_html
|
||||
.attr('data-ope', ope['id'])
|
||||
.find('.amountukf').text(amountUKF).end()
|
||||
.find('.amount').text(amountUKF).end()
|
||||
.find('.infos1').text(infos1).end()
|
||||
.find('.infos2').text(infos2).end();
|
||||
|
||||
|
@ -903,8 +902,8 @@ $(document).ready(function() {
|
|||
return ope_html;
|
||||
}
|
||||
|
||||
function getOpegroupGeneralHtml(opegroup) {
|
||||
var opegroupgeneral_html = $(history_operationgroupgeneral_html);
|
||||
function getOpegroupHtml(opegroup) {
|
||||
var opegroup_html = $(history_operationgroup_html);
|
||||
var at = new Date(opegroup['at']);
|
||||
var at_hours = (at.getHours() < 10 ? '0' : '') + at.getHours();
|
||||
var at_minutes = (at.getMinutes() < 10 ? '0' : '') + at.getMinutes();
|
||||
|
@ -918,27 +917,27 @@ $(document).ready(function() {
|
|||
var amount = amountToUKF(amount, opegroup['is_cof']);
|
||||
}
|
||||
|
||||
opegroupgeneral_html
|
||||
.find('.at').text(at_formated).end()
|
||||
opegroup_html
|
||||
.attr('data-opegroup', opegroup['id'])
|
||||
.find('.time').text(at_formated).end()
|
||||
.find('.amount').text(amount).end()
|
||||
.find('.trigramme').text(trigramme).end();
|
||||
|
||||
return opegroupgeneral_html;
|
||||
return opegroup_html;
|
||||
}
|
||||
|
||||
function addOpeGroup(opegroup) {
|
||||
checkOrCreateDay(opegroup['at']);
|
||||
var opegroup_html = $(history_operationgroup_html);
|
||||
opegroup_html.attr('data-opegroup', opegroup['id']);
|
||||
// Ajout des infos générales sur le groupe d'opés
|
||||
opegroup_html.append(getOpegroupGeneralHtml(opegroup));
|
||||
var $opegroup_html = getOpegroupHtml(opegroup);
|
||||
history_container.find('.day').first().after($opegroup_html);
|
||||
|
||||
// Ajout des opérations de ce groupe
|
||||
var $opegroup = history_container.find('[data-opegroup='+opegroup['id']+']');
|
||||
for (var i=0; i < opegroup['opes'].length; i++) {
|
||||
opegroup_html.append(getOpeHtml(opegroup['opes'][i], opegroup['is_cof'], opegroup['on_acc__trigramme']));
|
||||
var $ope = getOpeHtml(opegroup['opes'][i], opegroup['is_cof'], opegroup['on_acc__trigramme']);
|
||||
$ope.attr('data-opegroup', opegroup['id']);
|
||||
$opegroup.after($ope);
|
||||
}
|
||||
// Ajout du groupe
|
||||
history_container.find('.day').first().after(opegroup_html);
|
||||
}
|
||||
|
||||
var history_day_default_html = '<div class="day"></div>';
|
||||
|
@ -979,16 +978,16 @@ $(document).ready(function() {
|
|||
// -----
|
||||
|
||||
history_container.selectable({
|
||||
filter: 'div.opegroup div.general, div.ope',
|
||||
filter: 'div.opegroup, div.ope',
|
||||
selected: function(e, ui) {
|
||||
$(ui.selected).each(function() {
|
||||
if ($(this).hasClass('general'))
|
||||
if ($(this).hasClass('opegroup'))
|
||||
$(this).siblings('.ope').addClass('ui-selected');
|
||||
});
|
||||
},
|
||||
unselected: function(e, ui) {
|
||||
$(ui.unselected).each(function() {
|
||||
if ($(this).hasClass('general'))
|
||||
if ($(this).hasClass('opegroup'))
|
||||
$(this).siblings('.ope').removeClass('ui-selected');
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue