Commit 4a26a5c449037358d46f6876b509b96e08d1d1cf
Exists in
master
arreglos para mejor funcionamiento en mobile
Showing
7 changed files
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const concat = require('gulp-concat'); | 2 | const concat = require('gulp-concat'); |
3 | const htmlmin = require('gulp-htmlmin'); | 3 | const htmlmin = require('gulp-htmlmin'); |
4 | const rename = require('gulp-rename'); | 4 | const rename = require('gulp-rename'); |
5 | const uglify = require('gulp-uglify'); | 5 | const uglify = require('gulp-uglify'); |
6 | const gulp = require('gulp'); | 6 | const gulp = require('gulp'); |
7 | const pump = require('pump'); | 7 | const pump = require('pump'); |
8 | const jshint = require('gulp-jshint'); | 8 | const jshint = require('gulp-jshint'); |
9 | const replace = require('gulp-replace'); | 9 | const replace = require('gulp-replace'); |
10 | const connect = require('gulp-connect'); | 10 | const connect = require('gulp-connect'); |
11 | const clean = require('gulp-clean'); | ||
11 | 12 | ||
12 | var paths = { | 13 | var paths = { |
13 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
14 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
15 | tmp: 'tmp', | 16 | tmp: 'tmp', |
16 | dist: 'dist/' | 17 | dist: 'dist/' |
17 | }; | 18 | }; |
18 | 19 | ||
19 | gulp.task('templates', function() { | 20 | gulp.task('templates', function() { |
20 | return pump( | 21 | return pump( |
21 | [ | 22 | [ |
22 | gulp.src(paths.srcViews), | 23 | gulp.src(paths.srcViews), |
23 | replace('views/', ''), | 24 | replace('views/', ''), |
24 | htmlmin(), | 25 | htmlmin(), |
25 | templateCache('views.js', { | 26 | templateCache('views.js', { |
26 | module: 'focaModalVendedores', | 27 | module: 'focaModalVendedores', |
27 | root: '' | 28 | root: '' |
28 | }), | 29 | }), |
29 | gulp.dest(paths.tmp) | 30 | gulp.dest(paths.tmp) |
30 | ] | 31 | ] |
31 | ); | 32 | ); |
32 | }); | 33 | }); |
33 | 34 | ||
34 | gulp.task('uglify', ['templates'], function() { | 35 | gulp.task('uglify', ['templates'], function() { |
35 | return pump( | 36 | return pump( |
36 | [ | 37 | [ |
37 | gulp.src([ | 38 | gulp.src([ |
38 | paths.srcJS, | 39 | paths.srcJS, |
39 | 'tmp/views.js' | 40 | 'tmp/views.js' |
40 | ]), | 41 | ]), |
41 | concat('foca-modal-vendedores.js'), | 42 | concat('foca-modal-vendedores.js'), |
43 | replace('src/views/', ''), | ||
44 | replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'), | ||
42 | gulp.dest(paths.tmp), | 45 | gulp.dest(paths.tmp), |
43 | rename('foca-modal-vendedores.min.js'), | 46 | rename('foca-modal-vendedores.min.js'), |
44 | uglify(), | 47 | uglify(), |
45 | gulp.dest(paths.dist) | 48 | gulp.dest(paths.dist) |
46 | ] | 49 | ] |
47 | ); | 50 | ); |
48 | }); | 51 | }); |
49 | 52 | ||
50 | gulp.task('pre-commit', function() { | 53 | gulp.task('pre-commit', function() { |
51 | return pump( | 54 | return pump( |
52 | [ | 55 | [ |
53 | gulp.src(paths.srcJS), | 56 | gulp.src(paths.srcJS), |
54 | jshint('.jshintrc'), | 57 | jshint('.jshintrc'), |
55 | jshint.reporter('default'), | 58 | jshint.reporter('default'), |
56 | jshint.reporter('fail') | 59 | jshint.reporter('fail') |
57 | ] | 60 | ] |
58 | ); | 61 | ); |
59 | 62 | ||
60 | gulp.start('uglify'); | 63 | gulp.start('uglify'); |
61 | }); | 64 | }); |
62 | 65 | ||
63 | gulp.task('webserver', function() { | 66 | gulp.task('webserver', function() { |
64 | pump [ | 67 | pump [ |
65 | connect.server({port: 3000}) | 68 | connect.server({port: 3000}) |
66 | ] | 69 | ] |
67 | }); | 70 | }); |
68 | 71 | ||
69 | gulp.task('default', ['webserver']); | ||
72 | gulp.task('clean-post-install', function(){ | ||
73 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | ||
74 | 'index.html'], {read: false}) | ||
75 | .pipe(clean()); | ||
76 | }); | ||
77 | |||
78 | gulp.task('default', ['webserver']); | ||
79 | |||
80 | gulp.task('watch', function() { | ||
81 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) | ||
82 | }); |
index.html
1 | <html ng-app="focaModalVendedores"> | 1 | <html ng-app="focaModalVendedores"> |
2 | 2 | ||
3 | <head> | 3 | <head> |
4 | <meta charset="UTF-8" /> | 4 | <meta charset="UTF-8" /> |
5 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | 5 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
6 | 6 | ||
7 | <!--CSS--> | 7 | <!--CSS--> |
8 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> | 8 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> |
9 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> | 9 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> |
10 | <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet"> | ||
10 | 11 | ||
11 | <!--VENDOR JS--> | 12 | <!--VENDOR JS--> |
12 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | 13 | <script src="node_modules/jquery/dist/jquery.min.js"></script> |
13 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | 14 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> |
14 | <script src="node_modules/angular/angular.min.js"></script> | 15 | <script src="node_modules/angular/angular.min.js"></script> |
15 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | 16 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> |
16 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | 17 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> |
18 | <script src="node_modules/ladda/dist/spin.min.js"></script> | ||
19 | <script src="node_modules/ladda/dist/ladda.min.js"></script> | ||
20 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> | ||
17 | 21 | ||
18 | <!-- BUILD --> | 22 | <!-- BUILD --> |
19 | <script src="src/js/app.js"></script> | 23 | <script src="src/js/app.js"></script> |
20 | <script src="src/js/controller.js"></script> | 24 | <script src="src/js/controller.js"></script> |
21 | <script src="src/js/service.js"></script> | 25 | <script src="src/js/service.js"></script> |
22 | 26 | ||
23 | <!-- /BUILD --> | 27 | <!-- /BUILD --> |
24 | 28 | ||
25 | <!-- CONFIG PARA DEVELOP --> | 29 | <!-- CONFIG PARA DEVELOP --> |
26 | <script type="text/javascript"> | 30 | <script type="text/javascript"> |
27 | angular.module('focaModalVendedores') | 31 | angular.module('focaModalVendedores') |
28 | .controller('controller', ['$uibModal', '$timeout', function($uibModal, $timeout) { | 32 | .controller('controller', ['$uibModal', '$timeout', function($uibModal, $timeout) { |
29 | openModal(); | 33 | openModal(); |
30 | 34 | ||
31 | function openModal() { | 35 | function openModal() { |
32 | var modalInstance = $uibModal.open( | 36 | var modalInstance = $uibModal.open( |
33 | { | 37 | { |
34 | ariaLabelledBy: 'Busqueda de Vendedores', | 38 | ariaLabelledBy: 'Busqueda de Vendedores', |
35 | templateUrl: 'src/views/modal-vendedores.html', | 39 | templateUrl: 'src/views/modal-vendedores.html', |
36 | controller: 'modalVendedoresCtrl', | 40 | controller: 'modalVendedoresCtrl', |
37 | size: 'lg' | 41 | size: 'lg' |
38 | } | 42 | } |
39 | ); | 43 | ); |
40 | 44 | ||
41 | modalInstance.result.then( | 45 | modalInstance.result.then( |
42 | function (selectedItem) { | 46 | function (selectedItem) { |
43 | console.info(selectedItem); | 47 | console.info(selectedItem); |
44 | $timeout(openModal, 500); | 48 | $timeout(openModal, 500); |
45 | }, function () { | 49 | }, function () { |
46 | console.info('modal-component dismissed at: ' + new Date()); | 50 | console.info('modal-component dismissed at: ' + new Date()); |
47 | $timeout(openModal, 500); | 51 | $timeout(openModal, 500); |
48 | } | 52 | } |
49 | ); | 53 | ); |
50 | } | 54 | } |
51 | |||
52 | |||
53 | }]); | 55 | }]); |
54 | </script> | 56 | </script> |
55 | 57 | ||
56 | <script src="src/etc/develop.js"></script> | 58 | <script src="src/etc/develop.js"></script> |
57 | </head> | 59 | </head> |
58 | 60 | ||
59 | <body ng-controller="controller"> | 61 | <body ng-controller="controller"> |
60 | <style> | 62 | <style> |
61 | .active{color:#fff;text-decoration:none;outline:0;background-color:#337ab7}.btn-xs{padding:.15rem .5rem;font-size:.8rem;line-height:1.5;border-radius:.2rem}.no-border-bottom{border-bottom:0 !important}.no-border-top{border-top:0 !important}.no-border{border:0 !important}.margin-bottom-mobile{margin-bottom:2.5em !important}.tamaño-boton{width:44px}@media (max-width: 576px){.modal-content{height:auto;height:100%;border-radius:0}}@media (max-width: 576px){.modal-dialog{width:100%;height:100%;margin:0;padding:0}}@media (max-width: 576px){.modal-body{overflow-y:auto}}.botonera .btn{margin-bottom:5px}.botonera-lateral>.row{height:420px}.botonera-principal menuitem{display:inline-block;height:130px;text-align:center;width:180px}.botonera-principal button{background-image:url("../img/botonera.png");border-radius:12px;border-width:0;height:90px;position:relative;width:90px}.botonera-principal button span{left:0;position:absolute;text-align:center;top:90px;width:100%;font-size:12px;color:#777777}.botonera-principal-menu{padding-left:90px}.botonera-principal-logo{width:80%;opacity:.8}.botonera-principal-vacio button{background-position:-4380px 0}.botonera-principal-vacio button:hover{background-position:-4380px -90px}.botonera-principal-abrir-turno button{background-position:0 0}.botonera-principal-abrir-turno button:hover{background-position:0 -90px}.botonera-principal-cerrar-turno button{background-position:-90px 0}.botonera-principal-cerrar-turno button:hover{background-position:-90px -90px}.botonera-principal-caja button{background-position:-180px 0}.botonera-principal-caja button:hover{background-position:-180px -90px}.botonera-principal-facturador button{background-position:-270px 0px}.botonera-principal-facturador button:hover{background-position:-270px -90px}.botonera-principal-nota-pedido button{background-position:-1250px 0px}.botonera-principal-nota-pedido button:hover{background-position:-1250px -90px}.botonera-secundaria{background-color:rgba(0,0,0,0.8)}.botonera-secundaria .row{border-radius:5px;overflow:hidden}.botonera-secundaria .btn{border-radius:0;margin-right:1px;width:calc(100% - 1px);margin-bottom:1px}body{background-color:#cccccc}.contenedor{background-image:radial-gradient(circle at 50% 50%, #ebecf1, #abaec3)}@media (min-width: 768px){.contenedor{min-height:600px;min-width:800px}}.grilla-articulo{background-color:rgba(0,0,0,0.8)}@media (min-width: 768px){.grilla-articulo{height:430px}}.lista{background-color:rgba(0,0,0,0.8);padding:10px}.lista tr{background:linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.5))}.lista tbody td{border-top:none;color:#ffffff}.lista thead th{border-bottom:1px solid #ffffff;border-top:none;color:#ffffff;font-family:sans-serif;font-size:12px}.lista .boton-accion{background:none;color:#ffffff;border:1px solid #ffffff;border-radius:30px;padding:5px 7px}.lista .boton-accion i{font-size:16px}.login{background-color:#bdbdbd;border:1px solid #000000;border-radius:3px;height:155px;left:calc(50% - 130px);opacity:0.7;position:absolute;text-align:center;top:190px;width:260px}.login-titulo{border-bottom:1px solid #ffffff;padding:5px 0}.login-campo label{display:block;font-size:12px;margin:5px 0 0}.login-campo input:focus{outline:3px solid #ff9900}.panel-informativo{background:linear-gradient(#ccc, #eee);min-height:32px}.panel-informativo .form-group{margin-bottom:5px}.panel-informativo .form-control-xs{height:calc(1.6rem);padding:.25rem .5rem;font-size:.8rem;line-height:1.3;border-radius:.2rem}.panel-informativo .label{font-size:.8em}.panel-informativo .valor{font-size:.8em}@media (max-width: 576px){.panel-informativo .nota-pedido{text-align:center}}@media (min-width: 576px){.panel-informativo .numero-pedido{text-align:center}}.table-nonfluid{width:auto}.table-celda-total{color:#000000;background-color:#FF9900}.keyboard{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:62%;height:60%;margin-left:13%;margin-top:-19%;position:absolute}.keyboard table{border-spacing:10px;border-collapse:separate;z-index:100000}.keyboard table td{touch-action:none}.keyboard .letter{background-color:#bdbdbd;box-shadow:2px 2px 3px #555555;width:47px;height:50px;text-align:center;font-family:"arial";cursor:pointer;color:#000;font-size:22px}.keyboard .letter:hover{background-color:#fafafa}.keyboard .letter:active{background-color:#999;color:#fff}.keyboard .number{background-color:#bdbdbd;box-shadow:2px 2px 3px #555555;width:47px;height:35px;text-align:center;font-family:"arial";cursor:pointer;color:#000;font-size:22px}.keyboard .number:hover{background-color:#fafafa}.keyboard .number:active{background-color:#999;color:#fff}.keyboard .margin{width:40px;height:50px}.teclado-activar{background-color:#17d236}.boton-activar-teclado{margin-top:-10%;position:absolute;z-index:100000}.tabla-articulo{max-height:420px}.tabla-articulo tr{display:inline-table;table-layout:fixed}.tabla-articulo tbody{overflow-y:auto;max-height:280px;display:block}.acciones-mobile{line-height:2.5em;color:orange;font-size:1.25em}.swiper-container{height:400px}.swiper-slide{background:transparent;height:400px;text-align:unset;-webkit-align-items:unset;align-items:unset}.crear-nota-pedido-fecha input[type="date"]::-webkit-clear-button{display:none} | 63 | .active{color:#fff;text-decoration:none;outline:0;background-color:#337ab7}.btn-xs{padding:.15rem .5rem;font-size:.8rem;line-height:1.5;border-radius:.2rem}.no-border-bottom{border-bottom:0 !important}.no-border-top{border-top:0 !important}.no-border{border:0 !important}.margin-bottom-mobile{margin-bottom:2.5em !important}.tamaño-boton{width:44px}@media (max-width: 576px){.modal-content{height:auto;height:100%;border-radius:0}}@media (max-width: 576px){.modal-dialog{width:100%;height:100%;margin:0;padding:0}}@media (max-width: 576px){.modal-body{overflow-y:auto}}.botonera .btn{margin-bottom:5px}.botonera-lateral>.row{height:420px}.botonera-principal menuitem{display:inline-block;height:130px;text-align:center;width:180px}.botonera-principal button{background-image:url("../img/botonera.png");border-radius:12px;border-width:0;height:90px;position:relative;width:90px}.botonera-principal button span{left:0;position:absolute;text-align:center;top:90px;width:100%;font-size:12px;color:#777777}.botonera-principal-menu{padding-left:90px}.botonera-principal-logo{width:80%;opacity:.8}.botonera-principal-vacio button{background-position:-4380px 0}.botonera-principal-vacio button:hover{background-position:-4380px -90px}.botonera-principal-abrir-turno button{background-position:0 0}.botonera-principal-abrir-turno button:hover{background-position:0 -90px}.botonera-principal-cerrar-turno button{background-position:-90px 0}.botonera-principal-cerrar-turno button:hover{background-position:-90px -90px}.botonera-principal-caja button{background-position:-180px 0}.botonera-principal-caja button:hover{background-position:-180px -90px}.botonera-principal-facturador button{background-position:-270px 0px}.botonera-principal-facturador button:hover{background-position:-270px -90px}.botonera-principal-nota-pedido button{background-position:-1250px 0px}.botonera-principal-nota-pedido button:hover{background-position:-1250px -90px}.botonera-secundaria{background-color:rgba(0,0,0,0.8)}.botonera-secundaria .row{border-radius:5px;overflow:hidden}.botonera-secundaria .btn{border-radius:0;margin-right:1px;width:calc(100% - 1px);margin-bottom:1px}body{background-color:#cccccc}.contenedor{background-image:radial-gradient(circle at 50% 50%, #ebecf1, #abaec3)}@media (min-width: 768px){.contenedor{min-height:600px;min-width:800px}}.grilla-articulo{background-color:rgba(0,0,0,0.8)}@media (min-width: 768px){.grilla-articulo{height:430px}}.lista{background-color:rgba(0,0,0,0.8);padding:10px}.lista tr{background:linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.5))}.lista tbody td{border-top:none;color:#ffffff}.lista thead th{border-bottom:1px solid #ffffff;border-top:none;color:#ffffff;font-family:sans-serif;font-size:12px}.lista .boton-accion{background:none;color:#ffffff;border:1px solid #ffffff;border-radius:30px;padding:5px 7px}.lista .boton-accion i{font-size:16px}.login{background-color:#bdbdbd;border:1px solid #000000;border-radius:3px;height:155px;left:calc(50% - 130px);opacity:0.7;position:absolute;text-align:center;top:190px;width:260px}.login-titulo{border-bottom:1px solid #ffffff;padding:5px 0}.login-campo label{display:block;font-size:12px;margin:5px 0 0}.login-campo input:focus{outline:3px solid #ff9900}.panel-informativo{background:linear-gradient(#ccc, #eee);min-height:32px}.panel-informativo .form-group{margin-bottom:5px}.panel-informativo .form-control-xs{height:calc(1.6rem);padding:.25rem .5rem;font-size:.8rem;line-height:1.3;border-radius:.2rem}.panel-informativo .label{font-size:.8em}.panel-informativo .valor{font-size:.8em}@media (max-width: 576px){.panel-informativo .nota-pedido{text-align:center}}@media (min-width: 576px){.panel-informativo .numero-pedido{text-align:center}}.table-nonfluid{width:auto}.table-celda-total{color:#000000;background-color:#FF9900}.keyboard{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:62%;height:60%;margin-left:13%;margin-top:-19%;position:absolute}.keyboard table{border-spacing:10px;border-collapse:separate;z-index:100000}.keyboard table td{touch-action:none}.keyboard .letter{background-color:#bdbdbd;box-shadow:2px 2px 3px #555555;width:47px;height:50px;text-align:center;font-family:"arial";cursor:pointer;color:#000;font-size:22px}.keyboard .letter:hover{background-color:#fafafa}.keyboard .letter:active{background-color:#999;color:#fff}.keyboard .number{background-color:#bdbdbd;box-shadow:2px 2px 3px #555555;width:47px;height:35px;text-align:center;font-family:"arial";cursor:pointer;color:#000;font-size:22px}.keyboard .number:hover{background-color:#fafafa}.keyboard .number:active{background-color:#999;color:#fff}.keyboard .margin{width:40px;height:50px}.teclado-activar{background-color:#17d236}.boton-activar-teclado{margin-top:-10%;position:absolute;z-index:100000}.tabla-articulo{max-height:420px}.tabla-articulo tr{display:inline-table;table-layout:fixed}.tabla-articulo tbody{overflow-y:auto;max-height:280px;display:block}.acciones-mobile{line-height:2.5em;color:orange;font-size:1.25em}.swiper-container{height:400px}.swiper-slide{background:transparent;height:400px;text-align:unset;-webkit-align-items:unset;align-items:unset}.crear-nota-pedido-fecha input[type="date"]::-webkit-clear-button{display:none} |
62 | </style> | 64 | </style> |
63 | </body> | 65 | </body> |
package.json
1 | { | 1 | { |
2 | "name": "foca-modal-vendedores", | 2 | "name": "foca-modal-vendedores", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Modal para seleccionar vendedores", | 4 | "description": "Modal para seleccionar vendedores", |
5 | "main": "index.js", | 5 | "main": "index.js", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | "gulp-pre-commit": "gulp pre-commit", | 8 | "gulp-pre-commit": "gulp pre-commit", |
9 | "compile": "gulp uglify", | 9 | "compile": "gulp uglify", |
10 | "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
11 | "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify jasmine-core jquery jshint pre-commit pump ui-bootstrap4 && npm i -D git+https://192.168.0.11/modulos-npm/foca-directivas" | 11 | "install-dev": "npm install -D angular angular-ladda ladda@1.0.6 bootstrap font-awesome gulp gulp-angular-templatecache gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-clean gulp-replace gulp-uglify jasmine-core jquery jshint pre-commit pump ui-bootstrap4 && npm i -D git+https://debo.suite.repo/modulos-npm/foca-directivas" |
12 | }, | 12 | }, |
13 | "pre-commit": [ | 13 | "pre-commit": [ |
14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
15 | ], | 15 | ], |
16 | "repository": { | 16 | "repository": { |
17 | "type": "git", | 17 | "type": "git", |
18 | "url": "https://192.168.0.11/modulos-npm/foca-modal-vendedores" | 18 | "url": "https://debo.suite.repo/modulos-npm/foca-modal-vendedores" |
19 | }, | 19 | }, |
20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
21 | "license": "ISC", | 21 | "license": "ISC", |
22 | "peerDependencies": { | 22 | "peerDependencies": { |
23 | "angular": "^1.7.4", | 23 | "angular": "^1.7.4", |
24 | "bootstrap": "^4.1.3", | 24 | "bootstrap": "^4.1.3", |
25 | "font-awesome": "^4.7.0", | 25 | "font-awesome": "^4.7.0", |
26 | "ui-bootstrap4": "^3.0.4", | 26 | "ui-bootstrap4": "^3.0.4", |
27 | "gulp": "^3.9.1", | 27 | "gulp": "^3.9.1", |
28 | "gulp-angular-templatecache": "^2.2.1", | 28 | "gulp-angular-templatecache": "^2.2.1", |
29 | "gulp-concat": "^2.6.1", | 29 | "gulp-concat": "^2.6.1", |
30 | "gulp-connect": "^5.6.1", | 30 | "gulp-connect": "^5.6.1", |
31 | "gulp-htmlmin": "^5.0.1", | 31 | "gulp-htmlmin": "^5.0.1", |
32 | "gulp-rename": "^1.4.0", | 32 | "gulp-rename": "^1.4.0", |
33 | "gulp-replace": "^1.0.0", | 33 | "gulp-replace": "^1.0.0", |
34 | "gulp-uglify": "^3.0.1", | 34 | "gulp-uglify": "^3.0.1", |
35 | "jquery": "^3.3.1", | 35 | "jquery": "^3.3.1", |
36 | "pump": "^3.0.0", | 36 | "pump": "^3.0.0", |
37 | "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas" | 37 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas" |
38 | }, | 38 | }, |
39 | "devDependencies": { | 39 | "devDependencies": { |
40 | "angular": "^1.7.5", | 40 | "angular": "^1.7.5", |
41 | "angular-ladda": "^0.4.3", | ||
41 | "bootstrap": "^4.1.3", | 42 | "bootstrap": "^4.1.3", |
42 | "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", | 43 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas", |
43 | "font-awesome": "^4.7.0", | 44 | "font-awesome": "^4.7.0", |
44 | "gulp": "^3.9.1", | 45 | "gulp": "^3.9.1", |
45 | "gulp-angular-templatecache": "^2.2.1", | 46 | "gulp-angular-templatecache": "^2.2.3", |
47 | "gulp-clean": "^0.4.0", | ||
46 | "gulp-concat": "^2.6.1", | 48 | "gulp-concat": "^2.6.1", |
47 | "gulp-connect": "^5.6.1", | 49 | "gulp-connect": "^5.6.1", |
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-uglify": "^3.0.1", | 54 | "gulp-uglify": "^3.0.1", |
53 | "jasmine-core": "^3.2.1", | 55 | "jasmine-core": "^3.3.0", |
54 | "jquery": "^3.3.1", | 56 | "jquery": "^3.3.1", |
55 | "jshint": "^2.9.6", | 57 | "jshint": "^2.9.6", |
58 | "ladda": "1.0.6", | ||
56 | "pre-commit": "^1.2.2", | 59 | "pre-commit": "^1.2.2", |
57 | "pump": "^3.0.0", | 60 | "pump": "^3.0.0", |
58 | "ui-bootstrap4": "^3.0.5" | 61 | "ui-bootstrap4": "^3.0.5" |
59 | } | 62 | } |
60 | } | 63 | } |
61 | 64 |
src/js/app.js
1 | angular.module('focaModalVendedores', ['ui.bootstrap', 'focaDirectivas']); | 1 | angular.module('focaModalVendedores', ['ui.bootstrap', 'focaDirectivas', 'angular-ladda']); |
2 | 2 |
src/js/controller.js
1 | angular.module('focaModalVendedores') | 1 | angular.module('focaModalVendedores') |
2 | .controller('modalVendedoresCtrl', [ | 2 | .controller('modalVendedoresCtrl', [ |
3 | '$filter', | 3 | '$filter', |
4 | '$scope', | 4 | '$scope', |
5 | '$uibModalInstance', | 5 | '$uibModalInstance', |
6 | 'focaVendedoresService', | 6 | 'focaVendedoresService', |
7 | function($filter, $scope, $uibModalInstance, focaVendedoresService) { | 7 | function($filter, $scope, $uibModalInstance, focaVendedoresService) { |
8 | focaVendedoresService.getVendedores().then( | ||
9 | function(res) { | ||
10 | $scope.vendedores = res.data; | ||
11 | $scope.search(); | ||
12 | } | ||
13 | ); | ||
14 | 8 | ||
9 | $scope.filters = ''; | ||
10 | $scope.vendedores = []; | ||
11 | $scope.primerBusqueda = false; | ||
12 | $scope.searchLoading = false; | ||
15 | // pagination | 13 | // pagination |
16 | $scope.numPerPage = 10; | 14 | $scope.numPerPage = 10; |
17 | $scope.currentPage = 1; | 15 | $scope.currentPage = 1; |
18 | $scope.filteredVendedores = []; | 16 | $scope.filteredVendedores = []; |
19 | $scope.currentPageVendedores = []; | 17 | $scope.currentPageVendedores = []; |
20 | $scope.selectedVendedor = -1; | 18 | $scope.selectedVendedor = -1; |
21 | 19 | ||
20 | $scope.busquedaPress = function(key) { | ||
21 | if (key === 13) { | ||
22 | $scope.searchLoading = true; | ||
23 | focaVendedoresService.getVendedores($scope.filters).then( | ||
24 | function(res) { | ||
25 | $scope.searchLoading = false; | ||
26 | $scope.primerBusqueda = true; | ||
27 | $scope.vendedores = res.data; | ||
28 | $scope.search(); | ||
29 | primera(); | ||
30 | } | ||
31 | ); | ||
32 | } | ||
33 | }; | ||
34 | |||
22 | $scope.search = function() { | 35 | $scope.search = function() { |
23 | $scope.filteredVendedores = $filter('filter')( | 36 | if($scope.vendedores.length > 0) { |
37 | $scope.filteredVendedores = $filter('filter')( | ||
24 | $scope.vendedores, { $: $scope.filters } | 38 | $scope.vendedores, { $: $scope.filters } |
25 | ); | 39 | ); |
26 | 40 | $scope.lastPage = Math.ceil( | |
27 | $scope.lastPage = Math.ceil( | 41 | $scope.filteredVendedores.length / $scope.numPerPage |
28 | $scope.filteredVendedores.length / $scope.numPerPage | 42 | ); |
29 | ); | 43 | $scope.resetPage(); |
30 | 44 | } | |
31 | $scope.resetPage(); | ||
32 | }; | 45 | }; |
33 | 46 | ||
34 | $scope.resetPage = function() { | 47 | $scope.resetPage = function() { |
35 | $scope.currentPage = 1; | 48 | $scope.currentPage = 1; |
36 | $scope.selectPage(1); | 49 | $scope.selectPage(1); |
37 | }; | 50 | }; |
38 | 51 | ||
39 | $scope.selectPage = function(page) { | 52 | $scope.selectPage = function(page) { |
40 | var start = (page - 1) * $scope.numPerPage; | 53 | var start = (page - 1) * $scope.numPerPage; |
41 | var end = start + $scope.numPerPage; | 54 | var end = start + $scope.numPerPage; |
42 | $scope.paginas = []; | 55 | $scope.paginas = []; |
43 | $scope.paginas = calcularPages(page); | 56 | $scope.paginas = calcularPages(page); |
44 | $scope.currentPageVendedores = $scope.filteredVendedores.slice(start, end); | 57 | $scope.currentPageVendedores = $scope.filteredVendedores.slice(start, end); |
45 | $scope.currentPage = page; | 58 | $scope.currentPage = page; |
46 | }; | 59 | }; |
47 | 60 | ||
48 | $scope.select = function(vendedor) { | 61 | $scope.select = function(vendedor) { |
49 | $uibModalInstance.close(vendedor); | 62 | $uibModalInstance.close(vendedor); |
50 | }; | 63 | }; |
51 | 64 | ||
52 | $scope.cancel = function() { | 65 | $scope.cancel = function() { |
53 | $uibModalInstance.dismiss('cancel'); | 66 | $uibModalInstance.dismiss('cancel'); |
54 | }; | 67 | }; |
55 | 68 | ||
56 | $scope.busquedaDown = function(key) { | 69 | $scope.busquedaDown = function(key) { |
57 | if (key === 40) { | 70 | if (key === 40) { |
58 | primera(key); | 71 | primera(key); |
59 | } | 72 | } |
60 | }; | 73 | }; |
61 | 74 | ||
62 | $scope.busquedaPress = function(key) { | ||
63 | if (key === 13) { | ||
64 | primera(key); | ||
65 | } | ||
66 | }; | ||
67 | |||
68 | $scope.itemVendedor = function(key) { | 75 | $scope.itemVendedor = function(key) { |
69 | if (key === 38) { | 76 | if (key === 38) { |
70 | anterior(key); | 77 | anterior(key); |
71 | } | 78 | } |
72 | 79 | ||
73 | if (key === 40) { | 80 | if (key === 40) { |
74 | siguiente(key); | 81 | siguiente(key); |
75 | } | 82 | } |
76 | 83 | ||
77 | if (key === 37) { | 84 | if (key === 37) { |
78 | retrocederPagina(); | 85 | retrocederPagina(); |
79 | } | 86 | } |
80 | 87 | ||
81 | if (key === 39) { | 88 | if (key === 39) { |
82 | avanzarPagina(); | 89 | avanzarPagina(); |
83 | } | 90 | } |
84 | }; | 91 | }; |
85 | 92 | ||
86 | function calcularPages(paginaActual) { | 93 | function calcularPages(paginaActual) { |
87 | var paginas = []; | 94 | var paginas = []; |
88 | paginas.push(paginaActual); | 95 | paginas.push(paginaActual); |
89 | 96 | ||
90 | if (paginaActual - 1 > 1) { | 97 | if (paginaActual - 1 > 1) { |
91 | 98 | ||
92 | paginas.unshift(paginaActual - 1); | 99 | paginas.unshift(paginaActual - 1); |
93 | if (paginaActual - 2 > 1) { | 100 | if (paginaActual - 2 > 1) { |
94 | paginas.unshift(paginaActual - 2); | 101 | paginas.unshift(paginaActual - 2); |
95 | } | 102 | } |
96 | } | 103 | } |
97 | 104 | ||
98 | if (paginaActual + 1 < $scope.lastPage) { | 105 | if (paginaActual + 1 < $scope.lastPage) { |
99 | paginas.push(paginaActual + 1); | 106 | paginas.push(paginaActual + 1); |
100 | if (paginaActual + 2 < $scope.lastPage) { | 107 | if (paginaActual + 2 < $scope.lastPage) { |
101 | paginas.push(paginaActual + 2); | 108 | paginas.push(paginaActual + 2); |
102 | } | 109 | } |
103 | } | 110 | } |
104 | 111 | ||
105 | if (paginaActual !== 1) { | 112 | if (paginaActual !== 1) { |
106 | paginas.unshift(1); | 113 | paginas.unshift(1); |
107 | } | 114 | } |
108 | 115 | ||
109 | if (paginaActual !== $scope.lastPage) { | 116 | if (paginaActual !== $scope.lastPage) { |
110 | paginas.push($scope.lastPage); | 117 | paginas.push($scope.lastPage); |
111 | } | 118 | } |
112 | 119 | ||
113 | return paginas; | 120 | return paginas; |
114 | } | 121 | } |
115 | 122 | ||
116 | function primera() { | 123 | function primera() { |
117 | $scope.selectedVendedor = 0; | 124 | $scope.selectedVendedor = 0; |
118 | } | 125 | } |
119 | 126 | ||
120 | function anterior() { | 127 | function anterior() { |
121 | if ($scope.selectedVendedor === 0 && $scope.currentPage > 1) { | 128 | if ($scope.selectedVendedor === 0 && $scope.currentPage > 1) { |
122 | retrocederPagina(); | 129 | retrocederPagina(); |
123 | } else { | 130 | } else { |
124 | $scope.selectedVendedor--; | 131 | $scope.selectedVendedor--; |
125 | } | 132 | } |
126 | } | 133 | } |
127 | 134 | ||
128 | function siguiente() { | 135 | function siguiente() { |
129 | if ($scope.selectedVendedor < $scope.currentPageVendedores.length - 1) { | 136 | if ($scope.selectedVendedor < $scope.currentPageVendedores.length - 1) { |
130 | $scope.selectedVendedor++; | 137 | $scope.selectedVendedor++; |
131 | } else { | 138 | } else { |
132 | avanzarPagina(); | 139 | avanzarPagina(); |
133 | } | 140 | } |
134 | } | 141 | } |
135 | 142 | ||
136 | function retrocederPagina() { | 143 | function retrocederPagina() { |
137 | if ($scope.currentPage > 1) { | 144 | if ($scope.currentPage > 1) { |
138 | $scope.selectPage($scope.currentPage - 1); | 145 | $scope.selectPage($scope.currentPage - 1); |
src/js/service.js
1 | angular.module('focaModalVendedores') | 1 | angular.module('focaModalVendedores') |
2 | .service('focaVendedoresService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .service('focaVendedoresService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | return { | 3 | return { |
4 | getVendedores: function() { | 4 | getVendedores: function(filters) { |
5 | // TODO ACOMODAR PARA TURNOS AHORA 1 HARDCODEO | 5 | // TODO ACOMODAR PARA TURNOS AHORA 1 HARDCODEO |
6 | return $http.get(API_ENDPOINT.URL + '/vendedores/1'); | 6 | return $http.post(API_ENDPOINT.URL + '/vendedores', {nombre: filters}); |
7 | } | 7 | } |
8 | }; | 8 | }; |
9 | }]); | 9 | }]); |
10 | 10 |
src/views/modal-vendedores.html
1 | <div class="modal-header"> | 1 | <div class="modal-header py-1"> |
2 | <h3 class="modal-title">Búsqueda de vendedores</h3> | 2 | <h5 class="modal-title">Búsqueda de vendedores</h5> |
3 | </div> | 3 | </div> |
4 | <div class="modal-body" id="modal-body"> | 4 | <div class="modal-body" id="modal-body"> |
5 | <div class="input-group mb-3"> | 5 | <div class="input-group"> |
6 | <input | 6 | <input |
7 | type="text" | 7 | ladda="searchLoading" |
8 | class="form-control" | 8 | type="text" |
9 | placeholder="Busqueda" | 9 | class="form-control form-control-sm" |
10 | ng-model="filters" | 10 | placeholder="Busqueda" |
11 | ng-model="filters" | ||
11 | ng-change="search()" | 12 | ng-change="search()" |
12 | ng-keydown="busquedaDown($event.keyCode)" | 13 | ng-keydown="busquedaDown($event.keyCode)" |
13 | ng-keypress="busquedaPress($event.keyCode)" | 14 | ng-keypress="busquedaPress($event.keyCode)" |
14 | foca-focus="selectedVendedor == -1" | 15 | foca-focus="selectedVendedor == -1" |
15 | ng-focus="selectedVendedor = -1" | 16 | ng-focus="selectedVendedor = -1" |
16 | > | 17 | > |
17 | </div> | 18 | <div class="input-group-append"> |
18 | <table class="table table-striped table-sm"> | 19 | <button |
19 | <thead> | 20 | ladda="searchLoading" |
20 | <tr> | 21 | class="btn btn-outline-secondary" |
21 | <th class="d-none d-sm-table-cell">Código</th> | 22 | type="button" |
22 | <th class="d-sm-none">Cód.</th> | 23 | ng-click="busquedaPress(13)" |
23 | <th>Nombre</th> | 24 | > |
24 | <th></th> | 25 | <i class="fa fa-search" aria-hidden="true"></i> |
25 | </tr> | 26 | </button> |
26 | </thead> | 27 | </div> |
27 | <tbody> | ||
28 | <tr | ||
29 | ng-repeat="(key, vendedor) in currentPageVendedores" | ||
30 | ng-click="select(vendedor)" | ||
31 | > | ||
32 | <td ng-bind="vendedor.CodVen"></td> | ||
33 | <td ng-bind="vendedor.NomVen"></td> | ||
34 | <td> | ||
35 | <button | ||
36 | type="button" | ||
37 | class="btn p-2 float-right d-none d-md-table-cell" | ||
38 | ng-class="{ | ||
39 | 'btn-secondary': selectedVendedor != key, | ||
40 | 'btn-primary': selectedVendedor == key | ||
41 | }" | ||
42 | |||
43 | foca-focus="selectedVendedor == {{key}}" | ||
44 | ng-keydown="itemVendedor($event.keyCode)" | ||
45 | > | ||
46 | </button> | ||
47 | <i | ||
48 | class="fa fa-arrow-right d-md-none text-primary" | ||
49 | aria-hidden="true" | ||
50 | ></i> | ||
51 | </td> | ||
52 | </tr> | ||
53 | </tbody> | ||
54 | </table> | ||
55 | <nav> | ||
56 | <ul class="pagination justify-content-end mb-0"> | ||
57 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | ||
58 | <a | ||
59 | class="page-link" | ||
60 | href="javascript:void()" | ||
61 | ng-click="selectPage(currentPage - 1)" | ||
62 | > | ||
63 | <span aria-hidden="true">«</span> | ||
64 | <span class="sr-only">Anterior</span> | ||
65 | </a> | ||
66 | </li> | ||
67 | <li | ||
68 | class="page-item" | ||
69 | ng-repeat="pagina in paginas" | ||
70 | ng-class="{'active': pagina == currentPage}" | ||
71 | > | ||
72 | <a | ||
73 | class="page-link" | ||
74 | href="javascript:void()" | 28 | </div> |
29 | <table ng-show="primerBusqueda" class="table table-striped table-sm col-12"> | ||
30 | <thead> | ||
31 | <tr> | ||
32 | <th>Código</th> | ||
33 | <th>Nombre</th> | ||
34 | <th></th> | ||
35 | </tr> | ||
36 | </thead> | ||
37 | <tbody> | ||
38 | <tr ng-show="currentPageVendedores.length == 0 && primerBusqueda"> | ||
39 | <td colspan="3"> | ||
40 | No se encontraron resultados. | ||
41 | </td> | ||
42 | </tr> | ||
43 | <tr class="selected" | ||
44 | ng-repeat="(key, vendedor) in currentPageVendedores" | ||
45 | ng-click="select(vendedor)" | ||
46 | > | ||
47 | <td ng-bind="vendedor.CodVen"></td> | ||
48 | <td ng-bind="vendedor.NomVen"></td> | ||
49 | <td class="d-md-none text-primary"> | ||
50 | <i class="fa fa-arrow-right" aria-hidden="true"></i> | ||
51 | </td> | ||
52 | <td class="d-none d-md-table-cell"> | ||
53 | <button |