Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Juan 2018-03-09 14:59:14 +01:00
commit 6cc6703002
4 changed files with 30 additions and 6 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
});

View File

@ -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'