Commit 238bf9af109e1ebf6132f72740e2dc3b1704ae3c
Exists in
master
Merge branch 'master' into 'master'
Master See merge request !13
Showing
3 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -5,7 +5,7 @@ angular.module('focaBusquedaCliente') |
5 | 5 | function($uibModalInstance, focaBusquedaClienteService, $scope, $filter, |
6 | 6 | $uibModal, focaModalService, $timeout, vendedor) { |
7 | 7 | |
8 | - $scope.vendedor = vendedor; | |
8 | + $scope.vendedor = vendedor ? vendedor : {}; | |
9 | 9 | $scope.filters = ''; |
10 | 10 | $scope.primerBusqueda = false; |
11 | 11 | // pagination |
... | ... | @@ -44,14 +44,20 @@ angular.module('focaBusquedaCliente') |
44 | 44 | }, |
45 | 45 | formaPago: { |
46 | 46 | NOMBRE: '' |
47 | + }, | |
48 | + cobrador: { | |
49 | + NomVen: '' | |
47 | 50 | } |
48 | 51 | }; |
49 | 52 | |
50 | 53 | $scope.busquedaPress = function(key) { |
51 | 54 | if (key === 13) { |
55 | + var funcion = ($scope.vendedor.CodVen) ? | |
56 | + 'obtenerClientesPorNombreOCuitByVendedor' : 'obtenerClientesPorNombreOCuit'; | |
57 | + | |
52 | 58 | $scope.searchLoading = true; |
53 | 59 | focaBusquedaClienteService |
54 | - .obtenerClientesPorNombreOCuit($scope.filters, vendedor.CodVen) | |
60 | + [funcion]($scope.filters, $scope.vendedor.CodVen) | |
55 | 61 | .then( |
56 | 62 | function(res) { |
57 | 63 | $scope.primerBusqueda = true; |
... | ... | @@ -203,14 +209,14 @@ angular.module('focaBusquedaCliente') |
203 | 209 | var query = '/iva'; |
204 | 210 | var columnas = { |
205 | 211 | nombre: ['Código', 'Nombre'], |
206 | - propiedad: ['ID', 'NOM',] | |
212 | + propiedad: ['ID', 'NOMBRE',] | |
207 | 213 | }; |
208 | 214 | var titulo = 'Búsqueda de responsabilidad ante el IVA'; |
209 | 215 | focaModalService.modal(columnas, query, titulo, 'md').then( |
210 | 216 | function(iva) { |
211 | 217 | $scope.cliente.iva = iva; |
212 | 218 | $timeout(function() { |
213 | - $scope.focused = 9; | |
219 | + $scope.focused = 10; | |
214 | 220 | }); |
215 | 221 | }, function() { |
216 | 222 | // funcion ejecutada cuando se cancela el modal |
... | ... | @@ -228,6 +234,9 @@ angular.module('focaBusquedaCliente') |
228 | 234 | focaModalService.modal(columnas, query, titulo, 'md').then( |
229 | 235 | function(actividad) { |
230 | 236 | $scope.cliente.actividad = actividad; |
237 | + $timeout(function() { | |
238 | + $scope.focused = 8; | |
239 | + }); | |
231 | 240 | }, function() { |
232 | 241 | // funcion ejecutada cuando se cancela el modal |
233 | 242 | }); |
... | ... | @@ -264,7 +273,7 @@ angular.module('focaBusquedaCliente') |
264 | 273 | function(tipoFactura) { |
265 | 274 | $scope.cliente.tipoFactura = tipoFactura; |
266 | 275 | $timeout(function() { |
267 | - $scope.focused = 10; | |
276 | + $scope.focused = 11; | |
268 | 277 | }); |
269 | 278 | }, function() { |
270 | 279 | // funcion ejecutada cuando se cancela el modal |
... | ... | @@ -283,7 +292,7 @@ angular.module('focaBusquedaCliente') |
283 | 292 | function(tipoComprobante) { |
284 | 293 | $scope.cliente.tipoComprobante = tipoComprobante; |
285 | 294 | $timeout(function() { |
286 | - $scope.focused = 12; | |
295 | + $scope.focused = 13; | |
287 | 296 | }); |
288 | 297 | }, function() { |
289 | 298 | // funcion ejecutada cuando se cancela el modal |
... | ... | @@ -306,6 +315,22 @@ angular.module('focaBusquedaCliente') |
306 | 315 | }); |
307 | 316 | } |
308 | 317 | }; |
318 | + $scope.seleccionarCobrador = function(key) { | |
319 | + if(key === 13) { | |
320 | + var query = '/cobrador'; | |
321 | + var columnas = { | |
322 | + nombre: ['Código', 'Nombre'], | |
323 | + propiedad: ['CodVen', 'NomVen',] | |
324 | + }; | |
325 | + var titulo = 'Búsqueda de cobradores'; | |
326 | + focaModalService.modal(columnas, query, titulo, 'md').then( | |
327 | + function(cobrador) { | |
328 | + $scope.cliente.cobrador = cobrador; | |
329 | + }, function() { | |
330 | + // funcion ejecutada cuando se cancela el modal | |
331 | + }); | |
332 | + } | |
333 | + }; | |
309 | 334 | |
310 | 335 | $scope.guardar = function() { |
311 | 336 | |
... | ... | @@ -318,6 +343,7 @@ angular.module('focaBusquedaCliente') |
318 | 343 | $scope.cliente.TCO = $scope.cliente.tipoComprobante.ID; |
319 | 344 | $scope.cliente.FPA = $scope.cliente.formaPago.ID; |
320 | 345 | $scope.cliente.VEN = $scope.vendedor.CodVen; |
346 | + $scope.cliente.idCobrador = $scope.cliente.cobrador.CodVen; | |
321 | 347 | |
322 | 348 | delete $scope.cliente.provincia; |
323 | 349 | delete $scope.cliente.localidad; |
... | ... | @@ -327,6 +353,7 @@ angular.module('focaBusquedaCliente') |
327 | 353 | delete $scope.cliente.tipoFactura; |
328 | 354 | delete $scope.cliente.tipoComprobante; |
329 | 355 | delete $scope.cliente.formaPago; |
356 | + delete $scope.cliente.cobrador; | |
330 | 357 | |
331 | 358 | focaBusquedaClienteService |
332 | 359 | .guardarCliente($scope.cliente) |
src/js/service.js
1 | 1 | angular.module('focaBusquedaCliente') |
2 | 2 | .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | 3 | return { |
4 | - obtenerClientesPorNombreOCuit: function(nombreOCuit, idVendedor) { | |
5 | - return $http.post(API_ENDPOINT.URL + '/cliente', | |
4 | + obtenerClientesPorNombreOCuitByVendedor: function(nombreOCuit, idVendedor) { | |
5 | + return $http.post(API_ENDPOINT.URL + '/cliente/listar', | |
6 | 6 | {nombreOCuit: nombreOCuit, idVendedor: idVendedor}); |
7 | 7 | }, |
8 | + obtenerClientesPorNombreOCuit: function(nombreOCuit) { | |
9 | + return $http.post(API_ENDPOINT.URL + '/cliente/listar', | |
10 | + {nombreOCuit: nombreOCuit}); | |
11 | + }, | |
8 | 12 | guardarCliente: function(cliente) { |
9 | 13 | return $http.post(API_ENDPOINT.URL + '/cliente', {cliente: cliente}); |
10 | 14 | } |
src/views/foca-busqueda-cliente-modal.html
... | ... | @@ -99,7 +99,7 @@ |
99 | 99 | |
100 | 100 | <form name="formCliente"> |
101 | 101 | <uib-tabset class="tabs-right" ng-show="ingreso"> |
102 | - <uib-tab heading="Datos clientes"> | |
102 | + <uib-tab heading="Datos cliente"> | |
103 | 103 | <div class="row"> |
104 | 104 | <div class="col-3"> |
105 | 105 | <label>Código</label> |
... | ... | @@ -265,6 +265,31 @@ |
265 | 265 | </div> |
266 | 266 | <div class="row"> |
267 | 267 | <div class="col-md-6 col-12"> |
268 | + <label>Cobrador</label> | |
269 | + <div class="input-group"> | |
270 | + <input | |
271 | + type="text" | |
272 | + class="form-control form-control-sm" | |
273 | + ng-model="cliente.cobrador.NomVen" | |
274 | + ng-keypress="seleccionarCobrador($event.keyCode)" | |
275 | + placeholder="Ingrese cobrador" | |
276 | + ng-focus="focus(8)" | |
277 | + foca-focus="focused == 8" | |
278 | + teclado-virtual | |
279 | + /> | |
280 | + <div class="input-group-append"> | |
281 | + <button | |
282 | + ladda="searchLoading" | |
283 | + class="btn btn-outline-secondary form-control-sm" | |
284 | + type="button" | |
285 | + ng-click="seleccionarCobrador(13)" | |
286 | + > | |
287 | + <i class="fa fa-search" aria-hidden="true"></i> | |
288 | + </button> | |
289 | + </div> | |
290 | + </div> | |
291 | + </div> | |
292 | + <div class="col-md-6 col-12"> | |
268 | 293 | <label>Vendedor</label> |
269 | 294 | <div class="input-group"> |
270 | 295 | <input |
... | ... | @@ -275,6 +300,8 @@ |
275 | 300 | /> |
276 | 301 | </div> |
277 | 302 | </div> |
303 | + </div> | |
304 | + <div class="row"> | |
278 | 305 | <div class="col-6 d-flex"> |
279 | 306 | <div class="custom-control custom-checkbox mt-auto"> |
280 | 307 | <input |
... | ... | @@ -297,11 +324,12 @@ |
297 | 324 | <input |
298 | 325 | type="text" |
299 | 326 | class="form-control form-control-sm" |
327 | + placeholder="Ingrese responsabilidad ante el IVA" | |
300 | 328 | ng-model="cliente.iva.NOMBRE" |
301 | 329 | ng-keypress="seleccionarIva($event.keyCode)" |
302 | 330 | ng-required="true" |
303 | - ng-focus="focus(8)" | |
304 | - foca-focus="focused == 8" | |
331 | + ng-focus="focus(9)" | |
332 | + foca-focus="focused == 9" | |
305 | 333 | teclado-virtual |
306 | 334 | /> |
307 | 335 | <div class="input-group-append"> |
... | ... | @@ -326,8 +354,8 @@ |
326 | 354 | ng-model="cliente.tipoFactura.NOMBRE" |
327 | 355 | ng-required="true" |
328 | 356 | ng-keypress="seleccionarTipoFactura(13)" |
329 | - ng-focus="focus(9)" | |
330 | - foca-focus="focused == 9" | |
357 | + ng-focus="focus(10)" | |
358 | + foca-focus="focused == 10" | |
331 | 359 | teclado-virtual> |
332 | 360 | <div class="input-group-append"> |
333 | 361 | <button |
... | ... | @@ -355,8 +383,8 @@ |
355 | 383 | ng-pattern="regexCuit" |
356 | 384 | ng-maxlength="13" |
357 | 385 | ng-keypress="next($event.keyCode)" |
358 | - ng-focus="focus(10)" | |
359 | - foca-focus="focused == 10" | |
386 | + ng-focus="focus(11)" | |
387 | + foca-focus="focused == 11" | |
360 | 388 | teclado-virtual> |
361 | 389 | </div> |
362 | 390 | </div> |
... | ... | @@ -370,8 +398,8 @@ |
370 | 398 | ng-keypress="seleccionarTipoComprobante($event.keyCode)" |
371 | 399 | ng-model="cliente.tipoComprobante.NOMBRE" |
372 | 400 | ng-required="true" |
373 | - ng-focus="focus(11)" | |
374 | - foca-focus="focused == 11" | |
401 | + ng-focus="focus(12)" | |
402 | + foca-focus="focused == 12" | |
375 | 403 | teclado-virtual> |
376 | 404 | <div class="input-group-append"> |
377 | 405 | <button |
... | ... | @@ -395,8 +423,8 @@ |
395 | 423 | ng-model="cliente.formaPago.NOMBRE" |
396 | 424 | ng-required="true" |
397 | 425 | ng-keypress="seleccionarFormaPago($event.keyCode)" |
398 | - ng-focus="focus(12)" | |
399 | - foca-focus="focused == 12" | |
426 | + ng-focus="focus(13)" | |
427 | + foca-focus="focused == 13" | |
400 | 428 | teclado-virtual> |
401 | 429 | <div class="input-group-append"> |
402 | 430 | <button |