Commit 60a686d0d36a6a547ca0f396d5eb496ae33bee6f

Authored by Eric Fernandez
Exists in master

Merge branch 'develop' into 'master'

Develop

See merge request !34
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
... ... @@ -16,7 +16,7 @@
16 16 </div>
17 17 <div class="input-group col-lg-6 offset-lg-2 pr-0 my-2">
18 18 <button
19   - class="btn btn-outline-primary mr-2"
  19 + class="btn btn-outline-debo mr-2"
20 20 ng-click="ingreso = true"
21 21 ng-show="!ingreso && vendedor.NUM"
22 22 title="Nuevo">
... ... @@ -37,6 +37,14 @@
37 37 teclado-virtual
38 38 ng-hide="ingreso"
39 39 >
  40 + <button
  41 + ng-show="filters.length >= 1"
  42 + type="button"
  43 + class="clear-input"
  44 + ng-click="filters = ''"
  45 + >
  46 + <i class="fa fa-times"></i>
  47 + </button>
40 48 <div class="input-group-append" ng-hide="ingreso">
41 49 <button
42 50 ladda="searchLoading"
... ... @@ -170,10 +178,18 @@
170 178 foca-focus="focused == 4"
171 179 teclado-virtual
172 180 />
  181 + <button
  182 + ng-show="cliente.provincia.NOMBRE.length >= 1"
  183 + type="button"
  184 + class="clear-input"
  185 + ng-click="cliente.provincia.NOMBRE = ''"
  186 + >
  187 + <i class="fa fa-times"></i>
  188 + </button>
173 189 <div class="input-group-append">
174 190 <button
175 191 ladda="searchLoading"
176   - class="btn btn-outline-secondary form-control-sm"
  192 + class="btn btn-outline-secondary"
177 193 type="button"
178 194 ng-click="seleccionarProvincia(13)"
179 195 >
... ... @@ -196,10 +212,18 @@
196 212 ng-focus="focus(5)"
197 213 teclado-virtual
198 214 />
  215 + <button
  216 + ng-show="cliente.localidad.NOMBRE.length >= 1"
  217 + type="button"
  218 + class="clear-input"
  219 + ng-click="cliente.localidad.NOMBRE = ''"
  220 + >
  221 + <i class="fa fa-times"></i>
  222 + </button>
199 223 <div class="input-group-append">
200 224 <button
201 225 ladda="searchLoading"
202   - class="btn btn-outline-secondary form-control-sm"
  226 + class="btn btn-outline-secondary"
203 227 type="button"
204 228 ng-click="seleccionarLocalidad(13)"
205 229 >
... ... @@ -224,10 +248,18 @@
224 248 foca-focus="focused == 6"
225 249 teclado-virtual
226 250 />
  251 + <button
  252 + ng-show="cliente.zona.NOM.length >= 1"
  253 + type="button"
  254 + class="clear-input"
  255 + ng-click="cliente.zona.NOM = ''"
  256 + >
  257 + <i class="fa fa-times"></i>
  258 + </button>
227 259 <div class="input-group-append">
228 260 <button
229 261 ladda="searchLoading"
230   - class="btn btn-outline-secondary form-control-sm"
  262 + class="btn btn-outline-secondary"
231 263 type="button"
232 264 ng-click="seleccionarZona(13)"
233 265 >
... ... @@ -250,10 +282,18 @@
250 282 foca-focus="focused == 7"
251 283 teclado-virtual
252 284 />
  285 + <button
  286 + ng-show="cliente.actividad.NOM.length >= 1"
  287 + type="button"
  288 + class="clear-input"
  289 + ng-click="cliente.actividad.NOM = ''"
  290 + >
  291 + <i class="fa fa-times"></i>
  292 + </button>
253 293 <div class="input-group-append">
254 294 <button
255 295 ladda="searchLoading"
256   - class="btn btn-outline-secondary form-control-sm"
  296 + class="btn btn-outline-secondary"
257 297 type="button"
258 298 ng-click="seleccionarActividad(13)"
259 299 >
... ... @@ -277,10 +317,18 @@
277 317 foca-focus="focused == 8"
278 318 teclado-virtual
279 319 />
  320 + <button
  321 + ng-show="cliente.cobrador.NOM.length >= 1"
  322 + type="button"
  323 + class="clear-input"
  324 + ng-click="cliente.cobrador.NOM = ''"
  325 + >
  326 + <i class="fa fa-times"></i>
  327 + </button>
280 328 <div class="input-group-append">
281 329 <button
282 330 ladda="searchLoading"
283   - class="btn btn-outline-secondary form-control-sm"
  331 + class="btn btn-outline-secondary"
