add transfer information

This commit is contained in:
Ludovic Stephan 2016-12-09 00:26:25 -02:00
parent ac0356386a
commit 36edc334d4

View file

@ -22,6 +22,7 @@ function KHistory(options={}) {
$opegroup.after($ope);
}
} else {
$opegroup.addClass("transfergroup");
for (var i=0; i<opegroup['opes'].length; i++) {
var $transfer = this._transferHtml(opegroup['opes'][i]);
$transfer.data('transfergroup', opegroup['id']);
@ -74,8 +75,8 @@ function KHistory(options={}) {
$transfer_html
.data('transfer', transfer['id'])
.find('.amount').text(amount).end()
.find('.from_acc').text(transfer['from_acc']).end()
.find('.to_acc').text(transfer['to_acc']).end();
.find('.infos1').text(transfer['from_acc']).end()
.find('.infos2').text(transfer['to_acc']).end();
return $transfer_html ;
@ -95,21 +96,31 @@ function KHistory(options={}) {
}
this._opeGroupHtml = function(opegroup) {
var $opegroup_html = $(this.template_opegroup);
var at = dateUTCToParis(opegroup['at']).format('HH:mm:ss');
var type = opegroup['type'];
if (type == 'opegroup') {
var $opegroup_html = $(this.template_opegroup);
var trigramme = opegroup['on_acc__trigramme'];
var amount = amountDisplay(
parseFloat(opegroup['amount']), opegroup['is_cof'], trigramme);
amount = opegroup['type'] == 'opegroup' ? amount : '' ;
} else {
var $opegroup_html = $(this.template_transfergroup);
var trigramme = '';
var amount = '' ;
}
var at = dateUTCToParis(opegroup['at']).format('HH:mm:ss');
var comment = opegroup['comment'] || '';
$opegroup_html
.data('opegroup', opegroup['id'])
.data(type, opegroup['id'])
.find('.time').text(at).end()
.find('.trigramme').text(trigramme).end()
.find('.info').text("Transferts").end()
.find('.amount').text(amount).end()
.find('.comment').text(comment).end()
.find('.trigramme').text(trigramme).end();
.find('.comment').text(comment).end();
if (!this.display_trigramme)
$opegroup_html.find('.trigramme').remove();
@ -158,7 +169,8 @@ KHistory.default_options = {
container: '#history',
template_day: '<div class="day"></div>',
template_opegroup: '<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>',
template_transfergroup: '<div class="opegroup"><span class="time"></span><span class="info"></span><span class="valid_by"></span><span class="comment"></span></div>',
template_ope: '<div class="ope"><span class="amount"></span><span class="infos1"></span><span class="infos2"></span><span class="addcost"></span><span class="canceled"></span></div>',
template_transfer: '<div class="ope transfer"><span class="amount"></span><span class="from_acc"></span><span class="glyphicon glyphicon-arrow-right"></span><span class="to_acc"></span></div>',
template_transfer: '<div class="ope"><span class="amount"></span><span class="infos1"></span><span class="glyphicon glyphicon-arrow-right"></span><span class="infos2"></span></div>',
display_trigramme: true,
}