Commit 65544829ddee473c295d832fbef8e9cea4fc0288

Authored by Eric Fernandez
1 parent 435fa7d1da
Exists in master

desasociar remitos ya cargados

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', {
... ... @@ -59,6 +59,14 @@ angular.module(&#39;focaCrearHojaRuta&#39;)
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
... ... @@ -59,7 +59,7 @@
59 59 <td class="text-center col-auto">
60 60 <button
61 61 class="btn btn-outline-light"
62   - ng-click="quitarArticulo(key)"
  62 + ng-click="desasociarRemito(key, remito.id)"
63 63 >
64 64 <i class="fa fa-trash"></i>
65 65 </button>