Commit c74c05aa5541cadbea3dc4a592f3f4da0265479c
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
arreglos para compilacion See merge request modulos-npm/foca-modal-busqueda-productos!5
Showing
3 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 | 11 | ||
12 | var paths = { | 12 | var paths = { |
13 | srcJS: 'src/js/*.js', | 13 | srcJS: 'src/js/*.js', |
14 | srcViews: 'src/views/*.html', | 14 | srcViews: 'src/views/*.html', |
15 | tmp: 'tmp', | 15 | tmp: 'tmp', |
16 | dist: 'dist/' | 16 | dist: 'dist/' |
17 | }; | 17 | }; |
18 | 18 | ||
19 | gulp.task('templates', function() { | 19 | gulp.task('templates', function() { |
20 | return pump( | 20 | return pump( |
21 | [ | 21 | [ |
22 | gulp.src(paths.srcViews), | 22 | gulp.src(paths.srcViews), |
23 | replace('views/', ''), | ||
24 | htmlmin(), | 23 | htmlmin(), |
25 | templateCache('views.js', { | 24 | templateCache('views.js', { |
26 | module: 'focaBusquedaProductos', | 25 | module: 'focaBusquedaProductos', |
27 | root: '' | 26 | root: '' |
28 | }), | 27 | }), |
29 | gulp.dest(paths.tmp) | 28 | gulp.dest(paths.tmp) |
30 | ] | 29 | ] |
31 | ); | 30 | ); |
32 | }); | 31 | }); |
33 | 32 | ||
34 | gulp.task('uglify', ['templates'], function() { | 33 | gulp.task('uglify', ['templates'], function() { |
35 | return pump( | 34 | return pump( |
36 | [ | 35 | [ |
37 | gulp.src([ | 36 | gulp.src([ |
38 | paths.srcJS, | 37 | paths.srcJS, |
39 | 'tmp/views.js' | 38 | 'tmp/views.js' |
40 | ]), | 39 | ]), |
41 | concat('foca-busqueda-productos.js'), | 40 | concat('foca-busqueda-productos.js'), |
41 | replace('src/views/', ''), | ||
42 | replace("'ngRoute'", ''), | ||
42 | gulp.dest(paths.tmp), | 43 | gulp.dest(paths.tmp), |
43 | rename('foca-busqueda-productos.min.js'), | 44 | rename('foca-busqueda-productos.min.js'), |
44 | uglify(), | 45 | uglify(), |
45 | gulp.dest(paths.dist) | 46 | gulp.dest(paths.dist) |
46 | ] | 47 | ] |
47 | ); | 48 | ); |
48 | }); | 49 | }); |
49 | 50 | ||
50 | gulp.task('pre-commit', function() { | 51 | gulp.task('pre-commit', function() { |
51 | return pump( | 52 | return pump( |
52 | [ | 53 | [ |
53 | gulp.src(paths.srcJS), | 54 | gulp.src(paths.srcJS), |
54 | jshint('.jshintrc'), | 55 | jshint('.jshintrc'), |
55 | jshint.reporter('default'), | 56 | jshint.reporter('default'), |
56 | jshint.reporter('fail') | 57 | jshint.reporter('fail') |
57 | ] | 58 | ] |
58 | ); | 59 | ); |
59 | 60 | ||
60 | gulp.start('uglify'); | 61 | gulp.start('uglify'); |
61 | }); | 62 | }); |
62 | 63 | ||
63 | gulp.task('webserver', function() { | 64 | gulp.task('webserver', function() { |
64 | pump [ | 65 | pump [ |
65 | connect.server({port: 3000}) | 66 | connect.server({port: 3000}) |
66 | ] | 67 | ] |
67 | }); | 68 | }); |
68 | 69 |
package.json
1 | { | 1 | { |
2 | "name": "foca-modal-busqueda-productos", | 2 | "name": "foca-modal-busqueda-productos", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Menu de navegacion de doble entrada", | 4 | "description": "Modal para seleccion de productos", |
5 | "main": "index.js", | ||
6 | "scripts": { | 5 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 6 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | "gulp-pre-commit": "gulp pre-commit", | 7 | "gulp-pre-commit": "gulp pre-commit", |
9 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
10 | "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", | 9 | "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", |
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" | 10 | "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" |
12 | }, | 11 | }, |
13 | "pre-commit": [ | 12 | "pre-commit": [ |
14 | "gulp-pre-commit" | 13 | "gulp-pre-commit" |
15 | ], | 14 | ], |
16 | "repository": { | 15 | "repository": { |
17 | "type": "git", | 16 | "type": "git", |
18 | "url": "https://192.168.0.11/modulos-npm/foca-navegacion-doble" | 17 | "url": "https://192.168.0.11/modulos-npm/foca-modal-busqueda-productos" |
19 | }, | 18 | }, |
20 | "author": "Nicolás Guarnieri", | 19 | "author": "Nicolás Guarnieri", |
21 | "license": "ISC", | 20 | "license": "ISC", |
22 | "peerDependencies": { | 21 | "peerDependencies": { |
23 | "angular": "^1.7.4", | 22 | "angular": "^1.7.4", |
24 | "bootstrap": "^4.1.3", | 23 | "bootstrap": "^4.1.3", |
25 | "font-awesome": "^4.7.0", | 24 | "font-awesome": "^4.7.0", |
26 | "ui-bootstrap4": "^3.0.4", | 25 | "ui-bootstrap4": "^3.0.4", |
27 | "gulp": "^3.9.1", | 26 | "gulp": "^3.9.1", |
28 | "gulp-angular-templatecache": "^2.2.1", | 27 | "gulp-angular-templatecache": "^2.2.1", |
29 | "gulp-concat": "^2.6.1", | 28 | "gulp-concat": "^2.6.1", |
30 | "gulp-connect": "^5.6.1", | 29 | "gulp-connect": "^5.6.1", |
31 | "gulp-htmlmin": "^5.0.1", | 30 | "gulp-htmlmin": "^5.0.1", |
32 | "gulp-rename": "^1.4.0", | 31 | "gulp-rename": "^1.4.0", |
33 | "gulp-replace": "^1.0.0", | 32 | "gulp-replace": "^1.0.0", |
34 | "gulp-uglify": "^3.0.1", | 33 | "gulp-uglify": "^3.0.1", |
35 | "jquery": "^3.3.1", | 34 | "jquery": "^3.3.1", |
36 | "pump": "^3.0.0", | 35 | "pump": "^3.0.0", |
37 | "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas" | 36 | "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas" |
38 | }, | 37 | }, |
39 | "devDependencies": { | 38 | "devDependencies": { |
40 | "angular": "^1.7.4", | 39 | "angular": "^1.7.4", |
41 | "bootstrap": "^4.1.3", | 40 | "bootstrap": "^4.1.3", |
42 | "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", | 41 | "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", |
43 | "font-awesome": "^4.7.0", | 42 | "font-awesome": "^4.7.0", |
44 | "gulp": "^3.9.1", | 43 | "gulp": "^3.9.1", |
45 | "gulp-angular-templatecache": "^2.2.1", | 44 | "gulp-angular-templatecache": "^2.2.1", |
46 | "gulp-concat": "^2.6.1", | 45 | "gulp-concat": "^2.6.1", |
47 | "gulp-connect": "^5.6.1", | 46 | "gulp-connect": "^5.6.1", |
48 | "gulp-htmlmin": "^5.0.1", | 47 | "gulp-htmlmin": "^5.0.1", |
49 | "gulp-jshint": "^2.1.0", | 48 | "gulp-jshint": "^2.1.0", |
50 | "gulp-rename": "^1.4.0", | 49 | "gulp-rename": "^1.4.0", |
51 | "gulp-replace": "^1.0.0", | 50 | "gulp-replace": "^1.0.0", |
52 | "gulp-uglify": "^3.0.1", | 51 | "gulp-uglify": "^3.0.1", |
53 | "jasmine-core": "^3.2.1", | 52 | "jasmine-core": "^3.2.1", |
54 | "jquery": "^3.3.1", | 53 | "jquery": "^3.3.1", |
55 | "jshint": "^2.9.6", | 54 | "jshint": "^2.9.6", |
56 | "pre-commit": "^1.2.2", | 55 | "pre-commit": "^1.2.2", |
57 | "pump": "^3.0.0", | 56 | "pump": "^3.0.0", |
58 | "ui-bootstrap4": "^3.0.4" | 57 | "ui-bootstrap4": "^3.0.4" |
59 | } | 58 | } |
60 | } | 59 | } |
60 |
src/views/modal-busqueda-productos.html
1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
2 | <h3 class="modal-title">Busqueda de Productos</h3> | 2 | <h3 class="modal-title">Busqueda de Productos</h3> |
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 mb-3"> |
6 | <input | 6 | <input |
7 | type="text" | 7 | type="text" |
8 | class="form-control" | 8 | class="form-control" |
9 | placeholder="Busqueda" | 9 | placeholder="Busqueda" |
10 | ng-model="filters" | 10 | ng-model="filters" |
11 | ng-change="search()" | 11 | ng-change="search()" |
12 | ng-keydown="busquedaDown($event.keyCode)" | 12 | ng-keydown="busquedaDown($event.keyCode)" |
13 | ng-keypress="busquedaPress($event.keyCode)" | 13 | ng-keypress="busquedaPress($event.keyCode)" |
14 | foca-focus="selectedProducto == -1" | 14 | foca-focus="selectedProducto == -1" |
15 | ng-focus="selectedProducto = -1" | 15 | ng-focus="selectedProducto = -1" |
16 | > | 16 | > |
17 | <table class="table table-striped table-sm"> | 17 | <table class="table table-striped table-sm"> |
18 | <thead> | 18 | <thead> |
19 | <tr> | 19 | <tr> |
20 | <th>Sec.</th> | 20 | <th>Sec.</th> |
21 | <th>Cod.</th> | 21 | <th>Cod.</th> |
22 | <th>Descripción</th> | 22 | <th>Descripción</th> |
23 | <th>P. Base</th> | 23 | <th>P. Base</th> |
24 | <th></th> | 24 | <th></th> |
25 | </tr> | 25 | </tr> |
26 | </thead> | 26 | </thead> |
27 | <tbody> | 27 | <tbody> |
28 | <tr ng-repeat="(key,producto) in currentPageProductos"> | 28 | <tr ng-repeat="(key,producto) in currentPageProductos"> |
29 | <td ng-bind="producto.sector"></td> | 29 | <td ng-bind="producto.sector"></td> |
30 | <td ng-bind="producto.codigo"></td> | 30 | <td ng-bind="producto.codigo"></td> |
31 | <td ng-bind="producto.descripcion"></td> | 31 | <td ng-bind="producto.descripcion"></td> |
32 | <td ng-bind="producto.precio | currency"></td> | 32 | <td ng-bind="producto.precio | currency"></td> |
33 | <td> | 33 | <td> |
34 | <button | 34 | <button |
35 | type="button" | 35 | type="button" |
36 | class="btn p-2 float-right" | 36 | class="btn p-2 float-right" |
37 | ng-class="{ | 37 | ng-class="{ |
38 | 'btn-secondary': selectedProducto != key, | 38 | 'btn-secondary': selectedProducto != key, |
39 | 'btn-primary': selectedProducto == key | 39 | 'btn-primary': selectedProducto == key |
40 | }" | 40 | }" |
41 | ng-click="select(producto)" | 41 | ng-click="select(producto)" |
42 | foca-focus="selectedProducto == {{key}}" | 42 | foca-focus="selectedProducto == {{key}}" |
43 | ng-keydown="itemProducto($event.keyCode)" | 43 | ng-keydown="itemProducto($event.keyCode)" |
44 | > | 44 | > |
45 | <i class="fa fa-arrow-right" aria-hidden="true"></i> | 45 | <i class="fa fa-arrow-right" aria-hidden="true"></i> |
46 | </button> | 46 | </button> |
47 | </td> | 47 | </td> |
48 | </tr> | 48 | </tr> |
49 | </tbody> | 49 | </tbody> |
50 | </table> | 50 | </table> |
51 | <nav> | 51 | <nav> |
52 | <ul class="pagination justify-content-end"> | 52 | <ul class="pagination justify-content-end"> |
53 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 53 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
54 | <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)"> | 54 | <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)"> |
55 | <span aria-hidden="true">«</span> | 55 | <span aria-hidden="true">«</span> |
56 | <span class="sr-only">Anterior</span> | 56 | <span class="sr-only">Anterior</span> |
57 | </a> | 57 | </a> |
58 | </li> | 58 | </li> |
59 | <li | 59 | <li |
60 | class="page-item" | 60 | class="page-item" |
61 | ng-repeat="pagina in paginas" | 61 | ng-repeat="pagina in paginas" |
62 | ng-class="{'active': pagina == currentPage}" | 62 | ng-class="{'active': pagina == currentPage}" |
63 | > | 63 | > |
64 | <a | 64 | <a |
65 | class="page-link" | 65 | class="page-link" |
66 | href="#" | 66 | href="#" |
67 | ng-click="selectPage(pagina)" | 67 | ng-click="selectPage(pagina)" |
68 | ng-bind="pagina" | 68 | ng-bind="pagina" |
69 | ></a> | 69 | ></a> |
70 | </li> | 70 | </li> |
71 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 71 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
72 | <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)"> | 72 | <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)"> |
73 | <span aria-hidden="true">»</span> | 73 | <span aria-hidden="true">»</span> |
74 | <span class="sr-only">Siguiente</span> | 74 | <span class="sr-only">Siguiente</span> |
75 | </a> | 75 | </a> |
76 | </li> | 76 | </li> |
77 | </ul> | 77 | </ul> |
78 | </nav> | 78 | </nav> |
79 | </div> | 79 | </div> |
80 | </div> | 80 | </div> |
81 | <div class="modal-footer"> | 81 | <div class="modal-footer"> |
82 | <button class="btn btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 82 | <button class="btn btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
83 | </div> | 83 | </div> |
84 | 84 |