Commit a785ee977c4ce0976e7761cd3a58e32f6cb64966
Exists in
master
Merge remote-tracking branch 'origin/master'
Showing
2 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -65,7 +65,6 @@ angular.module('focaBusquedaCliente') |
| 65 | 65 | funcion = 'obtenerClientesPorNombreOCuit'; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - | |
| 69 | 68 | $scope.searchLoading = true; |
| 70 | 69 | focaBusquedaClienteService |
| 71 | 70 | [funcion]($scope.filters, $scope.vendedor.id || $scope.cobrador.id) |
| ... | ... | @@ -252,6 +251,9 @@ angular.module('focaBusquedaCliente') |
| 252 | 251 | }; |
| 253 | 252 | focaModalService.modal(parametrosModal).then( |
| 254 | 253 | function(iva) { |
| 254 | + if (iva) { | |
| 255 | + delete $scope.cliente.tipoFactura.NOMBRE; | |
| 256 | + } | |
| 255 | 257 | $scope.cliente.iva = iva; |
| 256 | 258 | $timeout(function() { |
| 257 | 259 | $scope.focused = 12; |
| ... | ... | @@ -328,6 +330,12 @@ angular.module('focaBusquedaCliente') |
| 328 | 330 | } |
| 329 | 331 | }; |
| 330 | 332 | $scope.seleccionarTipoFactura = function(key) { |
| 333 | + | |
| 334 | + if ($scope.cliente.iva.NOMBRE == '') { | |
| 335 | + focaModalService.alert('Seleccione una responsabilidad ante el IVA'); | |
| 336 | + return; | |
| 337 | + } | |
| 338 | + | |
| 331 | 339 | if (key === 13) { |
| 332 | 340 | var datos; |
| 333 | 341 | if ($scope.cliente.iva.ID == 1) { |
| ... | ... | @@ -463,7 +471,6 @@ angular.module('focaBusquedaCliente') |
| 463 | 471 | }; |
| 464 | 472 | |
| 465 | 473 | $scope.pasarCampoCuit = function(numeroCuit) { |
| 466 | - | |
| 467 | 474 | if (numeroCuit === 1 && $scope.cliente.cuit1.length === 2) { |
| 468 | 475 | $scope.cuitActivo = 2; |
| 469 | 476 | } else if ( numeroCuit === 2 && $scope.cliente.cuit2.length === 8) { |
| ... | ... | @@ -496,6 +503,9 @@ angular.module('focaBusquedaCliente') |
| 496 | 503 | } else if (!$scope.cliente.cobrador.NUM) { |
| 497 | 504 | focaModalService.alert('Seleccione un cobrador'); |
| 498 | 505 | return; |
| 506 | + } else if ($scope.cliente.MAIL && !validateEmails($scope.cliente.MAIL)) { | |
| 507 | + focaModalService.alert('Ingrese un formato de email válido'); | |
| 508 | + return; | |
| 499 | 509 | } else if (!$scope.cliente.TEL) { |
| 500 | 510 | focaModalService.alert('Ingrese un numero de telefono'); |
| 501 | 511 | return; |
| ... | ... | @@ -536,7 +546,7 @@ angular.module('focaBusquedaCliente') |
| 536 | 546 | $scope.select(cliente, true); |
| 537 | 547 | }); |
| 538 | 548 | }; |
| 539 | - | |
| 549 | + | |
| 540 | 550 | function crearCopia(){ |
| 541 | 551 | var cliente = angular.copy($scope.cliente); |
| 542 | 552 | |
| ... | ... | @@ -631,6 +641,15 @@ angular.module('focaBusquedaCliente') |
| 631 | 641 | $scope.selectedClientes = 0; |
| 632 | 642 | } |
| 633 | 643 | } |
| 634 | - | |
| 644 | + function validateEmails(emails) { | |
| 645 | + var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
| 646 | + var arr = emails.split(','); | |
| 647 | + var result = true; | |
| 648 | + arr.forEach(function(email) { | |
| 649 | + var val = String(email).trim().toLowerCase(); | |
| 650 | + if (!re.test(val)) result = false; | |
| 651 | + }); | |
| 652 | + return result; | |
| 653 | + } | |
| 635 | 654 | } |
| 636 | 655 | ]); |
src/views/foca-busqueda-cliente-modal.html
| ... | ... | @@ -304,7 +304,7 @@ |
| 304 | 304 | <label>Email</label> |
| 305 | 305 | <div class="input-group"> |
| 306 | 306 | <input |
| 307 | - type="email" | |
| 307 | + type="text" | |
| 308 | 308 | class="form-control form-control-sm" |
| 309 | 309 | placeholder="Ingrese Email" |
| 310 | 310 | ng-model="cliente.MAIL" |
| ... | ... | @@ -319,7 +319,8 @@ |
| 319 | 319 | <label>Telefono</label> |
| 320 | 320 | <div class="input-group"> |
| 321 | 321 | <input |
| 322 | - type="text" | |
| 322 | + foca-tipo-input | |
| 323 | + limite-numeros-max="20" | |
| 323 | 324 | class="form-control form-control-sm" |
| 324 | 325 | placeholder="Ingrese Telefono" |
| 325 | 326 | ng-model="cliente.TEL" |
| ... | ... | @@ -408,7 +409,7 @@ |
| 408 | 409 | <input |
| 409 | 410 | type="text" |
| 410 | 411 | class="form-control form-control-sm col-2" |
| 411 | - maxlength="2" | |
| 412 | + limite-numeros-max="2" | |
| 412 | 413 | ng-model="cliente.cuit1" |
| 413 | 414 | ng-required="true" |
| 414 | 415 | ng-keypress="pasarCampoCuit(1)" |
| ... | ... | @@ -421,6 +422,7 @@ |
| 421 | 422 | type="text" |
| 422 | 423 | class="form-control form-control-sm col-5" |
| 423 | 424 | maxlength="8" |
| 425 | + limite-numeros-max="8" | |
| 424 | 426 | ng-keypress="pasarCampoCuit(2)" |
| 425 | 427 | ng-model="cliente.cuit2" |
| 426 | 428 | ng-required="true" |
| ... | ... | @@ -433,6 +435,7 @@ |
| 433 | 435 | type="text" |
| 434 | 436 | class="form-control form-control-sm col-2" |
| 435 | 437 | maxlength="1" |
| 438 | + limite-numeros-max="1" | |
| 436 | 439 | ng-keypress="pasarCampoCuit(3)" |
| 437 | 440 | ng-model="cliente.cuit3" |
| 438 | 441 | ng-required="true" |