Commit 99dd25f66b64dc35b776cd73b230515d75c93457
1 parent
aed323a955
Exists in
master
función eliminar remitos de hoja ruta
Showing
1 changed file
with
23 additions
and
0 deletions
Show diff stats
src/js/controllerHojaRuta.js
... | ... | @@ -63,4 +63,27 @@ angular.module('focaLogisticaPedidoRuta') |
63 | 63 | } |
64 | 64 | ); |
65 | 65 | }; |
66 | + $scope.eliminarRemitos = function() { | |
67 | + var remitosDel = $filter('filter')($scope.remitos, {checked: true}); | |
68 | + focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?') | |
69 | + .then(function() { | |
70 | + eliminarRemitos(remitosDel); | |
71 | + } | |
72 | + ); | |
73 | + function eliminarRemitos(remitosDel) { | |
74 | + var nuevosRemitos = $filter('filter')($scope.remitos, {checked: !true}); | |
75 | + focaLogisticaPedidoRutaService.desasociarRemitos(remitosDel, $scope.vehiculo.id, | |
76 | + nuevosRemitos ? true : false).then(function() { | |
77 | + alertaEliminados(); | |
78 | + $scope.remitos = nuevosRemitos; | |
79 | + }); | |
80 | + } | |
81 | + function alertaEliminados() { | |
82 | + focaModalService.alert('Remitos desasociados con éxito'); | |
83 | + } | |
84 | + }; | |
85 | + $scope.minimoUnoChecked = function() { | |
86 | + var remitosChequeados = $filter('filter')($scope.remitos, {checked: true}); | |
87 | + return !remitosChequeados.length; | |
88 | + }; | |
66 | 89 | }]); |