From 8039daa241d8e97af0d777ea8f25c9485e902205 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 7 Oct 2019 17:57:56 -0300 Subject: [PATCH] se elimina tarea pausada al guardar o salir --- src/js/controller.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/js/controller.js b/src/js/controller.js index c24eee8..98835eb 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -83,6 +83,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', articulosNotaPedido: [], notaPedidoPlazo: [], notaPedidoPuntoDescarga: [] + }; $scope.idLista = undefined; @@ -217,6 +218,18 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', $scope.notaPedido.notaPedidoPuntoDescarga); } + var ar = JSON.parse($localStorage.rutas); + function removeItemFromArr ( arr, item ) { + var i = arr.indexOf( item ); + + if ( i !== -1 ) { + arr.splice( i, 1 ); + } + } + + removeItemFromArr( ar, 'venta-nota-pedido/crear' ); + $localStorage.rutas = JSON.stringify(ar); + var plazos = $scope.notaPedido.notaPedidoPlazo; var plazosACrear = []; plazos.forEach(function (plazo) { @@ -1105,6 +1118,14 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', } } + function removeItemFromArr ( arr, item ) { + var i = arr.indexOf( item ); + + if ( i !== -1 ) { + arr.splice( i, 1 ); + } + } + function salir() { var confirmacion = false; @@ -1118,6 +1139,10 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', ).then(function (data) { if (data) { $location.path('/'); + var ar = JSON.parse($localStorage.rutas); + + removeItemFromArr( ar, 'venta-nota-pedido/crear' ); + $localStorage.rutas = JSON.stringify(ar); } }); } else { -- 1.9.1