From d5e95f17941adcb9571ad9c1be79a677e069cdcf Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 30 Sep 2019 17:29:22 -0300 Subject: [PATCH] logita para botonera de pausa --- package.json | 1 + src/js/controller.js | 1 + src/js/service.js | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/package.json b/package.json index 4bb6b03..c7c1116 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Componente de botonera lateral", "main": "index.js", "scripts": { + "refresh": "gulp uglify && cp tmp/foca-botonera-lateral.js ../wrapper-demo/node_modules/foca-botonera-lateral/dist/foca-botonera-lateral.min.js", "test": "echo \"Error: no test specified\" && exit 1", "compile": "gulp uglify", "gulp-pre-commit": "gulp pre-commit", diff --git a/src/js/controller.js b/src/js/controller.js index 6a2a916..afe5ff3 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -10,6 +10,7 @@ angular.module('focaBotoneraLateral') $scope.pausar = function() { focaBotoneraLateralService.setLSItem(); + focaBotoneraLateralService.setLSRuta(); $location.path('/'); }; diff --git a/src/js/service.js b/src/js/service.js index 8255bfc..373f1c6 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -19,6 +19,11 @@ angular.module('focaBotoneraLateral') val: '' }; + this.rutasPausadas = { + label: 'rutas', + val: [] + }; + this.showTeclado = function(value) { this.botones.teclado = value; }; @@ -33,6 +38,19 @@ angular.module('focaBotoneraLateral') this.setPausarData = function(obj) { this.pausarData = obj; }; + this.setRutasPausadas = function(obj) { + var auxArray = []; + this.rutasPausadas.val.push(obj.val); + angular.forEach(this.rutasPausadas.val, function(ruta) { + var exists = false; + angular.forEach(auxArray, function(val2) { + if(angular.equals(ruta, val2)){ exists = true }; + }); + if(exists == false && ruta !== "") { auxArray.push(ruta); } + }); + + this.rutasPausadas.val = auxArray; + }; this.showCancelar = function(value, path) { this.botones.custom = []; this.botones.cancelar = value; @@ -61,4 +79,8 @@ angular.module('focaBotoneraLateral') this.setLSItem = function() { $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val); }; + + this.setLSRuta = function() { + $localStorage[this.rutasPausadas.label] = JSON.stringify(this.rutasPausadas.val); + }; }]); -- 1.9.1