Commit eff99c353aa70f305f1e312c83b640466e34eca0

Authored by Eric Fernandez
1 parent a77444589c
Exists in master

Implementación espera en spinner

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 const clean = require('gulp-clean');
12 12
13 var paths = { 13 var paths = {
14 srcJS: 'src/js/*.js', 14 srcJS: 'src/js/*.js',
15 srcViews: 'src/views/*.html', 15 srcViews: 'src/views/*.html',
16 tmp: 'tmp', 16 tmp: 'tmp',
17 dist: 'dist/' 17 dist: 'dist/'
18 }; 18 };
19 19
20 gulp.task('clean', function() { 20 gulp.task('clean', function() {
21 return gulp.src(['tmp', 'dist'], {read: false}) 21 return gulp.src(['tmp', 'dist'], {read: false})
22 .pipe(clean()); 22 .pipe(clean());
23 }); 23 });
24 24
25 gulp.task('templates', ['clean'], function() { 25 gulp.task('templates', ['clean'], function() {
26 return pump( 26 return pump(
27 [ 27 [
28 gulp.src(paths.srcViews), 28 gulp.src(paths.srcViews),
29 replace('views/', ''), 29 replace('views/', ''),
30 htmlmin(), 30 htmlmin(),
31 templateCache('views.js', { 31 templateCache('views.js', {
32 module: 'focaModalProveedor', 32 module: 'focaModalProveedor',
33 root: '' 33 root: ''
34 }), 34 }),
35 gulp.dest(paths.tmp) 35 gulp.dest(paths.tmp)
36 ] 36 ]
37 ); 37 );
38 }); 38 });
39 39
40 gulp.task('uglify', ['templates'], function() { 40 gulp.task('uglify', ['templates'], function() {
41 return pump( 41 return pump(
42 [ 42 [
43 gulp.src([ 43 gulp.src([
44 paths.srcJS, 44 paths.srcJS,
45 'tmp/views.js' 45 'tmp/views.js'
46 ]), 46 ]),
47 concat('foca-modal-proveedor.js'), 47 concat('foca-modal-proveedor.js'),
48 replace('src/views/', ''), 48 replace('src/views/', ''),
49 replace("['ui.bootstrap', 'focaDirectivas']", '[]'), 49 replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'),
50 gulp.dest(paths.tmp), 50 gulp.dest(paths.tmp),
51 rename('foca-modal-proveedor.min.js'), 51 rename('foca-modal-proveedor.min.js'),
52 uglify(), 52 uglify(),
53 gulp.dest(paths.dist) 53 gulp.dest(paths.dist)
54 ] 54 ]
55 ); 55 );
56 }); 56 });
57 57
58 gulp.task('pre-commit', function() { 58 gulp.task('pre-commit', function() {
59 return pump( 59 return pump(
60 [ 60 [
61 gulp.src(paths.srcJS), 61 gulp.src(paths.srcJS),
62 jshint('.jshintrc'), 62 jshint('.jshintrc'),
63 jshint.reporter('default'), 63 jshint.reporter('default'),
64 jshint.reporter('fail') 64 jshint.reporter('fail')
65 ] 65 ]
66 ); 66 );
67 67
68 gulp.start('uglify'); 68 gulp.start('uglify');
69 }); 69 });
70 70
71 gulp.task('webserver', function() { 71 gulp.task('webserver', function() {
72 pump [ 72 pump [
73 connect.server({port: 3000}) 73 connect.server({port: 3000})
74 ] 74 ]
75 }); 75 });
76 76
77 gulp.task('clean-post-install', function() { 77 gulp.task('clean-post-install', function() {
78 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 78 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
79 'index.html'], {read: false}) 79 'index.html'], {read: false})
80 .pipe(clean()); 80 .pipe(clean());
81 }); 81 });
82 82
83 gulp.task('default', ['webserver']); 83 gulp.task('default', ['webserver']);
84 84
85 gulp.task('watch', function() { 85 gulp.task('watch', function() {
86 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) 86 gulp.watch([paths.srcJS, paths.srcViews], ['uglify'])
87 }); 87 });
88 88
1 <html ng-app="focaModalProveedor"> 1 <html ng-app="focaModalProveedor">
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 src="src/etc/develop.js"></script> 30 <script src="src/etc/develop.js"></script>
27 31
28 <script type="text/javascript"> 32 <script type="text/javascript">
29 angular.module('focaModalProveedor') 33 angular.module('focaModalProveedor')
30 .controller('controller', ['$uibModal', '$timeout', function ($uibModal, $timeout) { 34 .controller('controller', ['$uibModal', '$timeout', function ($uibModal, $timeout) {
31 openModal(); 35 openModal();
32 36
33 function openModal() { 37 function openModal() {
34 var modalInstance = $uibModal.open( 38 var modalInstance = $uibModal.open(
35 { 39 {
36 ariaLabelledBy: 'Busqueda de Proveedores', 40 ariaLabelledBy: 'Busqueda de Proveedores',
37 templateUrl: 'src/views/modal-proveedor.html', 41 templateUrl: 'src/views/modal-proveedor.html',
38 controller: 'focaModalProveedorCtrl', 42 controller: 'focaModalProveedorCtrl',
39 size: 'lg' 43 size: 'lg'
40 } 44 }
41 ); 45 );
42 46
43 modalInstance.result.then( 47 modalInstance.result.then(
44 function (selectedItem) { 48 function (selectedItem) {
45 console.info(selectedItem); 49 console.info(selectedItem);
46 $timeout(openModal, 500); 50 $timeout(openModal, 500);
47 }, function () { 51 }, function () {
48 console.info('modal-component dismissed at: ' + new Date()); 52 console.info('modal-component dismissed at: ' + new Date());
49 $timeout(openModal, 500); 53 $timeout(openModal, 500);
50 } 54 }
51 ); 55 );
52 } 56 }
53 }]); 57 }]);
54 </script> 58 </script>
55 </head> 59 </head>
56 60
57 <body ng-controller="controller"> 61 <body ng-controller="controller">
58 <style> 62 <style>
59 .p-5 { 63 .p-5 {
60 padding: 5px !important; 64 padding: 5px !important;
61 } 65 }
62 </style> 66 </style>
63 </body> 67 </body>
64 68
65 </html> 69 </html>
1 { 1 {
2 "name": "foca-modal-proveedor", 2 "name": "foca-modal-proveedor",
3 "version": "0.0.2", 3 "version": "0.0.2",
4 "description": "Modal para seleccionar proveedores", 4 "description": "Modal para seleccionar proveedores",
5 "scripts": { 5 "scripts": {
6 "test": "echo \"Error: no test specified\" && exit 1", 6 "test": "echo \"Error: no test specified\" && exit 1",
7 "gulp-pre-commit": "gulp pre-commit", 7 "gulp-pre-commit": "gulp pre-commit",
8 "compile": "gulp uglify", 8 "compile": "gulp uglify",
9 "postinstall": "npm run compile && gulp clean-post-install", 9 "postinstall": "npm run compile && gulp clean-post-install",
10 "install-dev": "npm install angular bootstrap jquery font-awesome gulp gulp-concat gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-clean jshint pump gulp-connect gulp-uglify jasmine-core pre-commit gulp-angular-templatecache ui-bootstrap4 gulp-htmlmin git+https://debo.suite.repo/modulos-npm/foca-directivas" 10 "install-dev": "npm install -D angular angular-ladda ladda@1.0.6 bootstrap jquery font-awesome gulp gulp-concat gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-clean jshint pump gulp-connect gulp-uglify jasmine-core pre-commit gulp-angular-templatecache ui-bootstrap4 gulp-htmlmin git+https://debo.suite.repo/modulos-npm/foca-directivas"
11 }, 11 },
12 "pre-commit": [ 12 "pre-commit": [
13 "gulp-pre-commit" 13 "gulp-pre-commit"
14 ], 14 ],
15 "repository": { 15 "repository": {
16 "type": "git", 16 "type": "git",
17 "url": "https://debo.suite.repo/modulos-npm/foca-modal-proveedor" 17 "url": "https://debo.suite.repo/modulos-npm/foca-modal-proveedor"
18 }, 18 },
19 "author": "Nicolás Guarnieri", 19 "author": "Nicolás Guarnieri",
20 "license": "ISC", 20 "license": "ISC",
21 "peerDependencies": { 21 "peerDependencies": {
22 "angular": "^1.7.4", 22 "angular": "^1.7.4",
23 "bootstrap": "^4.1.3", 23 "bootstrap": "^4.1.3",
24 "font-awesome": "^4.7.0", 24 "font-awesome": "^4.7.0",
25 "ui-bootstrap4": "^3.0.4", 25 "ui-bootstrap4": "^3.0.4",
26 "gulp": "^3.9.1", 26 "gulp": "^3.9.1",
27 "gulp-angular-templatecache": "^2.2.1", 27 "gulp-angular-templatecache": "^2.2.1",
28 "gulp-clean": "^0.4.0", 28 "gulp-clean": "^0.4.0",
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://debo.suite.repo/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://debo.suite.repo/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.3", 46 "gulp-angular-templatecache": "^2.2.3",
46 "gulp-clean": "^0.4.0", 47 "gulp-clean": "^0.4.0",
47 "gulp-concat": "^2.6.1", 48 "gulp-concat": "^2.6.1",
48 "gulp-connect": "^5.6.1", 49 "gulp-connect": "^5.6.1",
49 "gulp-htmlmin": "^5.0.1", 50 "gulp-htmlmin": "^5.0.1",
50 "gulp-jshint": "^2.1.0", 51 "gulp-jshint": "^2.1.0",
51 "gulp-rename": "^1.4.0", 52 "gulp-rename": "^1.4.0",
52 "gulp-replace": "^1.0.0", 53 "gulp-replace": "^1.0.0",
53 "gulp-uglify": "^3.0.1", 54 "gulp-uglify": "^3.0.1",
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.6", 58 "jshint": "^2.9.6",
59 "ladda": "1.0.6",
57 "pre-commit": "^1.2.2", 60 "pre-commit": "^1.2.2",
58 "pump": "^3.0.0", 61 "pump": "^3.0.0",
59 "ui-bootstrap4": "^3.0.5" 62 "ui-bootstrap4": "^3.0.5"
60 },
61 "dependencies": {
62 "gulp-uglify-es": "^1.0.4"
1 angular.module('focaModalProveedor', ['ui.bootstrap', 'focaDirectivas']); 1 angular.module('focaModalProveedor', ['ui.bootstrap', 'focaDirectivas', 'angular-ladda']);
2 2
src/js/controller.js
1 angular.module('focaModalProveedor') 1 angular.module('focaModalProveedor')
2 .controller('focaModalProveedorCtrl', [ 2 .controller('focaModalProveedorCtrl', [
3 '$filter', 3 '$filter',
4 '$scope', 4 '$scope',
5 '$uibModalInstance', 5 '$uibModalInstance',
6 'focaModalProveedorService', 6 'focaModalProveedorService',
7 function ($filter, $scope, $uibModalInstance, focaModalProveedorService) { 7 function ($filter, $scope, $uibModalInstance, focaModalProveedorService) {
8 8
9 $scope.filters = ''; 9 $scope.filters = '';
10 $scope.primerBusqueda = false; 10 $scope.primerBusqueda = false;
11 // pagination 11 // pagination
12 $scope.numPerPage = 10; 12 $scope.numPerPage = 10;
13 $scope.currentPage = 1; 13 $scope.currentPage = 1;
14 $scope.filteredProveedores = []; 14 $scope.filteredProveedores = [];
15 $scope.currentPageProveedores = []; 15 $scope.currentPageProveedores = [];
16 $scope.selectedProveedores = -1; 16 $scope.selectedProveedores = -1;
17 17
18 $scope.busquedaPress = function(key) { 18 $scope.busquedaPress = function(key) {
19 if (key === 13) { 19 if (key === 13) {
20 $scope.searchLoading = true;
20 var json = { 21 var json = {
21 razonCuitCod: $scope.filters 22 razonCuitCod: $scope.filters
22 }; 23 };
23 focaModalProveedorService.getProveedores(json).then( 24 focaModalProveedorService.getProveedores(json).then(
24 function (res) { 25 function(res) {
25 for (var i = res.data.length - 1; i >= 0; i--) { 26 for (var i = res.data.length - 1; i >= 0; i--) {
26 if (res.data[i].COD === 0) { 27 if (res.data[i].COD === 0) {
27 delete res.data[i]; 28 delete res.data[i];
28 } 29 }
29 } 30 }
30 $scope.primerBusqueda = true; 31 $scope.primerBusqueda = true;
31 $scope.proveedores = res.data; 32 $scope.proveedores = res.data;
32 $scope.search(); 33 $scope.search();
33 primera(); 34 primera();
35 $scope.searchLoading = false;
34 }); 36 });
35 } 37 }
36 }; 38 };
37 39
38 $scope.search = function () { 40 $scope.search = function () {
39 $scope.filteredProveedores = $filter('filter')( 41 $scope.filteredProveedores = $filter('filter')(
40 $scope.proveedores, {$: $scope.filters} 42 $scope.proveedores, {$: $scope.filters}
41 ); 43 );
42 44
43 $scope.lastPage = Math.ceil( 45 $scope.lastPage = Math.ceil(
44 $scope.filteredProveedores.length / $scope.numPerPage 46 $scope.filteredProveedores.length / $scope.numPerPage
45 ); 47 );
46 48
47 $scope.resetPage(); 49 $scope.resetPage();
48 }; 50 };
49 51
50 $scope.resetPage = function () { 52 $scope.resetPage = function () {
51 $scope.currentPage = 1; 53 $scope.currentPage = 1;
52 $scope.selectPage(1); 54 $scope.selectPage(1);
53 }; 55 };
54 56
55 $scope.selectPage = function (page) { 57 $scope.selectPage = function (page) {
56 console.info(page); 58 console.info(page);
57 var start = (page - 1) * $scope.numPerPage; 59 var start = (page - 1) * $scope.numPerPage;
58 var end = start + $scope.numPerPage; 60 var end = start + $scope.numPerPage;
59 $scope.paginas = []; 61 $scope.paginas = [];
60 $scope.paginas = calcularPages(page); 62 $scope.paginas = calcularPages(page);
61 $scope.currentPageProveedores = $scope.filteredProveedores.slice(start, end); 63 $scope.currentPageProveedores = $scope.filteredProveedores.slice(start, end);
62 $scope.currentPage = page; 64 $scope.currentPage = page;
63 }; 65 };
64 66
65 $scope.select = function(proveedor) { 67 $scope.select = function(proveedor) {
66 $uibModalInstance.close(proveedor); 68 $uibModalInstance.close(proveedor);
67 }; 69 };
68 70
69 $scope.cancel = function() { 71 $scope.cancel = function() {
70 $uibModalInstance.dismiss('cancel'); 72 $uibModalInstance.dismiss('cancel');
71 }; 73 };
72 74
73 $scope.busquedaDown = function(key) { 75 $scope.busquedaDown = function(key) {
74 if (key === 40) { 76 if (key === 40) {
75 primera(key); 77 primera(key);
76 } 78 }
77 }; 79 };
78 80
79 $scope.itemProveedor = function(key) { 81 $scope.itemProveedor = function(key) {
80 if (key === 38) { 82 if (key === 38) {
81 anterior(key); 83 anterior(key);
82 } 84 }
83 85
84 if (key === 40) { 86 if (key === 40) {
85 siguiente(key); 87 siguiente(key);
86 } 88 }
87 89
88 if (key === 37) { 90 if (key === 37) {
89 retrocederPagina(); 91 retrocederPagina();
90 } 92 }
91 93
92 if (key === 39) { 94 if (key === 39) {
93 avanzarPagina(); 95 avanzarPagina();
94 } 96 }
95 }; 97 };
96 98
97 function calcularPages(paginaActual) { 99 function calcularPages(paginaActual) {
98 var paginas = []; 100 var paginas = [];
99 paginas.push(paginaActual); 101 paginas.push(paginaActual);
100 102
101 if (paginaActual - 1 > 1) { 103 if (paginaActual - 1 > 1) {
102 104
103 paginas.unshift(paginaActual - 1); 105 paginas.unshift(paginaActual - 1);
104 if (paginaActual - 2 > 1) { 106 if (paginaActual - 2 > 1) {
105 paginas.unshift(paginaActual - 2); 107 paginas.unshift(paginaActual - 2);
106 } 108 }
107 } 109 }
108 110
109 if (paginaActual + 1 < $scope.lastPage) { 111 if (paginaActual + 1 < $scope.lastPage) {
110 paginas.push(paginaActual + 1); 112 paginas.push(paginaActual + 1);
111 if (paginaActual + 2 < $scope.lastPage) { 113 if (paginaActual + 2 < $scope.lastPage) {
112 paginas.push(paginaActual + 2); 114 paginas.push(paginaActual + 2);
113 } 115 }
114 } 116 }
115 117
116 if (paginaActual !== 1) { 118 if (paginaActual !== 1) {
117 paginas.unshift(1); 119 paginas.unshift(1);
118 } 120 }
119 121
120 if (paginaActual !== $scope.lastPage) { 122 if (paginaActual !== $scope.lastPage) {
121 paginas.push($scope.lastPage); 123 paginas.push($scope.lastPage);
122 } 124 }
123 125
124 return paginas; 126 return paginas;
125 } 127 }
126 128
127 function primera() { 129 function primera() {
128 $scope.selectedProveedores = 0; 130 $scope.selectedProveedores = 0;
129 } 131 }
130 132
131 function anterior() { 133 function anterior() {
132 if ($scope.selectedProveedores === 0 && $scope.currentPage > 1) { 134 if ($scope.selectedProveedores === 0 && $scope.currentPage > 1) {
133 retrocederPagina(); 135 retrocederPagina();
134 } else { 136 } else {
135 $scope.selectedProveedores--; 137 $scope.selectedProveedores--;
136 } 138 }
137 } 139 }
138 140
139 function siguiente() { 141 function siguiente() {
140 if ($scope.selectedProveedores < $scope.currentPageProveedores.length - 1 ) { 142 if ($scope.selectedProveedores < $scope.currentPageProveedores.length - 1 ) {
141 $scope.selectedProveedores++; 143 $scope.selectedProveedores++;
142 } else { 144 } else {
143 avanzarPagina(); 145 avanzarPagina();
144 } 146 }
145 } 147 }
146 148
147 function retrocederPagina() { 149 function retrocederPagina() {
148 if ($scope.currentPage > 1) { 150 if ($scope.currentPage > 1) {
149 $scope.selectPage($scope.currentPage - 1); 151 $scope.selectPage($scope.currentPage - 1);
150 $scope.selectedProveedores = $scope.numPerPage - 1; 152 $scope.selectedProveedores = $scope.numPerPage - 1;
151 } 153 }
152 } 154 }
153 155
154 function avanzarPagina() { 156 function avanzarPagina() {
155 if ($scope.currentPage < $scope.lastPage) { 157 if ($scope.currentPage < $scope.lastPage) {
156 $scope.selectPage($scope.currentPage + 1); 158 $scope.selectPage($scope.currentPage + 1);
157 $scope.selectedProveedores = 0; 159 $scope.selectedProveedores = 0;
158 } 160 }
159 } 161 }
160 }] 162 }]
161 ); 163 );
162 164
src/views/modal-proveedor.html
1 <div class="modal-header py-1"> 1 <div class="modal-header py-1">
2 <h5 class="modal-title">Búsqueda de Proveedor</h5> 2 <h5 class="modal-title">Búsqueda de Proveedor</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"> 5 <div class="input-group">
6 <input 6 <input
7 ladda="searchLoading"
7 type="text" 8 type="text"
8 class="form-control" 9 class="form-control"
9 placeholder="Busqueda" 10 placeholder="Busqueda"
10 ng-model="filters" 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="selectedProveedores == -1" 15 foca-focus="selectedProveedores == -1"
15 ng-focus="selectedProveedores = -1" 16 ng-focus="selectedProveedores = -1"
16 > 17 >
17 <div class="input-group-append"> 18 <div class="input-group-append">
18 <button class="btn btn-outline-secondary" type="button" ng-click="busquedaPress(13)"> 19 <button
19 <i class="fa fa-search" aria-hidden="true"></i> 20 ladda="searchLoading"
20 </button> 21 class="btn btn-outline-secondary"
22 type="button"
23 ng-click="busquedaPress(13)">
24 <i class="fa fa-search" aria-hidden="true"></i>
25 </button>
21 </div> 26 </div>
22 </div> 27 </div>
23 <table ng-show="primerBusqueda" class="table table-striped table-sm"> 28 <table ng-show="primerBusqueda" class="table table-striped table-sm">
24 <thead> 29 <thead>
25 <tr> 30 <tr>
26 <th>Código</th> 31 <th>Código</th>
27 <th>Nombre</th> 32 <th>Nombre</th>
28 <th>CUIT</th> 33 <th>CUIT</th>
29 <th></th> 34 <th></th>
30 </tr> 35 </tr>
31 </thead> 36 </thead>
32 <tbody> 37 <tbody>
33 <tr ng-show="currentPageProveedores.length == 0 && primerBusqueda"> 38 <tr ng-show="currentPageProveedores.length == 0 && primerBusqueda">
34 <td colspan="4"> 39 <td colspan="4">
35 No se encontraron resultados. 40 No se encontraron resultados.
36 </td> 41 </td>
37 </tr> 42 </tr>
38 <tr 43 <tr
39 class="selectable" 44 class="selectable"
40 ng-repeat="(key, proveedor) in currentPageProveedores" 45 ng-repeat="(key, proveedor) in currentPageProveedores"
41 ng-click="select(proveedor)"> 46 ng-click="select(proveedor)">
42 <td ng-bind="proveedor.COD"></td> 47 <td ng-bind="proveedor.COD"></td>
43 <td ng-bind="proveedor.NOM"></td> 48 <td ng-bind="proveedor.NOM"></td>
44 <td ng-bind="proveedor.CUIT"></td> 49 <td ng-bind="proveedor.CUIT"></td>
45 <td> 50 <td>
46 <button 51 <button
47 type="button" 52 type="button"
48 class="btn btn-xs p-1 float-right" 53 class="btn btn-xs p-1 float-right"
49 ng-class="{ 54 ng-class="{
50 'btn-secondary': selectedProveedores != key, 55 'btn-secondary': selectedProveedores != key,
51 'btn-primary': selectedProveedores == key 56 'btn-primary': selectedProveedores == key
52 }" 57 }"
53 ng-click="select(proveedor)" 58 ng-click="select(proveedor)"
54 foca-focus="selectedProveedores == {{key}}" 59 foca-focus="selectedProveedores == {{key}}"
55 ng-keydown="itemProveedor($event.keyCode)" 60 ng-keydown="itemProveedor($event.keyCode)"
56 > 61 >
57 <i class="fa fa-arrow-right" aria-hidden="true"></i> 62 <i class="fa fa-arrow-right" aria-hidden="true"></i>
58 </button> 63 </button>
59 </td> 64 </td>
60 </tr> 65 </tr>
61 </tbody> 66 </tbody>
62 </table> 67 </table>
63 <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda"> 68 <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda">
64 <ul class="pagination pagination-sm mb-0"> 69 <ul class="pagination pagination-sm mb-0">
65 <li class="page-item" ng-class="{'disabled': currentPage == 1}"> 70 <li class="page-item" ng-class="{'disabled': currentPage == 1}">
66 <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)"> 71 <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)">
67 <span aria-hidden="true">&laquo;</span> 72 <span aria-hidden="true">&laquo;</span>
68 <span class="sr-only">Anterior</span> 73 <span class="sr-only">Anterior</span>
69 </a> 74 </a>
70 </li> 75 </li>
71 <li 76 <li
72 class="page-item" 77 class="page-item"
73 ng-repeat="pagina in paginas" 78 ng-repeat="pagina in paginas"
74 ng-class="{'active': pagina == currentPage}" 79 ng-class="{'active': pagina == currentPage}"
75 > 80 >
76 <a 81 <a
77 class="page-link" 82 class="page-link"
78 href="#" 83 href="#"
79 ng-click="selectPage(pagina)" 84 ng-click="selectPage(pagina)"
80 ng-bind="pagina" 85 ng-bind="pagina"
81 ></a> 86 ></a>
82 </li> 87 </li>
83 <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> 88 <li class="page-item" ng-class="{'disabled': currentPage == lastPage}">
84 <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)"> 89 <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)">
85 <span aria-hidden="true">&raquo;</span> 90 <span aria-hidden="true">&raquo;</span>
86 <span class="sr-only">Siguiente</span> 91 <span class="sr-only">Siguiente</span>
87 </a> 92 </a>
88 </li> 93 </li>
89 </ul> 94 </ul>
90 </nav> 95 </nav>
91 </div> 96 </div>
92 <div class="modal-footer py-1"> 97 <div class="modal-footer py-1">
93 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> 98 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button>
94 </div> 99 </div>
95 100