use switch + move text

This commit is contained in:
Ludovic Stephan 2017-02-11 21:38:07 -02:00
parent db94a8904c
commit fc2de20ab8

View file

@ -15,18 +15,22 @@ function KHistory(options={}) {
var trigramme = opegroup['on_acc_trigramme']; var trigramme = opegroup['on_acc_trigramme'];
var is_cof = opegroup['is_cof']; var is_cof = opegroup['is_cof'];
if (opegroup['type'] == 'opegroup') { var type = opegroup['type']
for (var i=0; i<opegroup['opes'].length; i++) { switch (type) {
var $ope = this._opeHtml(opegroup['opes'][i], is_cof, trigramme); case 'opegroup':
$ope.data('opegroup', opegroup['id']); for (var i=0; i<opegroup['opes'].length; i++) {
$opegroup.after($ope); var $ope = this._opeHtml(opegroup['opes'][i], is_cof, trigramme);
} $ope.data('opegroup', opegroup['id']);
} else { $opegroup.after($ope);
for (var i=0; i<opegroup['opes'].length; i++) { }
var $transfer = this._transferHtml(opegroup['opes'][i]); break;
$transfer.data('transfergroup', opegroup['id']); case 'transfergroup':
$opegroup.after($transfer); for (var i=0; i<opegroup['opes'].length; i++) {
} var $transfer = this._transferHtml(opegroup['opes'][i]);
$transfer.data('transfergroup', opegroup['id']);
$opegroup.after($transfer);
}
break;
} }
} }
@ -104,15 +108,19 @@ function KHistory(options={}) {
var type = opegroup['type']; var type = opegroup['type'];
if (type == 'opegroup') { switch (type) {
var $opegroup_html = $(this.template_opegroup); case 'opegroup':
var trigramme = opegroup['on_acc__trigramme']; var $opegroup_html = $(this.template_opegroup);
var amount = amountDisplay( var trigramme = opegroup['on_acc__trigramme'];
parseFloat(opegroup['amount']), opegroup['is_cof'], trigramme); var amount = amountDisplay(
} else { parseFloat(opegroup['amount']), opegroup['is_cof'], trigramme);
var $opegroup_html = $(this.template_transfergroup); break;
var trigramme = ''; case 'transfergroup':
var amount = '' ; var $opegroup_html = $(this.template_transfergroup);
$opegroup_html.find('.infos').text('Transferts').end()
var trigramme = '';
var amount = '' ;
break;
} }
var at = dateUTCToParis(opegroup['at']).format('HH:mm:ss'); var at = dateUTCToParis(opegroup['at']).format('HH:mm:ss');
@ -123,7 +131,6 @@ function KHistory(options={}) {
.data('id', opegroup['id']) .data('id', opegroup['id'])
.find('.time').text(at).end() .find('.time').text(at).end()
.find('.trigramme').text(trigramme).end() .find('.trigramme').text(trigramme).end()
.find('.infos').text("Transferts").end()
.find('.amount').text(amount).end() .find('.amount').text(amount).end()
.find('.comment').text(comment).end(); .find('.comment').text(comment).end();