diff --git a/src/js/controller.js b/src/js/controller.js index aba5809..b9a3aa2 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -324,8 +324,9 @@ angular.module('focaBusquedaCliente') }; $scope.seleccionarTipoFactura = function(key) { if (key === 13) { + var datos; if ($scope.cliente.iva.ID == 1) { - var datos = [ + datos = [ { id: 'A', nombre: 'Factura A' @@ -339,25 +340,9 @@ angular.module('focaBusquedaCliente') nombre: 'Remito' } ]; - focaModalService.modal({ - titulo: 'Seleccionar Factura', - data: datos, - size: 'md', - columnas: [ - { - propiedad: 'id', - nombre: 'Codigo' - }, - { - propiedad: 'nombre', - nombre: 'Factura' - } - ], - }).then(function(res) { - $scope.cliente.tipoFactura.NOMBRE = res.nombre; - }); - } else if ($scope.cliente.iva.ID == 3 || $scope.cliente.iva.ID == 4 || $scope.cliente.iva.ID == 5) { - var datos2 = [ + + } else { + datos = [ { id: 'B', nombre: 'Factura B' @@ -367,24 +352,24 @@ angular.module('focaBusquedaCliente') nombre: 'Remito' } ]; - focaModalService.modal({ - titulo: 'Seleccionar Factura', - data: datos2, - size: 'md', - columnas: [ - { - propiedad: 'id', - nombre: 'Codigo' - }, - { - propiedad: 'nombre', - nombre: 'Factura' - } - ], - }).then(function(res) { - $scope.cliente.tipoFactura.NOMBRE = res.nombre; - }); } + focaModalService.modal({ + titulo: 'Seleccionar Factura', + data: datos, + size: 'md', + columnas: [ + { + propiedad: 'id', + nombre: 'Codigo' + }, + { + propiedad: 'nombre', + nombre: 'Factura' + } + ], + }).then(function(res) { + $scope.cliente.tipoFactura.NOMBRE = res.nombre; + }); } }; $scope.seleccionarTipoComprobante = function(key) { @@ -515,6 +500,9 @@ angular.module('focaBusquedaCliente') } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && !$scope.cliente.cuit3) { focaModalService.alert('Ingresar CUIT'); return; + } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || !$scope.cliente.cuit3){ + focaModalService.alert('Cuit Incompleto'); + return; } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3) ) { focaModalService.alert('Debe ingresar CUIT con formato: XX-XXXXXXXX-X'); return; @@ -526,7 +514,6 @@ angular.module('focaBusquedaCliente') return; } - var cliente = crearCopia(); focaBusquedaClienteService