credit refactor to build employee name and surname on client side
This commit is contained in:
parent
8e25216c3b
commit
b3ddeaf4a7
|
@ -2,7 +2,6 @@
|
||||||
<vn-card pad-medium>
|
<vn-card pad-medium>
|
||||||
<vn-vertical pad-large>
|
<vn-vertical pad-large>
|
||||||
<vn-title vn-one margin-large-bottom>Credit</vn-title>
|
<vn-title vn-one margin-large-bottom>Credit</vn-title>
|
||||||
|
|
||||||
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||||
<vn-column-header vn-one pad-medium-h field="amount" text="Credit"></vn-column-header>
|
<vn-column-header vn-one pad-medium-h field="amount" text="Credit"></vn-column-header>
|
||||||
<vn-column-header vn-two pad-medium-h field="created" text="Since" default-order="ASC"></vn-column-header>
|
<vn-column-header vn-two pad-medium-h field="created" text="Since" default-order="ASC"></vn-column-header>
|
||||||
|
@ -12,11 +11,10 @@
|
||||||
<vn-horizontal
|
<vn-horizontal
|
||||||
vn-one class="list list-element text-center"
|
vn-one class="list list-element text-center"
|
||||||
pad-small-bottom
|
pad-small-bottom
|
||||||
ng-repeat="credit in index.model.instances track by credit.id"
|
ng-repeat="credit in index.model.instances track by credit.id">
|
||||||
>
|
<vn-one pad-medium-h>{{::credit.amount | number:2}} €</vn-one>
|
||||||
<vn-one pad-medium-h>{{::credit.amount | number:2}} €</vn-one>
|
<vn-two pad-medium-h>{{::credit.created | date:'dd/MM/yyyy HH:mm' }}</vn-two>
|
||||||
<vn-two pad-medium-h>{{::credit.created | date:'dd/MM/yyyy HH:mm' }}</vn-two>
|
<vn-two pad-medium-h>{{::credit.employee.name}} {{::credit.employee.surname}}</vn-two>
|
||||||
<vn-two pad-medium-h>{{::credit.employee.name}}</vn-two>
|
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one class="text-center pad-small-v" ng-if="index.model.count === 0" translate>No results</vn-one>
|
<vn-one class="text-center pad-small-v" ng-if="index.model.count === 0" translate>No results</vn-one>
|
||||||
|
@ -25,5 +23,5 @@
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<a ui-sref="clientCard.credit.create" fixed-bottom-right>
|
<a ui-sref="clientCard.credit.create" fixed-bottom-right>
|
||||||
<vn-float-button icon="add"></vn-float-button>
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
</a>
|
</a>
|
|
@ -1,5 +1,5 @@
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
Self.installMethod('filter', filterParams, filterResults);
|
Self.installMethod('filter', filterParams);
|
||||||
|
|
||||||
function filterParams(params) {
|
function filterParams(params) {
|
||||||
return {
|
return {
|
||||||
|
@ -17,15 +17,4 @@ module.exports = function(Self) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterResults(instances) {
|
|
||||||
let result = JSON.parse(JSON.stringify(instances));
|
|
||||||
if (result && result.instances && result.instances.length) {
|
|
||||||
result.instances.forEach((element, i) => {
|
|
||||||
result.instances[i].employee.name = `${element.employee.name} ${element.employee.surname}`;
|
|
||||||
delete result.instances[i].employee.surname;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue