Commit eea954f5f433697797a8943309969acebfd54603
1 parent
23f5b83280
Exists in
master
busqueda cliente refactor API
Showing
3 changed files
with
23 additions
and
16 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -136,12 +136,12 @@ angular.module('focaBusquedaCliente') |
136 | 136 | $scope.vendedor.id = undefined; |
137 | 137 | $scope.cliente.cobrador.NOM = ''; |
138 | 138 | $scope.cliente.cobrador.ID = undefined; |
139 | - $scope.accion = "Crear Cliente"; | |
139 | + $scope.accion = 'Crear Cliente'; | |
140 | 140 | $scope.ingreso = true; |
141 | - } | |
141 | + }; | |
142 | 142 | |
143 | 143 | $scope.openModal = function (cliente) { |
144 | - focaBusquedaClienteService.obtenerClientePorCodigo(cliente.cod) | |
144 | + focaBusquedaClienteService.obtenerClientePorCodigo(cliente.COD) | |
145 | 145 | .then(function (res) { |
146 | 146 | var data = res.data[0]; |
147 | 147 | $scope.cliente.codigo = res.data[0].COD; |
... | ... | @@ -176,11 +176,11 @@ angular.module('focaBusquedaCliente') |
176 | 176 | $scope.cliente.formaPago.ID = data.formaPago.ID; |
177 | 177 | $scope.cliente.ES_PROS = data.ES_PROS; |
178 | 178 | $scope.cliente.ES_MAY = data.ES_MAY; |
179 | - $scope.accion = "Editar Cliente"; | |
179 | + $scope.accion = 'Editar Cliente'; | |
180 | 180 | $scope.ingreso = true; |
181 | 181 | }) |
182 | - .catch(function (e) { console.log(e); }) | |
183 | - } | |
182 | + .catch(function (e) { console.log(e); }); | |
183 | + }; | |
184 | 184 | |
185 | 185 | $scope.busquedaDown = function (key) { |
186 | 186 | if (key === 40) { |
... | ... | @@ -399,14 +399,14 @@ angular.module('focaBusquedaCliente') |
399 | 399 | }; |
400 | 400 | $scope.seleccionarTipoFactura = function (key) { |
401 | 401 | |
402 | - if ($scope.cliente.iva.NOMBRE == '') { | |
402 | + if ($scope.cliente.iva.NOMBRE === '') { | |
403 | 403 | focaModalService.alert('Seleccione una responsabilidad ante el IVA'); |
404 | 404 | return; |
405 | 405 | } |
406 | 406 | |
407 | 407 | if (key === 13) { |
408 | 408 | var datos; |
409 | - if ($scope.cliente.iva.ID == 1) { | |
409 | + if ($scope.cliente.iva.ID === 1) { | |
410 | 410 | datos = [ |
411 | 411 | { |
412 | 412 | ID: 'A', |
... | ... | @@ -615,13 +615,19 @@ angular.module('focaBusquedaCliente') |
615 | 615 | } else if (!$scope.cliente.tipoFactura.NOMBRE) { |
616 | 616 | focaModalService.alert('Seleccione tipo de Factura'); |
617 | 617 | return; |
618 | - } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && !$scope.cliente.cuit3) { | |
618 | + } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && | |
619 | + !$scope.cliente.cuit3) | |
620 | + { | |
619 | 621 | focaModalService.alert('Ingrese CUIT'); |
620 | 622 | return; |
621 | - } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || !$scope.cliente.cuit3) { | |
623 | + } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || | |
624 | + !$scope.cliente.cuit3) | |
625 | + { | |
622 | 626 | focaModalService.alert('Ingrese CUIT válido'); |
623 | 627 | return; |
624 | - } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3)) { | |
628 | + } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + | |
629 | + $scope.cliente.cuit3)) | |
630 | + { | |
625 | 631 | focaModalService.alert('Ingrese CUIT con formato: XX-XXXXXXXX-X'); |
626 | 632 | return; |
627 | 633 | } else if (!$scope.cliente.tipoComprobante.NOMBRE) { |
src/js/service.js
1 | 1 | angular.module('focaBusquedaCliente') |
2 | - .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { | |
2 | + .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', | |
3 | + function ($http, API_ENDPOINT) { | |
3 | 4 | return { |
4 | 5 | obtenerClientesPorNombreOCuitByVendedor: function (nombreOCuit, idVendedor) { |
5 | 6 | return $http.post(API_ENDPOINT.URL + '/cliente/listar', |
src/views/foca-busqueda-cliente-modal.html
... | ... | @@ -84,9 +84,9 @@ |
84 | 84 | class="selectable" |
85 | 85 | ng-repeat="(key, cliente) in currentPageClientes" |
86 | 86 | > |
87 | - <td ng-bind="('00000'+cliente.cod).slice(-5)"></td> | |
88 | - <td ng-bind="cliente.nom"></td> | |
89 | - <td ng-bind="cliente.cuit"></td> | |
87 | + <td ng-bind="('00000'+cliente.COD).slice(-5)"></td> | |
88 | + <td ng-bind="cliente.NOM"></td> | |
89 | + <td ng-bind="cliente.CUIT"></td> | |
90 | 90 | <td> |
91 | 91 | <button |
92 | 92 | type="button" |
... | ... | @@ -115,7 +115,7 @@ |
115 | 115 | </table> |
116 | 116 | |
117 | 117 | <form name="formCliente"> |
118 | - <fieldset> | |
118 | + <fieldset> | |
119 | 119 | <uib-tabset class="tabs-right" ng-show="ingreso"> |
120 | 120 | <uib-tab heading="Datos cliente"> |
121 | 121 | <div class="row"> |