Commit 72406e4b5fa4fccbf378817f2e689b1c481f1c72
1 parent
97d48a46a6
Exists in
master
and in
2 other branches
agrego date's
Showing
3 changed files
with
57 additions
and
7 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -5,10 +5,13 @@ angular.module('focaModalRemito') |
5 | 5 | '$scope', |
6 | 6 | '$uibModalInstance', |
7 | 7 | 'focaModalRemitoService', |
8 | + 'usadoPor', | |
8 | 9 | function($filter, $scope, $uibModalInstance, |
9 | - focaModalRemitoService | |
10 | + focaModalRemitoService, usadoPor | |
10 | 11 | ) { |
11 | - | |
12 | + var fecha = new Date(); | |
13 | + $scope.fechaHasta = new Date(); | |
14 | + $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); | |
12 | 15 | $scope.filters = ''; |
13 | 16 | $scope.remitos = []; |
14 | 17 | $scope.primerBusqueda = false; |
... | ... | @@ -24,10 +27,18 @@ angular.module('focaModalRemito') |
24 | 27 | $scope.busquedaPress = function(key) { |
25 | 28 | if (key === 13) { |
26 | 29 | $scope.searchLoading = true; |
27 | - focaModalRemitoService.getRemitos().then(llenarDatos); | |
30 | + //TODO: usar filtros en vez de toISOString | |
31 | + focaModalRemitoService | |
32 | + .getRemitos(usadoPor, $scope.fechaDesde.toISOString().split('.')[0], | |
33 | + $scope.fechaHasta.toISOString().split('.')[0]) | |
34 | + .then(llenarDatos); | |
28 | 35 | } |
29 | 36 | }; |
30 | 37 | function llenarDatos(res) { |
38 | + $scope.remitos = []; | |
39 | + $scope.filteredRemitos = []; | |
40 | + $scope.currentPageRemitos = []; | |
41 | + $scope.selectedRemito = -1; | |
31 | 42 | $scope.searchLoading = false; |
32 | 43 | $scope.primerBusqueda = true; |
33 | 44 | $scope.remitos = res.data; |
src/js/service.js
... | ... | @@ -4,8 +4,10 @@ angular.module('focaModalRemito') |
4 | 4 | 'API_ENDPOINT', |
5 | 5 | function($http, API_ENDPOINT) { |
6 | 6 | return { |
7 | - getRemitos: function() { | |
8 | - return $http.get(API_ENDPOINT.URL + '/remito'); | |
7 | + getRemitos: function(usadoPor, fechaDesde, fechaHasta) { | |
8 | + var sinHojaRuta = (usadoPor === 'hojaRuta' ? '/sin-hoja-Ruta' : ''); | |
9 | + return $http.get(API_ENDPOINT.URL + '/remito/listar/' + fechaDesde + '/' + | |
10 | + fechaHasta + sinHojaRuta); | |
9 | 11 | } |
10 | 12 | }; |
11 | 13 | } |
src/views/foca-modal-remito.html
... | ... | @@ -3,17 +3,54 @@ |
3 | 3 | </div> |
4 | 4 | <div class="modal-body" id="modal-body"> |
5 | 5 | <div class="input-group"> |
6 | + <small class="col-2 text-left my-1">Fecha Desde</small> | |
7 | + <div class="input-group mb-2 col-4"> | |
8 | + <div class="input-group-prepend"> | |
9 | + <div class="input-group-text"> | |
10 | + <i class="fa fa-calendar"></i> | |
11 | + </div> | |
12 | + </div> | |
13 | + <input | |
14 | + class="form-control form-control-sm" | |
15 | + id="inlineFormInputGroup" | |
16 | + ladda="searchLoading" | |
17 | + type="date" | |
18 | + ng-model="fechaDesde" | |
19 | + hasta-hoy | |
20 | + ng-required="true" | |
21 | + /> | |
22 | + </div> | |
23 | + <small class="col-2 text-left my-1">Fecha Hasta</small> | |
24 | + <div class="input-group mb-2 col-4"> | |
25 | + <div class="input-group-prepend"> | |
26 | + <div class="input-group-text"> | |
27 | + <i class="fa fa-calendar"></i> | |
28 | + </div> | |
29 | + </div> | |
30 | + <input | |
31 | + class="form-control form-control-sm" | |
32 | + id="inlineFormInputGroup" | |
33 | + ladda="searchLoading" | |
34 | + type="date" | |
35 | + ng-model="fechaHasta" | |
36 | + ng-required="true" | |
37 | + hasta-hoy | |
38 | + /> | |
39 | + </div> | |
40 | + </div> | |
41 | + <div class="input-group"> | |
6 | 42 | <input |
7 | 43 | ladda="searchLoading" |
8 | 44 | type="text" |
9 | - class="form-control" | |
10 | - placeholder="Busqueda" | |
45 | + class="form-control form-control-sm" | |
46 | + placeholder="Razón social" | |
11 | 47 | ng-model="filters" |
12 | 48 | ng-change="search()" |
13 | 49 | ng-keydown="busquedaDown($event.keyCode)" |
14 | 50 | ng-keypress="busquedaPress($event.keyCode)" |
15 | 51 | foca-focus="selectedRemito == -1" |
16 | 52 | ng-focus="selectedRemito = -1" |
53 | + teclado-virtual | |
17 | 54 | > |
18 | 55 | <div class="input-group-append"> |
19 | 56 | <button |