recobro añadir candado #158 faltan los test de front

This commit is contained in:
Javi Gallego 2018-03-09 14:54:25 +01:00
parent c0fbfa458e
commit b260157171
3 changed files with 29 additions and 5 deletions

View File

@ -2,4 +2,5 @@ Since: Desde
Employee: Empleado
No results: Sin resultados
To: Hasta
Recovery: Recobros
Recovery: Recobros
Finish that recovery period: Terminar el recobro

View File

@ -4,7 +4,7 @@
<vn-vertical>
<vn-title>Recovery</vn-title>
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
<vn-column-header vn-one pad-medium-h field="started" text="Since" default-order="DESC"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="started" text="Since" default-order="ASC"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="finished" text="To"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="amount" text="Amount"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="period" text="Period"></vn-column-header>
@ -13,9 +13,15 @@
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="recovery in index.model.instances track by recovery.id">
ng-repeat="recovery in index.model.instances track by $index">
<vn-none pad-medium-h style="color:#FFA410;">
<i class="material-icons"
vn-tooltip="Finish that recovery period"
ng-if="!recovery.finished"
ng-click="$ctrl.setFinished(recovery)">lock</i>
</vn-none>
<vn-one pad-medium-h>{{::recovery.started | date:'dd/MM/yyyy' }}</vn-one>
<vn-one pad-medium-h>{{::recovery.finished | date:'dd/MM/yyyy' }}</vn-one>
<vn-one pad-medium-h>{{recovery.finished | date:'dd/MM/yyyy' }}</vn-one>
<vn-one pad-medium-h>{{::recovery.amount | currency:'€':0}}</vn-one>
<vn-one pad-medium-h>{{::recovery.period}}</vn-one>
</vn-horizontal>

View File

@ -1,7 +1,24 @@
import ngModule from '../module';
import FilterClientList from '../filter-client-list';
class ClientRecoveryList extends FilterClientList {
constructor($scope, $timeout, $state, $http) {
super($scope, $timeout, $state);
this.$http = $http;
}
setFinished(recovery) {
if (!recovery.finished) {
let params = {finished: Date.now()};
this.$http.patch(`/client/api/Recoveries/${recovery.id}`, params).then(
() => this.$.index.accept()
);
}
}
}
ClientRecoveryList.$inject = ['$scope', '$timeout', '$state', '$http'];
ngModule.component('vnClientRecoveryList', {
template: require('./recovery-list.html'),
controller: FilterClientList
controller: ClientRecoveryList
});