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