Compare View

switch
from
...
to
 
Commits (11)
... ... @@ -4,6 +4,8 @@
4 4 "description": "Componente de botonera lateral",
5 5 "main": "index.js",
6 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 9 "test": "echo \"Error: no test specified\" && exit 1",
8 10 "compile": "gulp uglify",
9 11 "gulp-pre-commit": "gulp pre-commit",
... ... @@ -55,5 +57,8 @@
55 57 "jshint": "2.9.6",
56 58 "pre-commit": "1.2.2",
57 59 "pump": "3.0.0"
  60 + },
  61 + "dependencies": {
  62 + "node-sass": "^4.12.0"
58 63 }
59 64 }
src/js/controller.js
... ... @@ -4,28 +4,29 @@ angular.module('focaBotoneraLateral')
4 4 '$location',
5 5 '$window',
6 6 'focaBotoneraLateralService',
7   - function($scope, $location, $window, focaBotoneraLateralService) {
  7 + function ($scope, $location, $window, focaBotoneraLateralService) {
8 8  
9 9 $scope.botones = focaBotoneraLateralService.botones;
10 10  
11   - $scope.pausar = function() {
  11 + $scope.pausar = function () {
12 12 focaBotoneraLateralService.setLSItem();
  13 + focaBotoneraLateralService.setLSRuta();
13 14 $location.path('/');
14 15 };
15 16  
16   - $scope.cambioUsoTeclado = function() {
  17 + $scope.cambioUsoTeclado = function () {
17 18 $scope.$parent.cambioUsoTeclado();
18 19 };
19 20  
20   - $scope.salir = function() {
  21 + $scope.salir = function () {
21 22 $location.path('/');
22 23 };
23 24  
24   - $scope.cancelar = function() {
  25 + $scope.cancelar = function () {
25 26 if ($scope.botones.pathCancelar) {
26 27 $location.path($scope.botones.pathCancelar);
27 28 } else {
28 29 $window.history.back();
29 30 }
30 31 };
31   - }]);
  32 + }]);
1 1 angular.module('focaBotoneraLateral')
2 2 .service('focaBotoneraLateralService', ['$localStorage',
3   - function($localStorage) {
  3 + function ($localStorage) {
4 4  
5 5 this.botones = {
6 6 teclado: true,
... ... @@ -8,16 +8,28 @@ angular.module('focaBotoneraLateral')
8 8 cancelar: false,
9 9 pausar: false,
10 10 guardar: false,
  11 + pagar: false,
11 12 guardando: false,
12 13 funcionGuardar: undefined,
13 14 pathCancelar: undefined,
14 15 custom: []
15 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   - this.pausarData = {
18   - label: '',
19   - val: ''
20   - };
  29 + this.pausarData = {
  30 + label: '',
  31 + val: ''
  32 + };
21 33  
22 34 this.showTeclado = function(value) {
23 35 this.botones.teclado = value;
... ... @@ -44,6 +56,12 @@ angular.module('focaBotoneraLateral')
44 56 this.botones.guardar = value;
45 57 if (value) this.botones.funcionGuardar = funcion;
46 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 66 this.botones.custom.push({
49 67 title: title,
... ... @@ -57,8 +75,68 @@ angular.module('focaBotoneraLateral')
57 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 82  
61   - this.setLSItem = function() {
62   - $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val);
63   - };
64   - }]);
  83 + this.showTeclado = function (value) {
  84 + this.botones.teclado = value;
  85 + };
  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 + }]);
src/views/botonera-lateral.html
1 1 <div class="container botonera-lateral">
2 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 4 <div class="px-2 mt-auto">
5 5 <div class="container">
6 6 <div class="row">
... ... @@ -8,12 +8,29 @@
8 8 ladda="botones.guardando"
9 9 data-spinner-size="30"
10 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 31 <button
14 32 id="guardar"
15 33 ng-click="botones.funcionGuardar()"
16   - ng-show="botones.guardar"
17 34 ng-disabled="botones.guardando"
18 35 type="button"
19 36 title="Guardar"
... ... @@ -26,7 +43,7 @@
26 43 ng-show="botones.pausar"
27 44 type="button"
28 45 title="Pausar"
29   - class="btn btn-block border">
  46 + class="btn btn-block mt-2 border">
30 47 <strong>PAUSAR</strong>
31 48 </button>
32 49 <button
... ... @@ -34,7 +51,7 @@
34 51 ng-show="botones.cancelar"
35 52 type="button"
36 53 title="Cancelar"
37   - class="btn btn-block border border-dark">
  54 + class="btn btn-block mt-2 border border-dark">
38 55 <strong>CANCELAR</strong>
39 56 </button>
40 57 <button
... ... @@ -42,7 +59,7 @@
42 59 ng-show="botones.salir"
43 60 type="button"
44 61 title="Salir"
45   - class="btn btn-block border">
  62 + class="btn btn-block mt-2 border">
46 63 <strong>SALIR</strong>
47 64 </button>
48 65 <button
... ... @@ -50,7 +67,7 @@
50 67 ng-click="boton.funcion()"
51 68 type="button"
52 69 title="{{boton.title}}"
53   - class="btn btn-block border">
  70 + class="btn btn-block mt-2 border">
54 71 <strong
55 72 class="text-uppercase"
56 73 ng-bind="boton.title">
... ... @@ -64,12 +81,12 @@
64 81 </div>
65 82 <div class="container botonera-lateral teclado" ng-show="botones.teclado">
66 83 <div class="row">
67   - <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">
68 85 <div class="px-2 mt-auto">
69 86 <div class="container">
70 87 <div class="row">
71 88 <div
72   - class="btn-group-toggle btn btn-block border"
  89 + class="btn-group-toggle btn btn-block mt-2 border"
73 90 data-toggle="buttons"
74 91 ng-click="cambioUsoTeclado()"
75 92 title="Activar/desactivar teclado">