Commit eff99c353aa70f305f1e312c83b640466e34eca0
1 parent
a77444589c
Exists in
master
Implementación espera en spinner
Showing
6 changed files
with
21 additions
and
10 deletions
Show diff stats
gulpfile.js
| ... | ... | @@ -46,7 +46,7 @@ gulp.task('uglify', ['templates'], function() { |
| 46 | 46 | ]), |
| 47 | 47 | concat('foca-modal-proveedor.js'), |
| 48 | 48 | replace('src/views/', ''), |
| 49 | - replace("['ui.bootstrap', 'focaDirectivas']", '[]'), | |
| 49 | + replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'), | |
| 50 | 50 | gulp.dest(paths.tmp), |
| 51 | 51 | rename('foca-modal-proveedor.min.js'), |
| 52 | 52 | uglify(), |
index.html
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | <!--CSS--> |
| 8 | 8 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> |
| 9 | 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 | 12 | <!--VENDOR JS--> |
| 12 | 13 | <script src="node_modules/jquery/dist/jquery.min.js"></script> |
| ... | ... | @@ -14,6 +15,9 @@ |
| 14 | 15 | <script src="node_modules/angular/angular.min.js"></script> |
| 15 | 16 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> |
| 16 | 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 | 22 | <!-- BUILD --> |
| 19 | 23 | <script src="src/js/app.js"></script> |
package.json
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | "gulp-pre-commit": "gulp pre-commit", |
| 8 | 8 | "compile": "gulp uglify", |
| 9 | 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 | 12 | "pre-commit": [ |
| 13 | 13 | "gulp-pre-commit" |
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 | }, |
| 39 | 39 | "devDependencies": { |
| 40 | 40 | "angular": "^1.7.5", |
| 41 | + "angular-ladda": "^0.4.3", | |
| 41 | 42 | "bootstrap": "^4.1.3", |
| 42 | 43 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas", |
| 43 | 44 | "font-awesome": "^4.7.0", |
| ... | ... | @@ -51,14 +52,13 @@ |
| 51 | 52 | "gulp-rename": "^1.4.0", |
| 52 | 53 | "gulp-replace": "^1.0.0", |
| 53 | 54 | "gulp-uglify": "^3.0.1", |
| 55 | + "gulp-uglify-es": "^1.0.4", | |
| 54 | 56 | "jasmine-core": "^3.3.0", |
| 55 | 57 | "jquery": "^3.3.1", |
| 56 | 58 | "jshint": "^2.9.6", |
| 59 | + "ladda": "1.0.6", | |
| 57 | 60 | "pre-commit": "^1.2.2", |
| 58 | 61 | "pump": "^3.0.0", |
| 59 | 62 | "ui-bootstrap4": "^3.0.5" |
| 60 | - }, | |
| 61 | - "dependencies": { | |
| 62 | - "gulp-uglify-es": "^1.0.4" | |
| 63 | 63 | } |
| 64 | 64 | } |
src/js/app.js
src/js/controller.js
| ... | ... | @@ -17,11 +17,12 @@ angular.module('focaModalProveedor') |
| 17 | 17 | |
| 18 | 18 | $scope.busquedaPress = function(key) { |
| 19 | 19 | if (key === 13) { |
| 20 | + $scope.searchLoading = true; | |
| 20 | 21 | var json = { |
| 21 | 22 | razonCuitCod: $scope.filters |
| 22 | 23 | }; |
| 23 | 24 | focaModalProveedorService.getProveedores(json).then( |
| 24 | - function (res) { | |
| 25 | + function(res) { | |
| 25 | 26 | for (var i = res.data.length - 1; i >= 0; i--) { |
| 26 | 27 | if (res.data[i].COD === 0) { |
| 27 | 28 | delete res.data[i]; |
| ... | ... | @@ -31,6 +32,7 @@ angular.module('focaModalProveedor') |
| 31 | 32 | $scope.proveedores = res.data; |
| 32 | 33 | $scope.search(); |
| 33 | 34 | primera(); |
| 35 | + $scope.searchLoading = false; | |
| 34 | 36 | }); |
| 35 | 37 | } |
| 36 | 38 | }; |
src/views/modal-proveedor.html
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | <div class="modal-body" id="modal-body"> |
| 5 | 5 | <div class="input-group"> |
| 6 | 6 | <input |
| 7 | + ladda="searchLoading" | |
| 7 | 8 | type="text" |
| 8 | 9 | class="form-control" |
| 9 | 10 | placeholder="Busqueda" |
| ... | ... | @@ -15,9 +16,13 @@ |
| 15 | 16 | ng-focus="selectedProveedores = -1" |
| 16 | 17 | > |
| 17 | 18 | <div class="input-group-append"> |
| 18 | - <button class="btn btn-outline-secondary" type="button" ng-click="busquedaPress(13)"> | |
| 19 | - <i class="fa fa-search" aria-hidden="true"></i> | |
| 20 | - </button> | |
| 19 | + <button | |
| 20 | + ladda="searchLoading" | |
| 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 | 26 | </div> |
| 22 | 27 | </div> |
| 23 | 28 | <table ng-show="primerBusqueda" class="table table-striped table-sm"> |