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 is_cof = opegroup['is_cof'];
if (opegroup['type'] == 'opegroup') {
for (var i=0; i<opegroup['opes'].length; i++) {
var $ope = this._opeHtml(opegroup['opes'][i], is_cof, trigramme);
$ope.data('opegroup', opegroup['id']);
$opegroup.after($ope);
}
} else {
for (var i=0; i<opegroup['opes'].length; i++) {
var $transfer = this._transferHtml(opegroup['opes'][i]);
$transfer.data('transfergroup', opegroup['id']);
$opegroup.after($transfer);
}
var type = opegroup['type']
switch (type) {
case 'opegroup':
for (var i=0; i<opegroup['opes'].length; i++) {
var $ope = this._opeHtml(opegroup['opes'][i], is_cof, trigramme);
$ope.data('opegroup', opegroup['id']);
$opegroup.after($ope);
}
break;
case 'transfergroup':
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'];
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);
} else {
var $opegroup_html = $(this.template_transfergroup);
var trigramme = '';
var amount = '' ;
switch (type) {
case 'opegroup':
var $opegroup_html = $(this.template_opegroup);
var trigramme = opegroup['on_acc__trigramme'];
var amount = amountDisplay(
parseFloat(opegroup['amount']), opegroup['is_cof'], trigramme);
break;
case 'transfergroup':
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');
@ -123,7 +131,6 @@ function KHistory(options={}) {
.data('id', opegroup['id'])
.find('.time').text(at).end()
.find('.trigramme').text(trigramme).end()
.find('.infos').text("Transferts").end()
.find('.amount').text(amount).end()
.find('.comment').text(comment).end();