Commit 54166f231f2411a92cb6d0d9f805a278d344bead

Authored by Eric Fernandez
Exists in develop

Merge branch 'master' into 'develop'

Master(mpuebla)

See merge request !17
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 "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", 8 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 9 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit", 10 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install", 11 "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" 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"
12 }, 13 },
13 "pre-commit": [ 14 "pre-commit": [
14 "gulp-pre-commit" 15 "gulp-pre-commit"
15 ], 16 ],
16 "repository": { 17 "repository": {
17 "type": "git", 18 "type": "git",
18 "url": "git+ssh://git@debonline.dyndns.org:npm/foca-botonera-facturador.git" 19 "url": "git+ssh://git@debonline.dyndns.org:npm/foca-botonera-facturador.git"
19 }, 20 },
20 "author": "Foca Software", 21 "author": "Foca Software",
21 "license": "ISC", 22 "license": "ISC",
22 "peerDependencies": { 23 "peerDependencies": {
23 "angular": "^1.7.x", 24 "angular": "^1.7.x",
24 "bootstrap": "^4.1.x", 25 "bootstrap": "^4.1.x",
25 "jquery": "^3.3.x", 26 "jquery": "^3.3.x",
26 "font-awesome": "^4.7.x", 27 "font-awesome": "^4.7.x",
27 "gulp": "^3.9.x", 28 "gulp": "^3.9.x",
28 "gulp-concat": "2.6.x", 29 "gulp-concat": "2.6.x",
29 "gulp-jshint": "^2.1.x", 30 "gulp-jshint": "^2.1.x",
30 "gulp-rename": "^1.4.x", 31 "gulp-rename": "^1.4.x",
31 "gulp-replace": "^1.0.x", 32 "gulp-replace": "^1.0.x",
32 "gulp-uglify-es": "^1.0.x", 33 "gulp-uglify-es": "^1.0.x",
33 "jshint": "^2.9.x", 34 "jshint": "^2.9.x",
34 "pump": "^3.0.x" 35 "pump": "^3.0.x"
35 }, 36 },
36 "devDependencies": { 37 "devDependencies": {
37 "angular": "^1.7.6", 38 "angular": "^1.7.6",
38 "angular-route": "^1.7.5", 39 "angular-route": "^1.7.5",
39 "angular-sanitize": "^1.7.6", 40 "angular-sanitize": "^1.7.6",
40 "bootstrap": "^4.2.1", 41 "bootstrap": "^4.2.1",
41 "font-awesome": "^4.7.0", 42 "font-awesome": "^4.7.0",
42 "gulp": "^3.9.1", 43 "gulp": "^3.9.1",
43 "gulp-angular-templatecache": "^2.2.6", 44 "gulp-angular-templatecache": "^2.2.6",
44 "gulp-clean": "^0.4.0", 45 "gulp-clean": "^0.4.0",
45 "gulp-concat": "^2.6.1", 46 "gulp-concat": "^2.6.1",
46 "gulp-connect": "^5.7.0", 47 "gulp-connect": "^5.7.0",
47 "gulp-htmlmin": "^5.0.1", 48 "gulp-htmlmin": "^5.0.1",
48 "gulp-jshint": "^2.1.0", 49 "gulp-jshint": "^2.1.0",
49 "gulp-rename": "^1.4.0", 50 "gulp-rename": "^1.4.0",
50 "gulp-replace": "^1.0.0", 51 "gulp-replace": "^1.0.0",
51 "gulp-sass": "^4.0.2", 52 "gulp-sass": "^4.0.2",
52 "gulp-uglify-es": "^1.0.4", 53 "gulp-uglify-es": "^1.0.4",
53 "jasmine-core": "^3.3.0", 54 "jasmine-core": "^3.3.0",
54 "jquery": "^3.3.1", 55 "jquery": "^3.3.1",
55 "jshint": "^2.9.7", 56 "jshint": "^2.9.7",
56 "pre-commit": "^1.2.2", 57 "pre-commit": "^1.2.2",
57 "pump": "^3.0.0" 58 "pump": "^3.0.0"
58 } 59 }
59 } 60 }
60 61
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 }
9 }); 25 });
10 26
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 (nombre) {
34 $scope.$parent[nombreFuncion(nombre)]();
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-lg-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.label) : 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-tarjetas.html
File was created 1 <div
2 class="col-4 col-lg-2 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.label) : 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}}" alt="">
20 </button>
21 </div>
22