diff --git a/index.html b/index.html index 6121328..ddc1567 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@ - + diff --git a/src/js/controller.js b/src/js/controller.js index 973b37a..bf03fda 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -146,9 +146,9 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', return; } - // Se crearon comentarios en las restricciones de vendedor para las bases - // de datos que no poseen vendedor asignado a los clientes despues - // descomentar en (crear-nota-pedido, modal-nota-pedido, crear-remito y modal-remito) + // Se crearon comentarios en las restricciones de vendedor para las bases + // de datos que no poseen vendedor asignado a los clientes despues + // descomentar en (crear-nota-pedido, modal-nota-pedido, crear-remito y modal-remito) // if (!$scope.notaPedido.vendedor.id) { // focaModalService.alert('Este cliente no tiene vendedor asignado'); // return; @@ -222,19 +222,21 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', $scope.notaPedido.notaPedidoPuntoDescarga); } - var rutaJson = JSON.parse($localStorage.rutas); - - removeItemFromArr( rutaJson, 'venta-nota-pedido/crear' ); - $localStorage.rutas = JSON.stringify(rutaJson); - - var plazos = $scope.notaPedido.notaPedidoPlazo; - var plazosACrear = []; - plazos.forEach(function (plazo) { - plazosACrear.push({ - idNotaPedido: data.data.id, - dias: plazo.dias + var rutaJson; + if ($localStorage.rutas) { + rutaJson = JSON.parse($localStorage.rutas); + removeItemFromArr(rutaJson, 'venta-nota-pedido/crear'); + $localStorage.rutas = JSON.stringify(rutaJson); + } + + var plazos = $scope.notaPedido.notaPedidoPlazo; + var plazosACrear = []; + plazos.forEach(function (plazo) { + plazosACrear.push({ + idNotaPedido: data.data.id, + dias: plazo.dias + }); }); - }); if (plazosACrear.length) { crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear); @@ -517,9 +519,10 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', }; } }, + backdrop: false, size: 'lg' } - ); + ); modalInstance.result.then( function (cliente) { @@ -605,6 +608,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', idCliente: function () { return cliente.COD; }, esNuevo: function () { return cliente.esNuevo; } }, + backdrop: false, size: 'lg', } ); @@ -1114,11 +1118,11 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', } } - function removeItemFromArr ( arr, item ) { - var i = arr.indexOf( item ); - - if ( i !== -1 ) { - arr.splice( i, 1 ); + function removeItemFromArr(arr, item) { + var i = arr.indexOf(item); + + if (i !== -1) { + arr.splice(i, 1); } } @@ -1136,7 +1140,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', if (data) { $location.path('/'); var rutaJson = JSON.parse($localStorage.rutas); - removeItemFromArr( rutaJson, 'venta-nota-pedido/crear' ); + removeItemFromArr(rutaJson, 'venta-nota-pedido/crear'); $localStorage.rutas = JSON.stringify(rutaJson); } });