Commit d5e95f17941adcb9571ad9c1be79a677e069cdcf

Authored by Benjamin Rodriguez
1 parent 8698e4c7ca
Exists in master

logita para botonera de pausa

1 { 1 {
2 "name": "foca-botonera-lateral", 2 "name": "foca-botonera-lateral",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "Componente de botonera lateral", 4 "description": "Componente de botonera lateral",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "refresh": "gulp uglify && cp tmp/foca-botonera-lateral.js ../wrapper-demo/node_modules/foca-botonera-lateral/dist/foca-botonera-lateral.min.js",
7 "test": "echo \"Error: no test specified\" && exit 1", 8 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 9 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit", 10 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install", 11 "postinstall": "npm run compile && gulp clean-post-install",
11 "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-clean gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es jasmine-core jquery jshint pre-commit pump && npm install angular-sanitize" 12 "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-clean gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es jasmine-core jquery jshint pre-commit pump && npm install angular-sanitize"
12 }, 13 },
13 "pre-commit": [ 14 "pre-commit": [
14 "gulp-pre-commit" 15 "gulp-pre-commit"
15 ], 16 ],
16 "repository": { 17 "repository": {
17 "type": "git", 18 "type": "git",
18 "url": "git+ssh://git@debonline.dyndns.org:npm/foca-botonera-lateral.git" 19 "url": "git+ssh://git@debonline.dyndns.org:npm/foca-botonera-lateral.git"
19 }, 20 },
20 "author": "Foca Software", 21 "author": "Foca Software",
21 "license": "ISC", 22 "license": "ISC",
22 "peerDependencies": { 23 "peerDependencies": {
23 "angular": "^1.7.x", 24 "angular": "^1.7.x",
24 "bootstrap": "^4.1.x", 25 "bootstrap": "^4.1.x",
25 "jquery": "^3.3.x", 26 "jquery": "^3.3.x",
26 "font-awesome": "^4.7.x", 27 "font-awesome": "^4.7.x",
27 "gulp": "^3.9.x", 28 "gulp": "^3.9.x",
28 "gulp-concat": "2.6.x", 29 "gulp-concat": "2.6.x",
29 "gulp-jshint": "^2.1.x", 30 "gulp-jshint": "^2.1.x",
30 "gulp-rename": "^1.4.x", 31 "gulp-rename": "^1.4.x",
31 "gulp-replace": "^1.0.x", 32 "gulp-replace": "^1.0.x",
32 "gulp-uglify-es": "^1.0.x", 33 "gulp-uglify-es": "^1.0.x",
33 "jshint": "^2.9.x", 34 "jshint": "^2.9.x",
34 "pump": "^3.0.x" 35 "pump": "^3.0.x"
35 }, 36 },
36 "devDependencies": { 37 "devDependencies": {
37 "angular": "1.7.5", 38 "angular": "1.7.5",
38 "angular-route": "^1.7.5", 39 "angular-route": "^1.7.5",
39 "angular-sanitize": "1.7.5", 40 "angular-sanitize": "1.7.5",
40 "bootstrap": "4.1.3", 41 "bootstrap": "4.1.3",
41 "font-awesome": "4.7.0", 42 "font-awesome": "4.7.0",
42 "gulp": "3.9.1", 43 "gulp": "3.9.1",
43 "gulp-angular-templatecache": "2.2.5", 44 "gulp-angular-templatecache": "2.2.5",
44 "gulp-clean": "0.4.0", 45 "gulp-clean": "0.4.0",
45 "gulp-concat": "2.6.1", 46 "gulp-concat": "2.6.1",
46 "gulp-connect": "5.6.1", 47 "gulp-connect": "5.6.1",
47 "gulp-htmlmin": "5.0.1", 48 "gulp-htmlmin": "5.0.1",
48 "gulp-jshint": "2.1.0", 49 "gulp-jshint": "2.1.0",
49 "gulp-rename": "1.4.0", 50 "gulp-rename": "1.4.0",
50 "gulp-replace": "1.0.0", 51 "gulp-replace": "1.0.0",
51 "gulp-sass": "4.0.2", 52 "gulp-sass": "4.0.2",
52 "gulp-uglify-es": "1.0.4", 53 "gulp-uglify-es": "1.0.4",
53 "jasmine-core": "3.3.0", 54 "jasmine-core": "3.3.0",
54 "jquery": "3.3.1", 55 "jquery": "3.3.1",
55 "jshint": "2.9.6", 56 "jshint": "2.9.6",
56 "pre-commit": "1.2.2", 57 "pre-commit": "1.2.2",
57 "pump": "3.0.0" 58 "pump": "3.0.0"
58 } 59 }
59 } 60 }
60 61
src/js/controller.js
1 angular.module('focaBotoneraLateral') 1 angular.module('focaBotoneraLateral')
2 .controller('focaBotoneraLateralController', [ 2 .controller('focaBotoneraLateralController', [
3 '$scope', 3 '$scope',
4 '$location', 4 '$location',
5 '$window', 5 '$window',
6 'focaBotoneraLateralService', 6 'focaBotoneraLateralService',
7 function($scope, $location, $window, focaBotoneraLateralService) { 7 function($scope, $location, $window, focaBotoneraLateralService) {
8 8
9 $scope.botones = focaBotoneraLateralService.botones; 9 $scope.botones = focaBotoneraLateralService.botones;
10 10
11 $scope.pausar = function() { 11 $scope.pausar = function() {
12 focaBotoneraLateralService.setLSItem(); 12 focaBotoneraLateralService.setLSItem();
13 focaBotoneraLateralService.setLSRuta();
13 $location.path('/'); 14 $location.path('/');
14 }; 15 };
15 16
16 $scope.cambioUsoTeclado = function() { 17 $scope.cambioUsoTeclado = function() {
17 $scope.$parent.cambioUsoTeclado(); 18 $scope.$parent.cambioUsoTeclado();
18 }; 19 };
19 20
20 $scope.salir = function() { 21 $scope.salir = function() {
21 $location.path('/'); 22 $location.path('/');
22 }; 23 };
23 24
24 $scope.cancelar = function() { 25 $scope.cancelar = function() {
25 if ($scope.botones.pathCancelar) { 26 if ($scope.botones.pathCancelar) {
26 $location.path($scope.botones.pathCancelar); 27 $location.path($scope.botones.pathCancelar);
27 } else { 28 } else {
28 $window.history.back(); 29 $window.history.back();
29 } 30 }
30 }; 31 };
31 }]); 32 }]);
32 33
1 angular.module('focaBotoneraLateral') 1 angular.module('focaBotoneraLateral')
2 .service('focaBotoneraLateralService', ['$localStorage', 2 .service('focaBotoneraLateralService', ['$localStorage',
3 function($localStorage) { 3 function($localStorage) {
4 4
5 this.botones = { 5 this.botones = {
6 teclado: true, 6 teclado: true,
7 salir: false, 7 salir: false,
8 cancelar: false, 8 cancelar: false,
9 pausar: false, 9 pausar: false,
10 guardar: false, 10 guardar: false,
11 guardando: false, 11 guardando: false,
12 funcionGuardar: undefined, 12 funcionGuardar: undefined,
13 pathCancelar: undefined, 13 pathCancelar: undefined,
14 custom: [] 14 custom: []
15 }; 15 };
16 16
17 this.pausarData = { 17 this.pausarData = {
18 label: '', 18 label: '',
19 val: '' 19 val: ''
20 }; 20 };
21 21
22 this.rutasPausadas = {
23 label: 'rutas',
24 val: []
25 };
26
22 this.showTeclado = function(value) { 27 this.showTeclado = function(value) {
23 this.botones.teclado = value; 28 this.botones.teclado = value;
24 }; 29 };
25 this.showSalir = function(value) { 30 this.showSalir = function(value) {
26 this.botones.custom = []; 31 this.botones.custom = [];
27 this.botones.salir = value; 32 this.botones.salir = value;
28 }; 33 };
29 this.showPausar = function(value) { 34 this.showPausar = function(value) {
30 this.botones.custom = []; 35 this.botones.custom = [];
31 this.botones.pausar = value; 36 this.botones.pausar = value;
32 }; 37 };
33 this.setPausarData = function(obj) { 38 this.setPausarData = function(obj) {
34 this.pausarData = obj; 39 this.pausarData = obj;
35 }; 40 };
41 this.setRutasPausadas = function(obj) {
42 var auxArray = [];
43 this.rutasPausadas.val.push(obj.val);
44 angular.forEach(this.rutasPausadas.val, function(ruta) {
45 var exists = false;
46 angular.forEach(auxArray, function(val2) {
47 if(angular.equals(ruta, val2)){ exists = true };
48 });
49 if(exists == false && ruta !== "") { auxArray.push(ruta); }
50 });
51
52 this.rutasPausadas.val = auxArray;
53 };
36 this.showCancelar = function(value, path) { 54 this.showCancelar = function(value, path) {
37 this.botones.custom = []; 55 this.botones.custom = [];
38 this.botones.cancelar = value; 56 this.botones.cancelar = value;
39 this.botones.pathCancelar = (path) ? path : undefined; 57 this.botones.pathCancelar = (path) ? path : undefined;
40 }; 58 };
41 this.showGuardar = function(value, funcion) { 59 this.showGuardar = function(value, funcion) {
42 angular.element('#guardar').removeClass('guardado'); 60 angular.element('#guardar').removeClass('guardado');
43 this.botones.custom = []; 61 this.botones.custom = [];
44 this.botones.guardar = value; 62 this.botones.guardar = value;
45 if (value) this.botones.funcionGuardar = funcion; 63 if (value) this.botones.funcionGuardar = funcion;
46 }; 64 };
47 this.addCustomButton = function(title, funcion) { 65 this.addCustomButton = function(title, funcion) {
48 this.botones.custom.push({ 66 this.botones.custom.push({
49 title: title, 67 title: title,
50 funcion: funcion 68 funcion: funcion
51 }); 69 });
52 }; 70 };
53 this.startGuardar = function() { 71 this.startGuardar = function() {
54 this.botones.guardando = true; 72 this.botones.guardando = true;
55 }; 73 };
56 this.endGuardar = function(guardado) { 74 this.endGuardar = function(guardado) {
57 this.botones.guardando = false; 75 this.botones.guardando = false;
58 if (guardado) angular.element('#guardar').addClass('guardado'); 76 if (guardado) angular.element('#guardar').addClass('guardado');
59 }; 77 };
60 78
61 this.setLSItem = function() { 79 this.setLSItem = function() {
62 $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val); 80 $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val);
63 }; 81 };
82
83 this.setLSRuta = function() {
84 $localStorage[this.rutasPausadas.label] = JSON.stringify(this.rutasPausadas.val);
85 };
64 }]); 86 }]);
65 87