Commit 5109dc0af63783c54e22285616d609c09e936366
Exists in
master
Merge branch 'master' into 'master'
Master See merge request !12
Showing
3 changed files
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaBusquedaCliente') |
2 | 2 | .controller('focaBusquedaClienteModalController', [ |
3 | 3 | '$uibModalInstance', 'focaBusquedaClienteService', '$scope', '$filter', |
4 | - '$uibModal', 'focaModalService', '$timeout', | |
4 | + '$uibModal', 'focaModalService', '$timeout', 'vendedor', | |
5 | 5 | function($uibModalInstance, focaBusquedaClienteService, $scope, $filter, |
6 | - $uibModal, focaModalService, $timeout) { | |
6 | + $uibModal, focaModalService, $timeout, vendedor) { | |
7 | 7 | |
8 | + $scope.vendedor = vendedor; | |
8 | 9 | $scope.filters = ''; |
9 | 10 | $scope.primerBusqueda = false; |
10 | 11 | // pagination |
... | ... | @@ -49,13 +50,15 @@ angular.module('focaBusquedaCliente') |
49 | 50 | $scope.busquedaPress = function(key) { |
50 | 51 | if (key === 13) { |
51 | 52 | $scope.searchLoading = true; |
52 | - focaBusquedaClienteService.obtenerClientesPorNombreOCuit($scope.filters).then( | |
53 | - function(res) { | |
54 | - $scope.primerBusqueda = true; | |
55 | - $scope.clientes = res.data; | |
56 | - $scope.search(true); | |
57 | - primera(); | |
58 | - $scope.searchLoading = false; | |
53 | + focaBusquedaClienteService | |
54 | + .obtenerClientesPorNombreOCuit($scope.filters, vendedor.CodVen) | |
55 | + .then( | |
56 | + function(res) { | |
57 | + $scope.primerBusqueda = true; | |
58 | + $scope.clientes = res.data; | |
59 | + $scope.search(true); | |
60 | + primera(); | |
61 | + $scope.searchLoading = false; | |
59 | 62 | }); |
60 | 63 | } |
61 | 64 | }; |
... | ... | @@ -314,6 +317,7 @@ angular.module('focaBusquedaCliente') |
314 | 317 | $scope.cliente.TIP = $scope.cliente.tipoFactura.ID; |
315 | 318 | $scope.cliente.TCO = $scope.cliente.tipoComprobante.ID; |
316 | 319 | $scope.cliente.FPA = $scope.cliente.formaPago.ID; |
320 | + $scope.cliente.VEN = $scope.vendedor.CodVen; | |
317 | 321 | |
318 | 322 | delete $scope.cliente.provincia; |
319 | 323 | delete $scope.cliente.localidad; |
... | ... | @@ -324,15 +328,17 @@ angular.module('focaBusquedaCliente') |
324 | 328 | delete $scope.cliente.tipoComprobante; |
325 | 329 | delete $scope.cliente.formaPago; |
326 | 330 | |
327 | - focaBusquedaClienteService.guardarCliente($scope.cliente).then(function(res) { | |
328 | - var cliente = { | |
329 | - cod: res.data.COD, | |
330 | - cuit: res.data.CUIT, | |
331 | - esNuevo: res.data.esNuevo, | |
332 | - nom: res.data.NOM | |
333 | - }; | |
334 | - $scope.select(cliente, true); | |
335 | - }); | |
331 | + focaBusquedaClienteService | |
332 | + .guardarCliente($scope.cliente) | |
333 | + .then(function(res) { | |
334 | + var cliente = { | |
335 | + cod: res.data.COD, | |
336 | + cuit: res.data.CUIT, | |
337 | + esNuevo: res.data.esNuevo, | |
338 | + nom: res.data.NOM | |
339 | + }; | |
340 | + $scope.select(cliente, true); | |
341 | + }); | |
336 | 342 | }; |
337 | 343 | |
338 | 344 | function calcularPages(paginaActual) { |
src/js/service.js
1 | 1 | angular.module('focaBusquedaCliente') |
2 | 2 | .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | 3 | return { |
4 | - obtenerClientes: function() { | |
5 | - return $http.get(API_ENDPOINT.URL + '/cliente'); | |
6 | - }, | |
7 | - obtenerCliente: function(id) { | |
8 | - return $http.get(API_ENDPOINT.URL + '/cliente/' + id); | |
9 | - }, | |
10 | - obtenerClientesPorNombreOCuit: function(nombreOCuit) { | |
11 | - return $http.post(API_ENDPOINT.URL + '/cliente', {nombreOCuit: nombreOCuit}); | |
4 | + obtenerClientesPorNombreOCuit: function(nombreOCuit, idVendedor) { | |
5 | + return $http.post(API_ENDPOINT.URL + '/cliente', | |
6 | + {nombreOCuit: nombreOCuit, idVendedor: idVendedor}); | |
12 | 7 | }, |
13 | 8 | guardarCliente: function(cliente) { |
14 | 9 | return $http.post(API_ENDPOINT.URL + '/cliente', {cliente: cliente}); |
src/views/foca-busqueda-cliente-modal.html
... | ... | @@ -264,8 +264,19 @@ |
264 | 264 | </div> |
265 | 265 | </div> |
266 | 266 | <div class="row"> |
267 | - <div class="col-6"> | |
268 | - <div class="custom-control custom-checkbox"> | |
267 | + <div class="col-md-6 col-12"> | |
268 | + <label>Vendedor</label> | |
269 | + <div class="input-group"> | |
270 | + <input | |
271 | + type="text" | |
272 | + class="form-control form-control-sm" | |
273 | + ng-model="vendedor.NomVen" | |
274 | + disabled="true" | |
275 | + /> | |
276 | + </div> | |
277 | + </div> | |
278 | + <div class="col-6 d-flex"> | |
279 | + <div class="custom-control custom-checkbox mt-auto"> | |
269 | 280 | <input |
270 | 281 | type="checkbox" |
271 | 282 | class="custom-control-input" |