Commit 65544829ddee473c295d832fbef8e9cea4fc0288
1 parent
435fa7d1da
Exists in
master
and in
1 other branch
desasociar remitos ya cargados
Showing
3 changed files
with
23 additions
and
1 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -322,6 +322,20 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
| 322 | 322 | }); |
| 323 | 323 | }; |
| 324 | 324 | |
| 325 | + $scope.desasociarRemito = function(key, idRemito) { | |
| 326 | + var idsRemito = [idRemito]; | |
| 327 | + focaModalService.confirm('¿Está seguro que desea desasociar este remito del' + | |
| 328 | + ' vehículo?').then(function() { | |
| 329 | + focaCrearHojaRutaService.desasociarRemitos(idsRemito, | |
| 330 | + $scope.hojaRuta.vehiculo.id, $scope.remitosTabla.length <= 1).then( | |
| 331 | + function() { | |
| 332 | + $scope.remitosTabla.splice(key, 1); | |
| 333 | + focaModalService.alert('Remitos desasociados con éxito'); | |
| 334 | + } | |
| 335 | + ); | |
| 336 | + }); | |
| 337 | + }; | |
| 338 | + | |
| 325 | 339 | function elegirFecha() { |
| 326 | 340 | focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { |
| 327 | 341 | $scope.$broadcast('addCabecera', { |
src/js/service.js
| ... | ... | @@ -59,6 +59,14 @@ angular.module('focaCrearHojaRuta') |
| 59 | 59 | return $http.get(route + '/vehiculo/obtener/remitos/' + |
| 60 | 60 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10)); |
| 61 | 61 | }, |
| 62 | + desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) { | |
| 63 | + return $http.post(route + '/vehiculo/desasociar-remitos', | |
| 64 | + { | |
| 65 | + idsRemitos: idsRemitos, | |
| 66 | + idVehiculo: idVehiculo, | |
| 67 | + vehiculoSinRemitos: sinRemitos | |
| 68 | + }); | |
| 69 | + }, | |
| 62 | 70 | getBotonera: function() { |
| 63 | 71 | return [ |
| 64 | 72 | { |
src/views/hoja-ruta.html