Commit a891c518c9e6dc2ff5440f0e1543e5ad40ce4332
1 parent
132d8046f9
Exists in
master
and in
1 other branch
si recive idVendedor, solo busca notas de ese vendedor
Showing
2 changed files
with
23 additions
and
5 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -8,8 +8,9 @@ angular.module('focaModalNotaPedido') |
| 8 | 8 | 'focaModalNotaPedidoService', |
| 9 | 9 | 'usadoPor', |
| 10 | 10 | 'focaModalService', |
| 11 | + 'idVendedor', | |
| 11 | 12 | function($timeout, $filter, $scope, $uibModalInstance, |
| 12 | - focaModalNotaPedidoService, usadoPor, focaModalService | |
| 13 | + focaModalNotaPedidoService, usadoPor, focaModalService, idVendedor | |
| 13 | 14 | ) { |
| 14 | 15 | var fecha = new Date(); |
| 15 | 16 | $scope.fechaHasta = new Date(); |
| ... | ... | @@ -45,10 +46,22 @@ angular.module('focaModalNotaPedido') |
| 45 | 46 | } |
| 46 | 47 | $scope.searchLoading = true; |
| 47 | 48 | //TODO hacer filtro de fecha |
| 48 | - focaModalNotaPedidoService | |
| 49 | - .getNotasPedido(usadoPor, $scope.fechaDesde.toISOString().split('.')[0], | |
| 50 | - $scope.fechaHasta.toISOString().split('.')[0]) | |
| 51 | - .then(llenarDatos); | |
| 49 | + | |
| 50 | + if(idVendedor) { | |
| 51 | + focaModalNotaPedidoService | |
| 52 | + .getNotasPedidoByIdVendedor( | |
| 53 | + usadoPor, | |
| 54 | + $scope.fechaDesde.toISOString().split('.')[0], | |
| 55 | + $scope.fechaHasta.toISOString().split('.')[0], | |
| 56 | + idVendedor) | |
| 57 | + .then(llenarDatos); | |
| 58 | + }else { | |
| 59 | + focaModalNotaPedidoService | |
| 60 | + .getNotasPedido(usadoPor, | |
| 61 | + $scope.fechaDesde.toISOString().split('.')[0], | |
| 62 | + $scope.fechaHasta.toISOString().split('.')[0]) | |
| 63 | + .then(llenarDatos); | |
| 64 | + } | |
| 52 | 65 | } |
| 53 | 66 | }; |
| 54 | 67 | function llenarDatos(res) { |
src/js/service.js
| ... | ... | @@ -8,6 +8,11 @@ angular.module('focaModalNotaPedido') |
| 8 | 8 | var sinRemito = (usadoPor === 'remito' ? '/sin-remito' : ''); |
| 9 | 9 | return $http.get(API_ENDPOINT.URL + '/nota-pedido/listar/' + fechaDesde + '/' + |
| 10 | 10 | fechaHasta + sinRemito); |
| 11 | + }, | |
| 12 | + getNotasPedidoByIdVendedor: function(usadoPor, fechaDesde, fechaHasta, idVendedor) { | |
| 13 | + var sinRemito = (usadoPor === 'remito' ? '/sin-remito' : ''); | |
| 14 | + return $http.get(API_ENDPOINT.URL + '/nota-pedido/vendedor/listar/' + | |
| 15 | + idVendedor + '/' + fechaDesde + '/' + fechaHasta + sinRemito); | |
| 11 | 16 | } |
| 12 | 17 | }; |
| 13 | 18 | } |