Compare View

switch
from
...
to
 
Commits (11)
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 "frefresh": "gulp uglify && cp tmp/foca-botonera-principal.js ../wrapper-facturador/node_modules/foca-botonera-principal/dist/foca-botonera-principal.min.js",
8 "refresh": "gulp uglify && cp tmp/foca-botonera-lateral.js ../wrapper-demo/node_modules/foca-botonera-lateral/dist/foca-botonera-lateral.min.js",
7 "refresh": "gulp uglify && cp tmp/foca-botonera-lateral.js ../wrapper-demo/node_modules/foca-botonera-lateral/dist/foca-botonera-lateral.min.js", 9 "test": "echo \"Error: no test specified\" && exit 1",
8 "frefresh": "gulp uglify && cp tmp/foca-botonera-lateral.js ../wrapper-facturador/node_modules/foca-botonera-lateral/dist/foca-botonera-lateral.min.js", 10 "compile": "gulp uglify",
9 "test": "echo \"Error: no test specified\" && exit 1", 11 "gulp-pre-commit": "gulp pre-commit",
10 "compile": "gulp uglify", 12 "postinstall": "npm run compile && gulp clean-post-install",
11 "gulp-pre-commit": "gulp pre-commit", 13 "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 "postinstall": "npm run compile && gulp clean-post-install", 14 },
13 "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" 15 "pre-commit": [
14 }, 16 "gulp-pre-commit"
15 "pre-commit": [ 17 ],
16 "gulp-pre-commit" 18 "repository": {
17 ], 19 "type": "git",
18 "repository": { 20 "url": "git+ssh://git@debonline.dyndns.org:npm/foca-botonera-lateral.git"
19 "type": "git", 21 },
20 "url": "git+ssh://git@debonline.dyndns.org:npm/foca-botonera-lateral.git" 22 "author": "Foca Software",
21 }, 23 "license": "ISC",
22 "author": "Foca Software", 24 "peerDependencies": {
23 "license": "ISC", 25 "angular": "^1.7.x",
24 "peerDependencies": { 26 "bootstrap": "^4.1.x",
25 "angular": "^1.7.x", 27 "jquery": "^3.3.x",
26 "bootstrap": "^4.1.x", 28 "font-awesome": "^4.7.x",
27 "jquery": "^3.3.x", 29 "gulp": "^3.9.x",
28 "font-awesome": "^4.7.x", 30 "gulp-concat": "2.6.x",
29 "gulp": "^3.9.x", 31 "gulp-jshint": "^2.1.x",
30 "gulp-concat": "2.6.x", 32 "gulp-rename": "^1.4.x",
31 "gulp-jshint": "^2.1.x", 33 "gulp-replace": "^1.0.x",
32 "gulp-rename": "^1.4.x", 34 "gulp-uglify-es": "^1.0.x",
33 "gulp-replace": "^1.0.x", 35 "jshint": "^2.9.x",
34 "gulp-uglify-es": "^1.0.x", 36 "pump": "^3.0.x"
35 "jshint": "^2.9.x", 37 },
36 "pump": "^3.0.x" 38 "devDependencies": {
37 }, 39 "angular": "1.7.5",
38 "devDependencies": { 40 "angular-route": "^1.7.5",
39 "angular": "1.7.5", 41 "angular-sanitize": "1.7.5",
40 "angular-route": "^1.7.5", 42 "bootstrap": "4.1.3",
41 "angular-sanitize": "1.7.5", 43 "font-awesome": "4.7.0",
42 "bootstrap": "4.1.3", 44 "gulp": "3.9.1",
43 "font-awesome": "4.7.0", 45 "gulp-angular-templatecache": "2.2.5",
44 "gulp": "3.9.1", 46 "gulp-clean": "0.4.0",
45 "gulp-angular-templatecache": "2.2.5", 47 "gulp-concat": "2.6.1",
46 "gulp-clean": "0.4.0", 48 "gulp-connect": "5.6.1",
47 "gulp-concat": "2.6.1", 49 "gulp-htmlmin": "5.0.1",
48 "gulp-connect": "5.6.1", 50 "gulp-jshint": "2.1.0",
49 "gulp-htmlmin": "5.0.1", 51 "gulp-rename": "1.4.0",
50 "gulp-jshint": "2.1.0", 52 "gulp-replace": "1.0.0",
51 "gulp-rename": "1.4.0", 53 "gulp-sass": "4.0.2",
52 "gulp-replace": "1.0.0", 54 "gulp-uglify-es": "1.0.4",
53 "gulp-sass": "4.0.2", 55 "jasmine-core": "3.3.0",
54 "gulp-uglify-es": "1.0.4", 56 "jquery": "3.3.1",
55 "jasmine-core": "3.3.0", 57 "jshint": "2.9.6",
56 "jquery": "3.3.1", 58 "pre-commit": "1.2.2",
57 "jshint": "2.9.6", 59 "pump": "3.0.0"
60 },
61 "dependencies": {
62 "node-sass": "^4.12.0"
58 "pre-commit": "1.2.2", 63 }
59 "pump": "3.0.0" 64 }
60 }, 65
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 pagar: false,
11 pagar: false, 12 guardando: false,
12 guardando: false, 13 funcionGuardar: undefined,
13 funcionGuardar: undefined, 14 pathCancelar: undefined,
14 pathCancelar: undefined, 15 custom: []
15 custom: [] 16 };
17 this.botones = {
18 teclado: true,
19 salir: false,
20 cancelar: false,
21 pausar: false,
22 guardar: false,
23 guardando: false,
24 funcionGuardar: undefined,
25 pathCancelar: undefined,
26 custom: []
27 };
16 }; 28
17 29 this.pausarData = {
18 this.pausarData = { 30 label: '',
19 label: '', 31 val: ''
20 val: '' 32 };
21 }; 33
22 34 this.showTeclado = function(value) {
23 this.showTeclado = function(value) { 35 this.botones.teclado = value;
24 this.botones.teclado = value; 36 };
25 }; 37 this.showSalir = function(value) {
26 this.showSalir = function(value) { 38 this.botones.custom = [];
27 this.botones.custom = []; 39 this.botones.salir = value;
28 this.botones.salir = value; 40 };
29 }; 41 this.showPausar = function(value) {
30 this.showPausar = function(value) { 42 this.botones.custom = [];
31 this.botones.custom = []; 43 this.botones.pausar = value;
32 this.botones.pausar = value; 44 };
33 }; 45 this.setPausarData = function(obj) {
34 this.setPausarData = function(obj) { 46 this.pausarData = obj;
35 this.pausarData = obj; 47 };
36 }; 48 this.showCancelar = function(value, path) {
37 this.showCancelar = function(value, path) { 49 this.botones.custom = [];
38 this.botones.custom = []; 50 this.botones.cancelar = value;
39 this.botones.cancelar = value; 51 this.botones.pathCancelar = (path) ? path : undefined;
40 this.botones.pathCancelar = (path) ? path : undefined; 52 };
41 }; 53 this.showGuardar = function(value, funcion) {
42 this.showGuardar = function(value, funcion) { 54 angular.element('#guardar').removeClass('guardado');
43 angular.element('#guardar').removeClass('guardado'); 55 this.botones.custom = [];
44 this.botones.custom = []; 56 this.botones.guardar = value;
45 this.botones.guardar = value; 57 if (value) this.botones.funcionGuardar = funcion;
46 if (value) this.botones.funcionGuardar = funcion; 58 };
59 this.showPagar = function(value, funcion) {
60 angular.element('#pagar').removeClass('guardado');
61 this.botones.custom = [];
62 this.botones.pagar = value;
63 if (value) this.botones.funcionGuardar = funcion;
64 };
47 }; 65 this.addCustomButton = function(title, funcion) {
48 this.showPagar = function(value, funcion) { 66 this.botones.custom.push({
49 angular.element('#pagar').removeClass('guardado'); 67 title: title,
50 this.botones.custom = []; 68 funcion: funcion
51 this.botones.pagar = value; 69 });
52 if (value) this.botones.funcionGuardar = funcion; 70 };
53 }; 71 this.startGuardar = function() {
54 this.addCustomButton = function(title, funcion) { 72 this.botones.guardando = true;
55 this.botones.custom.push({ 73 };
56 title: title, 74 this.endGuardar = function(guardado) {
57 funcion: funcion 75 this.botones.guardando = false;
58 }); 76 if (guardado) angular.element('#guardar').addClass('guardado');
59 }; 77 };
78 this.rutasPausadas = {
79 label: 'rutas',
80 val: []
81 };
60 this.startGuardar = function() { 82
61 this.botones.guardando = true; 83 this.showTeclado = function (value) {
62 }; 84 this.botones.teclado = value;
63 this.endGuardar = function(guardado) { 85 };
64 this.botones.guardando = false; 86 this.showSalir = function (value) {
87 this.botones.custom = [];
88 this.botones.salir = value;
89 };
90 this.showPausar = function (value) {
91 this.botones.custom = [];
92 this.botones.pausar = value;
93 };
94 this.setPausarData = function (obj) {
95 this.pausarData = obj;
96 };
97 this.setRutasPausadas = function (obj) {
98 var auxArray = [];
99 this.rutasPausadas.val.push(obj.val);
100 angular.forEach(this.rutasPausadas.val, function (ruta) {
101 var exists = false;
102 angular.forEach(auxArray, function (val2) {
103 if (angular.equals(ruta, val2)) { exists = true };
104 });
105 if (exists == false && ruta !== "") { auxArray.push(ruta); }
106 });
107
108 this.rutasPausadas.val = auxArray;
109 };
110 this.showCancelar = function (value, path) {
111 this.botones.custom = [];
112 this.botones.cancelar = value;
113 this.botones.pathCancelar = (path) ? path : undefined;
114 };
115 this.showGuardar = function (value, funcion) {
116 angular.element('#guardar').removeClass('guardado');
117 this.botones.custom = [];
118 this.botones.guardar = value;
119 if (value) this.botones.funcionGuardar = funcion;
120 };
121 this.addCustomButton = function (title, funcion) {
122 this.botones.custom.push({
123 title: title,
124 funcion: funcion
125 });
126 };
127 this.startGuardar = function () {
128 this.botones.guardando = true;
129 };
130 this.endGuardar = function (guardado) {
131 this.botones.guardando = false;
132 if (guardado) angular.element('#guardar').addClass('guardado');
133 };
134
135 this.setLSItem = function () {
136 $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val);
137 };
138
139 this.setLSRuta = function () {
140 $localStorage[this.rutasPausadas.label] = JSON.stringify(this.rutasPausadas.val);
141 };
142 }]);
65 if (guardado) angular.element('#guardar').addClass('guardado'); 143
src/views/botonera-lateral.html
1 <div class="container botonera-lateral"> 1 <div class="container botonera-lateral">
2 <div class="row"> 2 <div class="row">
3 <div class="col-auto my-2 col-2 offset-10 d-none d-md-flex" style="min-height: 176px"> 3 <div class="col-auto my-2 col-2 offset-10 d-none d-lg-flex" style="min-height: 176px">
4 <div class="px-2 mt-auto"> 4 <div class="px-2 mt-auto">
5 <div class="container"> 5 <div class="container">
6 <div class="row"> 6 <div class="row">
7 <div 7 <div
8 ladda="botones.guardando" 8 ladda="botones.guardando"
9 data-spinner-size="30" 9 data-spinner-size="30"
10 data-spinner-color="#000000" 10 data-spinner-color="#000000"
11 class="border rounded" 11 class="border rounded"
12 ng-show="botones.pagar"
13 >
14 <button
15 id="pagar"
16 ng-click="botones.funcionGuardar()"
17 ng-disabled="botones.guardando"
18 type="button"
19 title="Pagar"
20 class="btn btn-block">
21 <strong>PAGAR</strong>
22 </button>
23 </div>
24 <div
25 ladda="botones.guardando"
26 data-spinner-size="30"
27 data-spinner-color="#000000"
28 class="border rounded"
29 ng-show="botones.guardar"
12 ng-show="botones.pagar" 30 >
13 > 31 <button
14 <button 32 id="guardar"
15 id="pagar" 33 ng-click="botones.funcionGuardar()"
16 ng-click="botones.funcionGuardar()"
17 ng-disabled="botones.guardando" 34 ng-disabled="botones.guardando"
18 type="button" 35 type="button"
19 title="Pagar" 36 title="Guardar"
20 class="btn btn-block"> 37 class="btn btn-block">
21 <strong>PAGAR</strong> 38 <strong>GUARDAR</strong>
22 </button> 39 </button>
23 </div> 40 </div>
24 <div 41 <button
25 ladda="botones.guardando" 42 ng-click="pausar()"
26 data-spinner-size="30" 43 ng-show="botones.pausar"
27 data-spinner-color="#000000" 44 type="button"
28 class="border rounded" 45 title="Pausar"
29 ng-show="botones.guardar" 46 class="btn btn-block mt-2 border">
30 > 47 <strong>PAUSAR</strong>
31 <button 48 </button>
32 id="guardar" 49 <button
33 ng-click="botones.funcionGuardar()" 50 ng-click="cancelar()"
34 ng-disabled="botones.guardando" 51 ng-show="botones.cancelar"
35 type="button" 52 type="button"
36 title="Guardar" 53 title="Cancelar"
37 class="btn btn-block"> 54 class="btn btn-block mt-2 border border-dark">
38 <strong>GUARDAR</strong> 55 <strong>CANCELAR</strong>
39 </button> 56 </button>
40 </div> 57 <button
41 <button 58 ng-click="salir()"
42 ng-click="pausar()" 59 ng-show="botones.salir"
43 ng-show="botones.pausar" 60 type="button"
44 type="button" 61 title="Salir"
45 title="Pausar" 62 class="btn btn-block mt-2 border">
46 class="btn btn-block mt-2 border"> 63 <strong>SALIR</strong>
47 <strong>PAUSAR</strong> 64 </button>
48 </button> 65 <button
49 <button 66 ng-repeat="boton in botones.custom"
50 ng-click="cancelar()" 67 ng-click="boton.funcion()"
51 ng-show="botones.cancelar" 68 type="button"
52 type="button" 69 title="{{boton.title}}"
53 title="Cancelar" 70 class="btn btn-block mt-2 border">
54 class="btn btn-block mt-2 border border-dark"> 71 <strong
55 <strong>CANCELAR</strong> 72 class="text-uppercase"
56 </button> 73 ng-bind="boton.title">
57 <button 74 </strong>
58 ng-click="salir()" 75 </button>
59 ng-show="botones.salir" 76 </div>
60 type="button" 77 </div>
61 title="Salir" 78 </div>
62 class="btn btn-block mt-2 border"> 79 </div>
63 <strong>SALIR</strong> 80 </div>
64 </button> 81 </div>
65 <button 82 <div class="container botonera-lateral teclado" ng-show="botones.teclado">
66 ng-repeat="boton in botones.custom" 83 <div class="row">
67 ng-click="boton.funcion()" 84 <div class="col-auto my-2 col-2 offset-10 d-none d-lg-flex" style="min-height: 176px">
68 type="button" 85 <div class="px-2 mt-auto">
69 title="{{boton.title}}" 86 <div class="container">
70 class="btn btn-block mt-2 border"> 87 <div class="row">
71 <strong 88 <div
72 class="text-uppercase" 89 class="btn-group-toggle btn btn-block mt-2 border"
73 ng-bind="boton.title"> 90 data-toggle="buttons"
74 </strong> 91 ng-click="cambioUsoTeclado()"
75 </button> 92 title="Activar/desactivar teclado">
76 </div> 93 <label
77 </div> 94 class=" active boton-activar-teclado mb-0"
78 </div> 95 ng-class="{'teclado-activar': usarTeclado}">
79 </div> 96 <input
80 </div> 97 type="checkbox"
81 </div> 98 autocomplete="off"
82 <div class="container botonera-lateral teclado" ng-show="botones.teclado"> 99 >
83 <div class="row"> 100 <strong>TECLADO</strong>
84 <div class="col-auto my-2 col-2 offset-10 d-none d-md-flex" style="min-height: 176px"> 101 </label>
85 <div class="px-2 mt-auto"> 102 </div>
86 <div class="container"> 103 </div>
87 <div class="row"> 104 </div>
88 <div 105 </div>
89 class="btn-group-toggle btn btn-block mt-2 border" 106 </div>
90 data-toggle="buttons" 107 </div>
91 ng-click="cambioUsoTeclado()" 108 </div>