Commit 03513d79b520e8d1a20436f74594d190c01e21f8

Authored by Jose Pinto
1 parent a4b5f5da03
Exists in master

buscador sin resultados hace focus

... ... @@ -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 -D angular angular-ladda bootstrap font-awesome gulp gulp-angular-templatecache gulp-clean gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify jasmine-core jquery jshint ladda@1.0.6 pre-commit pump ui-bootstrap4 && npm i -D git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git"
  10 + "install-dev": "npm install -D angular angular-ladda bootstrap font-awesome gulp gulp-angular-templatecache gulp-clean gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify jasmine-core jquery jshint ladda@1.0.6 pre-commit pump ui-bootstrap4 && npm i -D git+ssh://git@git.focasoftware.com:npm/foca-directivas.git"
11 11 },
12 12 "pre-commit": [
13 13 "gulp-pre-commit"
... ... @@ -33,13 +33,13 @@
33 33 "gulp-uglify": "^3.0.1",
34 34 "jquery": "^3.3.1",
35 35 "pump": "^3.0.0",
36   - "foca-directivas": "git+ssh://git@debonline.dyndns.org:npm/foca-directivas"
  36 + "foca-directivas": "git+ssh://git@git.focasoftware.com:npm/foca-directivas.git"
37 37 },
38 38 "devDependencies": {
39 39 "angular": "1.7.5",
40 40 "angular-ladda": "0.4.3",
41 41 "bootstrap": "4.1.3",
42   - "foca-directivas": "git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git",
  42 + "foca-directivas": "git+ssh://git@git.focasoftware.com:npm/foca-directivas.git",
43 43 "font-awesome": "4.7.0",
44 44 "gulp": "3.9.1",
45 45 "gulp-angular-templatecache": "2.2.5",
src/js/controller.js
1 1 angular.module('focaModalChofer')
2 2 .controller('focaModalChoferController',
3 3 [
  4 + '$timeout',
4 5 '$filter',
5 6 '$scope',
6 7 '$uibModalInstance',
7 8 'focaModalChoferService',
8   - function($filter, $scope, $uibModalInstance,
  9 + function($timeout, $filter, $scope, $uibModalInstance,
9 10 focaModalChoferService
10 11 ) {
11 12  
... ... @@ -31,21 +32,29 @@ angular.module('focaModalChofer')
31 32 $scope.searchLoading = false;
32 33 $scope.primerBusqueda = true;
33 34 $scope.choferes = res.data;
34   - $scope.search();
  35 + $scope.search(true);
35 36 primera();
36 37 }
37   - $scope.search = function() {
  38 + $scope.search = function(pressed) {
38 39 if($scope.choferes.length > 0) {
39 40 $scope.filteredChoferes = $filter('filter')(
40 41 $scope.choferes,
41 42 {$: $scope.filters}
42 43 );
43 44  
  45 + if(pressed && $scope.filteredChoferes.length === 0){
  46 + $timeout(function() {
  47 + angular.element('#search')[0].focus();
  48 + $scope.filters = '';
  49 + });
  50 + }
  51 +
44 52 $scope.lastPage = Math.ceil(
45 53 $scope.filteredChoferes.length / $scope.numPerPage
46 54 );
47 55  
48 56 $scope.resetPage();
  57 +
49 58 }
50 59 };
51 60  
src/views/modal-chofer.html
1 1 <div class="modal-header py-1">
2 2 <div class="row w-100">
3 3 <div class="col-lg-6">
4   - <h5 class="modal-title my-1">Busqueda de Chofer</h5>
  4 + <h5 class="modal-title my-1">Búsqueda de Chofer</h5>
5 5 </div>
6 6 <div class="input-group col-lg-6 pr-0 my-2">
7 7 <input
8 8 ladda="searchLoading"
9 9 type="text"
10 10 class="form-control"
11   - placeholder="Busqueda"
  11 + id="search"
  12 + placeholder="Búsqueda"
12 13 ng-model="filters"
13 14 ng-change="search()"
14 15 ng-keydown="busquedaDown($event.keyCode)"