Improve type display

This commit is contained in:
Ludovic Stephan 2017-04-03 21:18:07 -03:00
parent a173be4f7d
commit 20b7156e1f

View file

@ -746,6 +746,19 @@ class SpecialOperation extends Operation {
return Operation.props.concat(['type', 'is_checkout']);
}
/**
* Verbose names for operation types
* @type {Object}
*/
static get verbose_types() {
return {
'deposit': 'Charge',
'withdraw': 'Retrait',
'edit': 'Édition',
'initial': 'Initial',
};
}
/**
* Default values for SpecialOperation model instances
* @default <tt>{@link Models.Operation.default_data|Operation.default_data} + {'type': '', 'is_checkout': false}
@ -1606,25 +1619,7 @@ class SpecialOpeFormatter extends OperationFormatter {
}
static prop_infos2(a) {
if (!a.is_checkout)
return 'Édition';
switch (a.type) {
case 'initial':
return 'Initial';
break;
case 'deposit':
return 'Charge';
break;
case 'withdraw':
return 'Retrait';
break;
default:
return '';
}
return SpecialOperation.verbose_types(a.type) || '' ;
}
}