diff --git a/client/client/src/recovery-list/locale/es.yml b/client/client/src/recovery-list/locale/es.yml index a3413cb66..3ad385a5c 100644 --- a/client/client/src/recovery-list/locale/es.yml +++ b/client/client/src/recovery-list/locale/es.yml @@ -2,4 +2,5 @@ Since: Desde Employee: Empleado No results: Sin resultados To: Hasta -Recovery: Recobros \ No newline at end of file +Recovery: Recobros +Finish that recovery period: Terminar el recobro \ No newline at end of file diff --git a/client/client/src/recovery-list/recovery-list.html b/client/client/src/recovery-list/recovery-list.html index 77a31d5d3..4c2eff922 100644 --- a/client/client/src/recovery-list/recovery-list.html +++ b/client/client/src/recovery-list/recovery-list.html @@ -4,7 +4,7 @@ Recovery - + @@ -13,9 +13,15 @@ + ng-repeat="recovery in index.model.instances track by $index"> + + lock + {{::recovery.started | date:'dd/MM/yyyy' }} - {{::recovery.finished | date:'dd/MM/yyyy' }} + {{recovery.finished | date:'dd/MM/yyyy' }} {{::recovery.amount | currency:'€':0}} {{::recovery.period}} diff --git a/client/client/src/recovery-list/recovery-list.js b/client/client/src/recovery-list/recovery-list.js index 949dcbad1..5996f2d50 100644 --- a/client/client/src/recovery-list/recovery-list.js +++ b/client/client/src/recovery-list/recovery-list.js @@ -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 }); diff --git a/client/core/src/lib/crud.js b/client/core/src/lib/crud.js index 33c4c2091..c2f6f0de4 100644 --- a/client/core/src/lib/crud.js +++ b/client/core/src/lib/crud.js @@ -32,7 +32,7 @@ function put(mgPut) { } ngModule.factory('vnPut', put); -put.$inject = ['mgPatch']; +patch.$inject = ['mgPatch']; function patch(mgPatch) { return Object.assign({}, mgPatch, { success: 'vnSuccessFactoryCreate'