Commit 8039daa241d8e97af0d777ea8f25c9485e902205

Authored by Benjamin Rodriguez
1 parent e154b067c3
Exists in develop

se elimina tarea pausada al guardar o salir

Showing 1 changed file with 25 additions and 0 deletions   Show diff stats
src/js/controller.js
... ... @@ -83,6 +83,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
83 83 articulosNotaPedido: [],
84 84 notaPedidoPlazo: [],
85 85 notaPedidoPuntoDescarga: []
  86 +
86 87 };
87 88 $scope.idLista = undefined;
88 89  
... ... @@ -217,6 +218,18 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
217 218 $scope.notaPedido.notaPedidoPuntoDescarga);
218 219 }
219 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);
  232 +
220 233 var plazos = $scope.notaPedido.notaPedidoPlazo;
221 234 var plazosACrear = [];
222 235 plazos.forEach(function (plazo) {
... ... @@ -1105,6 +1118,14 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
1105 1118 }
1106 1119 }
1107 1120  
  1121 + function removeItemFromArr ( arr, item ) {
  1122 + var i = arr.indexOf( item );
  1123 +
  1124 + if ( i !== -1 ) {
  1125 + arr.splice( i, 1 );
  1126 + }
  1127 + }
  1128 +
1108 1129 function salir() {
1109 1130 var confirmacion = false;
1110 1131  
... ... @@ -1118,6 +1139,10 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
1118 1139 ).then(function (data) {
1119 1140 if (data) {
1120 1141 $location.path('/');
  1142 + var ar = JSON.parse($localStorage.rutas);
  1143 +
  1144 + removeItemFromArr( ar, 'venta-nota-pedido/crear' );
  1145 + $localStorage.rutas = JSON.stringify(ar);
1121 1146 }
1122 1147 });
1123 1148 } else {