Commit a3f97a9777c9409ecb15a2fbd10c0bd72ace64fb

Authored by Benjamin Rodriguez
1 parent 8039daa241
Exists in develop

cambio nombre variable

Showing 1 changed file with 7 additions and 15 deletions   Show diff stats
src/js/controller.js
... ... @@ -218,17 +218,10 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
218 218 $scope.notaPedido.notaPedidoPuntoDescarga);
219 219 }
220 220  
221   - var ar = JSON.parse($localStorage.rutas);
222   - function removeItemFromArr ( arr, item ) {
223   - var i = arr.indexOf( item );
224   -
225   - if ( i !== -1 ) {
226   - arr.splice( i, 1 );
227   - }
228   - }
229   -
230   - removeItemFromArr( ar, 'venta-nota-pedido/crear' );
231   - $localStorage.rutas = JSON.stringify(ar);
  221 + var rutaJson = JSON.parse($localStorage.rutas);
  222 +
  223 + removeItemFromArr( rutaJson, 'venta-nota-pedido/crear' );
  224 + $localStorage.rutas = JSON.stringify(rutaJson);
232 225  
233 226 var plazos = $scope.notaPedido.notaPedidoPlazo;
234 227 var plazosACrear = [];
... ... @@ -1139,10 +1132,9 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
1139 1132 ).then(function (data) {
1140 1133 if (data) {
1141 1134 $location.path('/');
1142   - var ar = JSON.parse($localStorage.rutas);
1143   -
1144   - removeItemFromArr( ar, 'venta-nota-pedido/crear' );
1145   - $localStorage.rutas = JSON.stringify(ar);
  1135 + var rutaJson = JSON.parse($localStorage.rutas);
  1136 + removeItemFromArr( rutaJson, 'venta-nota-pedido/crear' );
  1137 + $localStorage.rutas = JSON.stringify(rutaJson);
1146 1138 }
1147 1139 });
1148 1140 } else {