Commit daae9c3a422d959b0293e01bd90089d4fb4eb691

Authored by Mauricio Cattafi

Merge branch 'develop' into 'master'

Develop

See merge request !44
src/js/controller.js
1 1 angular.module('focaBusquedaCliente')
2 2 .controller('focaBusquedaClienteModalController', [
3 3 '$uibModalInstance', 'focaBusquedaClienteService', '$scope', '$filter',
4   - '$uibModal', 'focaModalService', '$timeout', '$rootScope', 'vendedor', 'cobrador',
  4 + '$uibModal', 'focaModalService', '$timeout', '$rootScope',
  5 + 'parametros',
5 6 function ($uibModalInstance, focaBusquedaClienteService, $scope, $filter,
6   - $uibModal, focaModalService, $timeout, $rootScope, vendedor, cobrador) {
  7 + $uibModal, focaModalService, $timeout, $rootScope,
  8 + parametros) {
7 9  
8   - $scope.cobrador = cobrador ? cobrador : {};
9   - $scope.vendedor = vendedor ? vendedor : {};
10   - $scope.filters = '';
  10 + $scope.cobrador = parametros.cobrador ? parametros.cobrador : {};
  11 + $scope.vendedor = parametros.vendedor ? parametros.vendedor : {};
  12 + $scope.filters = parametros.searchText ? parametros.searchText : '';
11 13 $scope.primerBusqueda = false;
12 14  
13 15 //#region pagination
... ... @@ -136,12 +138,12 @@ angular.module('focaBusquedaCliente')
136 138 $scope.vendedor.id = undefined;
137 139 $scope.cliente.cobrador.NOM = '';
138 140 $scope.cliente.cobrador.ID = undefined;
139   - $scope.accion = "Crear Cliente";
  141 + $scope.accion = 'Crear Cliente';
140 142 $scope.ingreso = true;
141   - }
  143 + };
142 144  
143 145 $scope.openModal = function (cliente) {
144   - focaBusquedaClienteService.obtenerClientePorCodigo(cliente.cod)
  146 + focaBusquedaClienteService.obtenerClientePorCodigo(cliente.COD)
145 147 .then(function (res) {
146 148 var data = res.data[0];
147 149 $scope.cliente.codigo = res.data[0].COD;
... ... @@ -176,11 +178,11 @@ angular.module('focaBusquedaCliente')
176 178 $scope.cliente.formaPago.ID = data.formaPago.ID;
177 179 $scope.cliente.ES_PROS = data.ES_PROS;
178 180 $scope.cliente.ES_MAY = data.ES_MAY;
179   - $scope.accion = "Editar Cliente";
  181 + $scope.accion = 'Editar Cliente';
180 182 $scope.ingreso = true;
181 183 })
182   - .catch(function (e) { console.log(e); })
183   - }
  184 + .catch(function (e) { console.log(e); });
  185 + };
184 186  
185 187 $scope.busquedaDown = function (key) {
186 188 if (key === 40) {
... ... @@ -399,14 +401,14 @@ angular.module('focaBusquedaCliente')
399 401 };
400 402 $scope.seleccionarTipoFactura = function (key) {
401 403  
402   - if ($scope.cliente.iva.NOMBRE == '') {
  404 + if ($scope.cliente.iva.NOMBRE === '') {
403 405 focaModalService.alert('Seleccione una responsabilidad ante el IVA');
404 406 return;
405 407 }
406 408  
407 409 if (key === 13) {
408 410 var datos;
409   - if ($scope.cliente.iva.ID == 1) {
  411 + if ($scope.cliente.iva.ID === 1) {
410 412 datos = [
411 413 {
412 414 ID: 'A',
... ... @@ -615,13 +617,19 @@ angular.module('focaBusquedaCliente')
615 617 } else if (!$scope.cliente.tipoFactura.NOMBRE) {
616 618 focaModalService.alert('Seleccione tipo de Factura');
617 619 return;
618   - } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && !$scope.cliente.cuit3) {
  620 + } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 &&
  621 + !$scope.cliente.cuit3)
  622 + {
619 623 focaModalService.alert('Ingrese CUIT');
620 624 return;
621   - } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || !$scope.cliente.cuit3) {
  625 + } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 ||
  626 + !$scope.cliente.cuit3)
  627 + {
622 628 focaModalService.alert('Ingrese CUIT válido');
623 629 return;
624   - } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3)) {
  630 + } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 +
  631 + $scope.cliente.cuit3))
  632 + {
625 633 focaModalService.alert('Ingrese CUIT con formato: XX-XXXXXXXX-X');
626 634 return;
627 635 } else if (!$scope.cliente.tipoComprobante.NOMBRE) {
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">