Commit cd41d64eb356a369f58762da9a31cffa23867cd4

Authored by Mauricio Cattafi
Exists in master and in 1 other branch develop

Merge branch 'develop' of git.focasoftware.com:mcattafi/foca-botonera-facturador into fix_acentos

1 { 1 {
2 "name": "foca-botonera-facturador", 2 "name": "foca-botonera-facturador",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "Componente de botonera en facturadores", 4 "description": "Componente de botonera en facturadores",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "frefresh": "gulp uglify && cp tmp/foca-botonera-facturador.js ../wrapper-facturador/node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js",
8 "refresh": "gulp uglify && cp tmp/foca-botonera-facturador.js ../wrapper-demo/node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js",
7 "test": "echo \"Error: no test specified\" && exit 1", 9 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 10 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit", 11 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install", 12 "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", 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 "frefresh": "gulp uglify && cp tmp/foca-botonera-facturador.js ../wrapper-facturador/node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js" 14 "frefresh": "gulp uglify && cp tmp/foca-botonera-facturador.js ../wrapper-facturador/node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js"
13 }, 15 },
14 "pre-commit": [ 16 "pre-commit": [
15 "gulp-pre-commit" 17 "gulp-pre-commit"
16 ], 18 ],
17 "repository": { 19 "repository": {
18 "type": "git", 20 "type": "git",
19 "url": "git+ssh://git@debonline.dyndns.org:npm/foca-botonera-facturador.git" 21 "url": "git+ssh://git@debonline.dyndns.org:npm/foca-botonera-facturador.git"
20 }, 22 },
21 "author": "Foca Software", 23 "author": "Foca Software",
22 "license": "ISC", 24 "license": "ISC",
23 "peerDependencies": { 25 "peerDependencies": {
24 "angular": "^1.7.x", 26 "angular": "^1.7.x",
25 "bootstrap": "^4.1.x", 27 "bootstrap": "^4.1.x",
26 "jquery": "^3.3.x", 28 "jquery": "^3.3.x",
27 "font-awesome": "^4.7.x", 29 "font-awesome": "^4.7.x",
28 "gulp": "^3.9.x", 30 "gulp": "^3.9.x",
29 "gulp-concat": "2.6.x", 31 "gulp-concat": "2.6.x",
30 "gulp-jshint": "^2.1.x", 32 "gulp-jshint": "^2.1.x",
31 "gulp-rename": "^1.4.x", 33 "gulp-rename": "^1.4.x",
32 "gulp-replace": "^1.0.x", 34 "gulp-replace": "^1.0.x",
33 "gulp-uglify-es": "^1.0.x", 35 "gulp-uglify-es": "^1.0.x",
34 "jshint": "^2.9.x", 36 "jshint": "^2.9.x",
35 "pump": "^3.0.x" 37 "pump": "^3.0.x"
36 }, 38 },
37 "devDependencies": { 39 "devDependencies": {
38 "angular": "^1.7.6", 40 "angular": "^1.7.6",
39 "angular-route": "^1.7.5", 41 "angular-route": "^1.7.5",
40 "angular-sanitize": "^1.7.6", 42 "angular-sanitize": "^1.7.6",
41 "bootstrap": "^4.2.1", 43 "bootstrap": "^4.2.1",
42 "font-awesome": "^4.7.0", 44 "font-awesome": "^4.7.0",
43 "gulp": "^3.9.1", 45 "gulp": "^3.9.1",
44 "gulp-angular-templatecache": "^2.2.6", 46 "gulp-angular-templatecache": "^2.2.6",
45 "gulp-clean": "^0.4.0", 47 "gulp-clean": "^0.4.0",
46 "gulp-concat": "^2.6.1", 48 "gulp-concat": "^2.6.1",
47 "gulp-connect": "^5.7.0", 49 "gulp-connect": "^5.7.0",
48 "gulp-htmlmin": "^5.0.1", 50 "gulp-htmlmin": "^5.0.1",
49 "gulp-jshint": "^2.1.0", 51 "gulp-jshint": "^2.1.0",
50 "gulp-rename": "^1.4.0", 52 "gulp-rename": "^1.4.0",
51 "gulp-replace": "^1.0.0", 53 "gulp-replace": "^1.0.0",
52 "gulp-sass": "^4.0.2", 54 "gulp-sass": "^4.0.2",
53 "gulp-uglify-es": "^1.0.4", 55 "gulp-uglify-es": "^1.0.4",
54 "jasmine-core": "^3.3.0", 56 "jasmine-core": "^3.3.0",
55 "jquery": "^3.3.1", 57 "jquery": "^3.3.1",
56 "jshint": "^2.9.7", 58 "jshint": "^2.9.7",
57 "pre-commit": "^1.2.2", 59 "pre-commit": "^1.2.2",
58 "pump": "^3.0.0" 60 "pump": "^3.0.0"
59 } 61 }
60 } 62 }
61 63
1 angular.module('focaBotoneraFacturador', []) 1 angular.module('focaBotoneraFacturador', [])
2 .component('focaBotoneraFacturador', { 2 .component('focaBotoneraFacturador', {
3 templateUrl: 'src/views/botonera-facturador.html', 3 templateUrl: 'src/views/botonera-facturador.html',
4 controller: 'focaBotoneraFacturadorController', 4 controller: 'focaBotoneraFacturadorController',
5 bindings: { 5 bindings: {
6 max: '<', 6 max: '<',
7 botones: '<' 7 botones: '<'
8 } 8 }
9 })
10 .component('focaBotoneraFormaPago', {
11 templateUrl: 'src/views/botonera-forma-pago.html',
12 controller: 'focaBotoneraTarjetasController',
13 bindings: {
14 botones: '<',
15 max: '<'
16 }
17 })
18 .component('focaBotoneraTarjetas', {
19 templateUrl: 'src/views/botonera-tarjetas.html',
20 controller: 'focaBotoneraTarjetasController',
21 bindings: {
22 botones: '<',
23 max: '<'
24 }
25 })
26 .component('focaBotoneraProductos', {
27 templateUrl: 'src/views/botonera-productos.html',
28 controller: 'focaBotoneraTarjetasController',
29 bindings: {
30 botones: '<',
31 max: '<'
32 }
9 }); 33 });
10 34
src/js/controllerTarjetas.js
File was created 1 angular.module('focaBotoneraFacturador')
2 .controller('focaBotoneraTarjetasController', [
3 '$scope',
4 '$window',
5 'APP',
6 function ($scope, $window, APP) {
7 this.$onInit = function () {
8 $scope.botones = $scope.$ctrl.botones;
9 //TODO: controlar que no se estiren los botones
10 if (APP) return;
11 var max = ($scope.$ctrl.max) ? $scope.$ctrl.max : 12;
12 if ($window.innerWidth > 576) {
13 while (($scope.botones.length % max) !== 0) {
14 $scope.botones.push('');
15 }
16 } else {
17 while (($scope.botones.length % 4) !== 0) {
18 $scope.botones.push('');
19 }
20 }
21 };
22
23 function nombreFuncion(string) {
24 var texto = 'seleccionar';
25 var arr = string.split(' ');
26 arr.forEach(function (palabra) {
27 palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1);
28 texto += palabra;
29 });
30 return texto;
31 }
32
33 $scope.ejecutarFuncion = function (boton) {
34 $scope.$parent[nombreFuncion(boton.label)](boton);
35 };
36
37 $scope.activarBoton = function (boton) {
38 $scope.botones.forEach(function (boton) {
39 boton.active = false;
40 });
41 boton.active = true;
42 };
43 }]);
44
src/views/botonera-forma-pago.html
File was created 1 <div
2 class="col-6 col-sm-3 py-2"
3 ng-repeat="boton in botones track by $index"
4 ng-class="{'d-md-grid': boton == ''}">
5 <button
6 type="button"
7 class="btn btn-block btn-xs text-center rounded border border-light foca-overflow-hidden"
8 ng-disabled="boton.disabled"
9 ng-click="
10 (boton != '') ? ejecutarFuncion(boton) : null;
11 activarBoton(boton);"
12 >
13 <img ng-src="./img/{{boton.image}}" alt="">
14 <span>{{ boton.label }}</span>
15 </button>
16 </div>
17
src/views/botonera-productos.html
File was created 1 <div
2 class="col-6 col-sm-3 p-2"
3 ng-repeat="boton in botones track by $index"
4 ng-class="{'d-md-grid': boton == ''}">
5 <button
6 type="button"
7 class="btn btn-block rounded border border-light p-0"
8 ng-click="(boton != '') ? ejecutarFuncion(boton) : null;"
9 ng-class="{'btn-producto' : boton.image, 'btn-producto-default' : !boton.image}"
10 >
11 <img ng-src="./img/{{boton.image || boton.imageDefault}}" alt="">
12 <label ng-if="!boton.image" ng-bind="boton.label"></label>
13 </button>
14 </div>
15
src/views/botonera-tarjetas.html
File was created 1 <div
2 class="col-4 col-lg-2 px-1 pb-3"
3 ng-repeat="boton in botones track by $index"
4 ng-class="{'d-md-grid': boton == ''}">
5 <button
6 type="button"
7 class="btn btn-block btn-tarjeta rounded border p-1"
8 ng-click="
9 (boton != '') ? ejecutarFuncion(boton) : null;
10 activarBoton(boton);"
11 ng-class="
12 {
13 'd-sm-block h-100': boton == '',
14 'border-light': !boton.active,
15 'border-warning': boton.active
16 }"
17 ng-disabled="boton.disable"
18 >
19 <img ng-src="./img/{{boton.image || boton.imageDefault}}" alt="">
20 <label ng-if="!boton.image" ng-bind="boton.nombre"></label>
21 </button>
22 </div>
23