Affichage des commentaires d'un groupe d'opés dans les historiques

This commit is contained in:
Aurélien Delobelle 2016-08-23 16:22:19 +02:00
parent 9e66137c09
commit 4048c007ea
4 changed files with 14 additions and 3 deletions

View file

@ -23,6 +23,7 @@
color:#fff;
font-weight:bold;
padding-left:20px;
overflow:auto;
}
#history .opegroup .time {
@ -43,6 +44,10 @@
padding-left:20px
}
#history .opegroup .comment {
padding-left:20px;
}
#history .ope {
position:relative;
height:25px;

View file

@ -51,6 +51,9 @@
{% if perms.kfet.is_team %}
<span class="valid_by">Par {{ ope.group.valid_by.trigramme }}</span>
{% endif %}
{% if ope.group.comment %}
<span class="comment">{{ ope.group.comment }}</span>
{% endif %}
</div>
{% endifchanged %}
<div class="ope {% if ope.canceled_at %}canceled{% endif %}" data-ope="{{ ope.pk }}" data-opegroup="{{ ope.group.pk }}">

View file

@ -980,7 +980,7 @@ $(document).ready(function() {
// -----
var history_container = $('#history');
var history_operationgroup_html = '<div class="opegroup"><span class="time"></span><span class="trigramme"></span><span class="amount"></span><span class="valid_by"></span></div>';
var history_operationgroup_html = '<div class="opegroup"><span class="time"></span><span class="trigramme"></span><span class="amount"></span><span class="valid_by"></span><span class="comment"></span></div>';
var history_operation_html = '<div class="ope"><span class="amount"></span><span class="infos1"></span><span class="infos2"></span><span class="addcost"></span><span class="canceled"></span></div>';
function getOpeHtml(ope, is_cof=false, trigramme='') {
@ -1040,13 +1040,15 @@ $(document).ready(function() {
var valid_by = '';
if (opegroup['valid_by__trigramme'])
valid_by = 'Par '+opegroup['valid_by__trigramme'];
var comment = opegroup['comment'] || '';
opegroup_html
.attr('data-opegroup', opegroup['id'])
.find('.time').text(at_formated).end()
.find('.amount').text(amount).end()
.find('.trigramme').text(trigramme).end()
.find('.valid_by').text(valid_by).end();
.find('.valid_by').text(valid_by).end()
.find('.comment').text(comment).end();
return opegroup_html;
}

View file

@ -794,6 +794,7 @@ def kpsul_perform_operations(request):
'checkout__name': operationgroup.checkout.name,
'at': operationgroup.at,
'is_cof': operationgroup.is_cof,
'comment': operationgroup.comment,
'valid_by__trigramme': ( operationgroup.valid_by and
operationgroup.valid_by.trigramme or None),
'on_acc__trigramme': operationgroup.on_acc.trigramme,
@ -987,7 +988,7 @@ def kpsul_cancel_operations(request):
def kpsul_history(request):
opegroups_list = (OperationGroup.objects
.values(
'id', 'amount', 'at', 'checkout_id', 'is_cof',
'id', 'amount', 'at', 'checkout_id', 'is_cof', 'comment',
'valid_by__trigramme', 'on_acc__trigramme')
.select_related('valid_by', 'on_acc')
.filter(at__gt=timezone.now()-timedelta(hours=24)))