Commit faaeecf95f46850c39fbce57dd37de4b4c4ee10b
1 parent
2e13603cfa
Exists in
master
and in
2 other branches
cambio en busqueda-busqueda por cliente o remito
Showing
2 changed files
with
61 additions
and
11 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -14,7 +14,8 @@ angular.module('focaModalRemito') |
14 | 14 | var fecha = new Date(); |
15 | 15 | $scope.fechaHasta = new Date(); |
16 | 16 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); |
17 | - $scope.filters = ''; | |
17 | + $scope.filtersCliente = ''; | |
18 | + $scope.filtersRemito = ''; | |
18 | 19 | $scope.remitos = []; |
19 | 20 | $scope.isCollapsed = false; |
20 | 21 | $scope.verProductos = {}; |
... | ... | @@ -53,6 +54,7 @@ angular.module('focaModalRemito') |
53 | 54 | .then(llenarDatos); |
54 | 55 | } |
55 | 56 | }; |
57 | + | |
56 | 58 | function llenarDatos(res) { |
57 | 59 | $scope.remitos = []; |
58 | 60 | $scope.filteredRemitos = []; |
... | ... | @@ -64,17 +66,40 @@ angular.module('focaModalRemito') |
64 | 66 | $scope.search(true); |
65 | 67 | primera(); |
66 | 68 | } |
67 | - $scope.search = function(pressed) { | |
69 | + | |
70 | + $scope.searchRemito = function(pressed) { | |
71 | + if($scope.remitos.length > 0) { | |
72 | + $scope.filteredRemitos = $filter('filter')( | |
73 | + $scope.remitos, | |
74 | + {numeroRemito: $scope.filtersRemito} | |
75 | + ); | |
76 | + | |
77 | + if(pressed && $scope.filteredRemitos.length === 0){ | |
78 | + $timeout(function() { | |
79 | + angular.element('#search')[0].focus(); | |
80 | + $scope.filtersRemito = ''; | |
81 | + }); | |
82 | + } | |
83 | + | |
84 | + $scope.lastPage = Math.ceil( | |
85 | + $scope.filteredRemitos.length / $scope.numPerPage | |
86 | + ); | |
87 | + | |
88 | + $scope.resetPage(); | |
89 | + } | |
90 | + } | |
91 | + | |
92 | + $scope.searchCliente = function(pressed) { | |
68 | 93 | if($scope.remitos.length > 0) { |
69 | 94 | $scope.filteredRemitos = $filter('filter')( |
70 | 95 | $scope.remitos, |
71 | - {$: $scope.filters} | |
96 | + {nombreCliente: $scope.filtersCliente} | |
72 | 97 | ); |
73 | 98 | |
74 | 99 | if(pressed && $scope.filteredRemitos.length === 0){ |
75 | 100 | $timeout(function() { |
76 | 101 | angular.element('#search')[0].focus(); |
77 | - $scope.filters = ''; | |
102 | + $scope.filtersCliente = ''; | |
78 | 103 | }); |
79 | 104 | } |
80 | 105 |
src/views/foca-modal-remito.html
... | ... | @@ -4,13 +4,37 @@ |
4 | 4 | <h5 class="modal-title my-1">Búsqueda de Remito</h5> |
5 | 5 | </div> |
6 | 6 | <div class="input-group col-lg-6 pr-0 my-2"> |
7 | + <div class="mr-4"> | |
8 | + <input | |
9 | + ladda="searchLoading" | |
10 | + type="text" | |
11 | + class="form-control form-control-sm" | |
12 | + placeholder="CLIENTE" | |
13 | + ng-model="filtersCliente" | |
14 | + ng-change="searchCliente()" | |
15 | + ng-keydown="busquedaDown($event.keyCode)" | |
16 | + ng-keypress="busquedaPress($event.keyCode)" | |
17 | + foca-focus="selectedRemito == -1" | |
18 | + ng-focus="selectedRemito = -1" | |
19 | + id="search" | |
20 | + teclado-virtual | |
21 | + > | |
22 | + <button | |
23 | + ng-show="filtersCliente.length >= 1" | |
24 | + type="button" | |
25 | + class="clear-input" | |
26 | + ng-click="filtersCliente = ''" | |
27 | + > | |
28 | + <i class="fa fa-times"></i> | |
29 | + </button> | |
30 | + </div> | |
7 | 31 | <input |
8 | 32 | ladda="searchLoading" |
9 | 33 | type="text" |
10 | 34 | class="form-control form-control-sm" |
11 | - placeholder="Razón social" | |
12 | - ng-model="filters" | |
13 | - ng-change="search()" | |
35 | + placeholder="REMITO" | |
36 | + ng-model="filtersRemito" | |
37 | + ng-change="searchRemito()" | |
14 | 38 | ng-keydown="busquedaDown($event.keyCode)" |
15 | 39 | ng-keypress="busquedaPress($event.keyCode)" |
16 | 40 | foca-focus="selectedRemito == -1" |
... | ... | @@ -18,14 +42,15 @@ |
18 | 42 | id="search" |
19 | 43 | teclado-virtual |
20 | 44 | > |
45 | + | |
21 | 46 | <button |
22 | - ng-show="filters.length >= 1" | |
47 | + ng-show="filtersRemito.length >= 1" | |
23 | 48 | type="button" |
24 | 49 | class="clear-input" |
25 | - ng-click="filters = ''" | |
50 | + ng-click="filtersRemito = ''" | |
26 | 51 | > |
27 | 52 | <i class="fa fa-times"></i> |
28 | - </button> | |
53 | + </button> | |
29 | 54 | <div class="input-group-append"> |
30 | 55 | <button |
31 | 56 | ladda="searchLoading" |
... | ... | @@ -37,9 +62,9 @@ |
37 | 62 | <i class="fa fa-search" aria-hidden="true"></i> |
38 | 63 | </button> |
39 | 64 | </div> |
65 | + | |
40 | 66 | </div> |
41 | 67 | </div> |
42 | - | |
43 | 68 | </div> |
44 | 69 | <div class="modal-body" id="modal-body"> |
45 | 70 | <div class="input-group row"> |