From eea954f5f433697797a8943309969acebfd54603 Mon Sep 17 00:00:00 2001 From: Eric Fernandez Date: Tue, 30 Jul 2019 12:44:40 -0300 Subject: [PATCH] busqueda cliente refactor API --- src/js/controller.js | 28 +++++++++++++++++----------- src/js/service.js | 3 ++- src/views/foca-busqueda-cliente-modal.html | 8 ++++---- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index d1927f7..850df80 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -136,12 +136,12 @@ angular.module('focaBusquedaCliente') $scope.vendedor.id = undefined; $scope.cliente.cobrador.NOM = ''; $scope.cliente.cobrador.ID = undefined; - $scope.accion = "Crear Cliente"; + $scope.accion = 'Crear Cliente'; $scope.ingreso = true; - } + }; $scope.openModal = function (cliente) { - focaBusquedaClienteService.obtenerClientePorCodigo(cliente.cod) + focaBusquedaClienteService.obtenerClientePorCodigo(cliente.COD) .then(function (res) { var data = res.data[0]; $scope.cliente.codigo = res.data[0].COD; @@ -176,11 +176,11 @@ angular.module('focaBusquedaCliente') $scope.cliente.formaPago.ID = data.formaPago.ID; $scope.cliente.ES_PROS = data.ES_PROS; $scope.cliente.ES_MAY = data.ES_MAY; - $scope.accion = "Editar Cliente"; + $scope.accion = 'Editar Cliente'; $scope.ingreso = true; }) - .catch(function (e) { console.log(e); }) - } + .catch(function (e) { console.log(e); }); + }; $scope.busquedaDown = function (key) { if (key === 40) { @@ -399,14 +399,14 @@ angular.module('focaBusquedaCliente') }; $scope.seleccionarTipoFactura = function (key) { - if ($scope.cliente.iva.NOMBRE == '') { + if ($scope.cliente.iva.NOMBRE === '') { focaModalService.alert('Seleccione una responsabilidad ante el IVA'); return; } if (key === 13) { var datos; - if ($scope.cliente.iva.ID == 1) { + if ($scope.cliente.iva.ID === 1) { datos = [ { ID: 'A', @@ -615,13 +615,19 @@ angular.module('focaBusquedaCliente') } else if (!$scope.cliente.tipoFactura.NOMBRE) { focaModalService.alert('Seleccione tipo de Factura'); return; - } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && !$scope.cliente.cuit3) { + } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && + !$scope.cliente.cuit3) + { focaModalService.alert('Ingrese CUIT'); return; - } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || !$scope.cliente.cuit3) { + } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || + !$scope.cliente.cuit3) + { focaModalService.alert('Ingrese CUIT vĂ¡lido'); return; - } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3)) { + } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + + $scope.cliente.cuit3)) + { focaModalService.alert('Ingrese CUIT con formato: XX-XXXXXXXX-X'); return; } else if (!$scope.cliente.tipoComprobante.NOMBRE) { diff --git a/src/js/service.js b/src/js/service.js index 65277e7..5cc9e57 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -1,5 +1,6 @@ angular.module('focaBusquedaCliente') - .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { + .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', + function ($http, API_ENDPOINT) { return { obtenerClientesPorNombreOCuitByVendedor: function (nombreOCuit, idVendedor) { return $http.post(API_ENDPOINT.URL + '/cliente/listar', diff --git a/src/views/foca-busqueda-cliente-modal.html b/src/views/foca-busqueda-cliente-modal.html index f63f70b..e11f780 100644 --- a/src/views/foca-busqueda-cliente-modal.html +++ b/src/views/foca-busqueda-cliente-modal.html @@ -84,9 +84,9 @@ class="selectable" ng-repeat="(key, cliente) in currentPageClientes" > - - - + + +