Commit e3865afafb6639b7fda9bb2c73049cf6f9f18379
Exists in
master
conflicts
Showing
2 changed files
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaModalCobradores') |
2 | 2 | .controller('focaModalCobradoresController', [ |
3 | + '$timeout', | |
3 | 4 | '$filter', |
4 | 5 | '$scope', |
5 | 6 | '$uibModalInstance', |
6 | 7 | 'focaModalCobradoresService', |
7 | - function($filter, $scope, $uibModalInstance, focaModalCobradoresService) { | |
8 | + function($timeout, $filter, $scope, $uibModalInstance, focaModalCobradoresService) { | |
8 | 9 | |
9 | 10 | $scope.filters = ''; |
10 | 11 | $scope.cobradores = []; |
... | ... | @@ -25,14 +26,15 @@ angular.module('focaModalCobradores') |
25 | 26 | $scope.searchLoading = false; |
26 | 27 | $scope.primerBusqueda = true; |
27 | 28 | $scope.cobradores = res.data; |
28 | - $scope.search(); | |
29 | + $scope.search(true); | |
29 | 30 | primera(); |
30 | 31 | } |
31 | 32 | ); |
32 | 33 | } |
33 | 34 | }; |
34 | 35 | |
35 | - $scope.search = function() { | |
36 | + $scope.search = function(pressed) { | |
37 | + | |
36 | 38 | if($scope.cobradores.length > 0) { |
37 | 39 | $scope.filteredCobradores = $filter('filter')( |
38 | 40 | $scope.cobradores, { $: $scope.filters } |
... | ... | @@ -41,6 +43,12 @@ angular.module('focaModalCobradores') |
41 | 43 | $scope.filteredCobradores.length / $scope.numPerPage |
42 | 44 | ); |
43 | 45 | $scope.resetPage(); |
46 | + if(pressed && $scope.filteredCobradores.length === 0){ | |
47 | + $timeout(function() { | |
48 | + angular.element('#search')[0].focus(); | |
49 | + $scope.filters = ''; | |
50 | + }); | |
51 | + } | |
44 | 52 | } |
45 | 53 | }; |
46 | 54 |
src/views/modal-cobradores.html
1 | -<div class="modal-header"> | |
2 | - <h5 class="modal-title my-1">Búsqueda de cobradores</h5> | |
3 | -</div> | |
4 | -<div class="modal-body" id="modal-body"> | |
5 | - <div class="input-group"> | |
6 | - <input | |
7 | - ladda="searchLoading" | |
8 | - type="text" | |
9 | - class="form-control form-control-sm" | |
10 | - placeholder="Busqueda" | |
11 | - ng-model="filters" | |
12 | - ng-change="search()" | |
13 | - ng-keydown="busquedaDown($event.keyCode)" | |
14 | - ng-keypress="busquedaPress($event.keyCode)" | |
15 | - foca-focus="selectedCobrador == -1" | |
16 | - ng-focus="selectedCobrador = -1" | |
17 | - teclado-virtual | |
18 | - > | |
19 | - <div class="input-group-append"> | |
20 | - <button | |
1 | +<div class="modal-header py-1"> | |
2 | + <div class="row w-100"> | |
3 | + <div class="col-lg-6"> | |
4 | + <h5 class="modal-title my-1">Búsqueda de cobradores</h5> | |
5 | + </div> | |
6 | + <div class="input-group col-lg-6 pr-0 my-2"> | |
7 | + <input | |
21 | 8 | ladda="searchLoading" |
22 | - class="btn btn-outline-secondary" | |
23 | - type="button" | |
24 | - ng-click="busquedaPress(13)" | |
9 | + type="text" | |
10 | + class="form-control form-control-sm" | |
11 | + placeholder="Busqueda" | |
12 | + ng-model="filters" | |
13 | + ng-change="search()" | |
14 | + ng-keydown="busquedaDown($event.keyCode)" | |
15 | + ng-keypress="busquedaPress($event.keyCode)" | |
16 | + foca-focus="selectedCobrador == -1" | |
17 | + ng-focus="selectedCobrador = -1" | |
18 | + teclado-virtual | |
19 | + id="search" | |
25 | 20 | > |
26 | - <i class="fa fa-search" aria-hidden="true"></i> | |
27 | - </button> | |
21 | + <div class="input-group-append"> | |
22 | + <button | |
23 | + ladda="searchLoading" | |
24 | + class="btn btn-outline-secondary" | |
25 | + type="button" | |
26 | + ng-click="busquedaPress(13)" | |
27 | + > | |
28 | + <i class="fa fa-search" aria-hidden="true"></i> | |
29 | + </button> | |
30 | + </div> | |
28 | 31 | </div> |
29 | 32 | </div> |
33 | +</div> | |
34 | +<div class="modal-body" id="modal-body"> | |
35 | + | |
36 | + <div ng-show="!primerBusqueda"> | |
37 | + Debe realizar una primer búsqueda. | |
38 | + </div> | |
39 | + | |
30 | 40 | <table ng-show="primerBusqueda" class="table table-striped table-sm col-12"> |
31 | 41 | <thead> |
32 | 42 | <tr> |
... | ... | @@ -48,7 +58,7 @@ |
48 | 58 | <td ng-bind="cobrador.id"></td> |
49 | 59 | <td ng-bind="cobrador.nombre"></td> |
50 | 60 | <td class="d-md-none text-primary"> |
51 | - <i class="fa fa-arrow-right" aria-hidden="true"></i> | |
61 | + <i class="fa fa-circle-thin" aria-hidden="true"></i> | |
52 | 62 | </td> |
53 | 63 | <td class="d-none d-md-table-cell"> |
54 | 64 | <button |
... | ... | @@ -60,13 +70,15 @@ |
60 | 70 | }" |
61 | 71 | foca-focus="selectedCobrador == {{key}}" |
62 | 72 | ng-keydown="itemCobrador($event.keyCode)"> |
63 | - <i class="fa fa-arrow-right" aria-hidden="true"></i> | |
73 | + <i class="fa fa-circle-thin" aria-hidden="true"></i> | |
64 | 74 | </button> |
65 | 75 | </td> |
66 | 76 | </tr> |
67 | 77 | </tbody> |
68 | 78 | </table> |
69 | - <nav ng-show="currentPageCobradores.length > 0 && primerBusqueda"> | |
79 | +</div> | |
80 | +<div class="modal-footer py-1"> | |
81 | + <nav ng-show="currentPageCobradores.length > 0 && primerBusqueda" class="mr-auto"> | |
70 | 82 | <ul class="pagination pagination-sm justify-content mb-0"> |
71 | 83 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
72 | 84 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> |
... | ... | @@ -94,7 +106,5 @@ |
94 | 106 | </li> |
95 | 107 | </ul> |
96 | 108 | </nav> |
97 | -</div> | |
98 | -<div class="modal-footer"> | |
99 | 109 | <button class="btn btn-sm btn-secondary my-1" type="button" ng-click="cancel()">Cancelar</button> |
100 | 110 | </div> |