Commit cb0cd5ea051f81f2d7dfe4cecbc53777f100182b

Authored by Eric Fernandez
1 parent 8a4d6cf29c
Exists in master

refactor cliente

Showing 1 changed file with 13 additions and 22 deletions   Show diff stats
src/js/controller.js
... ... @@ -429,19 +429,17 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl',
429 429 templateUrl: 'foca-busqueda-cliente-modal.html',
430 430 controller: 'focaBusquedaClienteModalController',
431 431 resolve: {
432   - vendedor: function () { return null; },
433   - cobrador: function () { return null; }
  432 + parametros: function () {
  433 + return {
  434 + vendedor: function () { return null; },
  435 + cobrador: function () { return null; }
  436 + }
  437 + }
434 438 },
435 439 size: 'lg'
436 440 }
437 441 );
438   - modalInstance.result.then(
439   - function (cliente) {
440   - $scope.abrirModalDomicilios(cliente);
441   - $scope.cliente = cliente;
442   - }, function () {
443   - }
444   - );
  442 + modalInstance.result.then($scope.abrirModalDomicilios);
445 443 };
446 444  
447 445 $scope.abrirModalDomicilios = function (cliente) {
... ... @@ -452,7 +450,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl',
452 450 controller: 'focaModalDomicilioController',
453 451 size: 'lg',
454 452 resolve: {
455   - idCliente: function () { return cliente.cod; },
  453 + idCliente: function () { return cliente.COD; },
456 454 esNuevo: function () { return cliente.esNuevo; }
457 455 }
458 456 }
... ... @@ -460,15 +458,8 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl',
460 458 modalInstanceDomicilio.result.then(
461 459 function (domicilio) {
462 460 $scope.hojaRuta.domicilio = domicilio;
463   - $scope.hojaRuta.cliente = {
464   - COD: cliente.cod,
465   - CUIT: cliente.cuit,
466   - NOM: cliente.nom,
467   - MAIL: cliente.mail,
468   - MOD: cliente.mod,
469   - IVA: cliente.iva,
470   - VEN: cliente.ven
471   - };
  461 + $scope.hojaRuta.cliente = cliente;
  462 +
472 463 focaCrearHojaRutaService.getVendedorById($scope.hojaRuta.cliente.VEN)
473 464 .then(function (res) {
474 465 if (res.data !== '') {
... ... @@ -485,8 +476,8 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl',
485 476 $scope.hojaRuta.domicilioStamp = domicilioStamp;
486 477 $scope.$broadcast('addCabecera', {
487 478 label: 'Cliente:',
488   - valor: $filter('rellenarDigitos')(cliente.cod, 3) +
489   - ' - ' + cliente.nom
  479 + valor: $filter('rellenarDigitos')(cliente.COD, 3) +
  480 + ' - ' + cliente.NOM
490 481 });
491 482 $scope.$broadcast('addCabecera', {
492 483 label: 'Domicilio:',
... ... @@ -498,7 +489,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl',
498 489 $scope.seleccionarPuntosDeDescarga();
499 490 } else {
500 491 focaCrearHojaRutaService
501   - .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
  492 + .getPuntosDescargaByClienDom(domicilio.id, cliente.COD)
502 493 .then(function (res) {
503 494 if (res.data.length) {
504 495 $scope.seleccionarPuntosDeDescarga();