284 332 type="button"
285 333 ng-click="seleccionarCobrador(13)"
286 334 >
... ... @@ -304,7 +352,7 @@
304 352 <label>Email</label>
305 353 <div class="input-group">
306 354 <input
307   - type="email"
  355 + type="text"
308 356 class="form-control form-control-sm"
309 357 placeholder="Ingrese Email"
310 358 ng-model="cliente.MAIL"
... ... @@ -319,7 +367,8 @@
319 367 <label>Telefono</label>
320 368 <div class="input-group">
321 369 <input
322   - type="text"
  370 + foca-tipo-input
  371 + limite-numeros-max="20"
323 372 class="form-control form-control-sm"
324 373 placeholder="Ingrese Telefono"
325 374 ng-model="cliente.TEL"
... ... @@ -362,10 +411,18 @@
362 411 foca-focus="focused == 12"
363 412 teclado-virtual
364 413 />
  414 + <button
  415 + ng-show="cliente.iva.NOMBRE.length >= 1"
  416 + type="button"
  417 + class="clear-input"
  418 + ng-click="cliente.iva.NOMBRE = ''"
  419 + >
  420 + <i class="fa fa-times"></i>
  421 + </button>
365 422 <div class="input-group-append">
366 423 <button
367 424 ladda="searchLoading"
368   - class="btn btn-outline-secondary form-control-sm"
  425 + class="btn btn-outline-secondary"
369 426 type="button"
370 427 ng-click="seleccionarIva(13)"
371 428 >
... ... @@ -387,10 +444,18 @@
387 444 ng-focus="focus(13)"
388 445 foca-focus="focused == 13"
389 446 teclado-virtual>
  447 + <button
  448 + ng-show="cliente.tipoFactura.NOMBRE.length >= 1"
  449 + type="button"
  450 + class="clear-input"
  451 + ng-click="cliente.tipoFactura.NOMBRE = ''"
  452 + >
  453 + <i class="fa fa-times"></i>
  454 + </button>
390 455 <div class="input-group-append">
391 456 <button
392 457 ladda="searchLoading"
393   - class="btn btn-outline-secondary form-control-sm"
  458 + class="btn btn-outline-secondary"
394 459 type="button"
395 460 ng-click="seleccionarTipoFactura(13)"
396 461 >
... ... @@ -408,7 +473,7 @@
408 473 <input
409 474 type="text"
410 475 class="form-control form-control-sm col-2"
411   - maxlength="2"
  476 + limite-numeros-max="2"
412 477 ng-model="cliente.cuit1"
413 478 ng-required="true"
414 479 ng-keypress="pasarCampoCuit(1)"
... ... @@ -421,6 +486,7 @@
421 486 type="text"
422 487 class="form-control form-control-sm col-5"
423 488 maxlength="8"
  489 + limite-numeros-max="8"
424 490 ng-keypress="pasarCampoCuit(2)"
425 491 ng-model="cliente.cuit2"
426 492 ng-required="true"
... ... @@ -433,6 +499,7 @@
433 499 type="text"
434 500 class="form-control form-control-sm col-2"
435 501 maxlength="1"
  502 + limite-numeros-max="1"
436 503 ng-keypress="pasarCampoCuit(3)"
437 504 ng-model="cliente.cuit3"
438 505 ng-required="true"
... ... @@ -455,10 +522,18 @@
455 522 ng-focus="focus(17)"
456 523 foca-focus="focused == 17"
457 524 teclado-virtual>
  525 + <button
  526 + ng-show="cliente.tipoComprobante.NOMBRE.length >= 1"
  527 + type="button"
  528 + class="clear-input"
  529 + ng-click="cliente.tipoComprobante.NOMBRE = ''"
  530 + >
  531 + <i class="fa fa-times"></i>
  532 + </button>
458 533 <div class="input-group-append">
459 534 <button
460 535 ladda="searchLoading"
461   - class="btn btn-outline-secondary form-control-sm"
  536 + class="btn btn-outline-secondary"
462 537 type="button"
463 538 ng-click="seleccionarTipoComprobante(13)"
464 539 >
... ... @@ -480,10 +555,18 @@
480 555 ng-focus="focus(18)"
481 556 foca-focus="focused == 18"
482 557 teclado-virtual>
  558 + <button
  559 + ng-show="cliente.formaPago.NOMBRE.length >= 1"
  560 + type="button"
  561 + class="clear-input"
  562 + ng-click="cliente.formaPago.NOMBRE = ''"
  563 + >
  564 + <i class="fa fa-times"></i>
  565 + </button>
483 566 <div class="input-group-append">
484 567 <button
485 568 ladda="searchLoading"
486   - class="btn btn-outline-secondary form-control-sm"
  569 + class="btn btn-outline-secondary"
487 570 type="button"
488 571 ng-click="seleccionarFormaPago(13)"
489 572 >