Commit b41db83e39557a7a861b8f8c892adffcb376cd49

Authored by Martin Macola
Exists in master

merge conflicts

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