Commit 9e4386a38516864954f42ac5b2bab637c01e15a0

Authored by Marcelo Puebla
1 parent e3b7de210d
Exists in master

Codigo identado.

Showing 1 changed file with 51 additions and 46 deletions   Show diff stats
src/js/controller.js
... ... @@ -196,7 +196,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
196 196 notaPedidoBusinessService.addArticulos(
197 197 $scope.notaPedido.articulosNotaPedido,
198 198 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR);
199   -
  199 +
200 200 if ($scope.notaPedido.notaPedidoPuntoDescarga.length > 0) {
201 201 notaPedidoBusinessService.addPuntosDescarga(data.data.id,
202 202 $scope.notaPedido.notaPedidoPuntoDescarga);
... ... @@ -248,7 +248,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
248 248 }
249 249 }
250 250 );
251   - modalInstance.result.then(function(notaPedido) {
  251 + modalInstance.result.then(function (notaPedido) {
252 252  
253 253 notaPedido.articulosNotaPedido.forEach(function (articulo) {
254 254 articulo.precio =
... ... @@ -484,7 +484,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
484 484 templateUrl: 'foca-busqueda-cliente-modal.html',
485 485 controller: 'focaBusquedaClienteModalController',
486 486 resolve: {
487   - vendedor: function () { return { id: $scope.idVendedor} },
  487 + vendedor: function () { return { id: $scope.idVendedor }; },
488 488 cobrador: function () { return null; }
489 489 },
490 490 size: 'lg'
... ... @@ -601,7 +601,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
601 601 $filter('filter')($scope.botonera,
602 602 { label: 'Cliente' })[0].checked = true;
603 603 $filter('filter')($scope.botonera,
604   - { label: 'Domicilio de Entrega' })[0].checked = true;
  604 + { label: 'Domicilio de Entrega' })[0].checked = true;
605 605 })
606 606 .catch(function (e) { console.log(e); });
607 607 }, function () {
... ... @@ -642,8 +642,11 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
642 642 }
643 643  
644 644 function abrirModal() {
645   - var parametros = { idCliente: $scope.notaPedido.cliente.COD, idListaPrecio : $scope.notaPedido.cliente.MOD,
646   - notaPedido: $scope.notaPedido };
  645 + var parametros = {
  646 + idCliente: $scope.notaPedido.cliente.COD,
  647 + idListaPrecio: $scope.notaPedido.cliente.MOD,
  648 + notaPedido: $scope.notaPedido
  649 + };
647 650 var modalInstance = $uibModal.open(
648 651 {
649 652 ariaLabelledBy: 'Busqueda de Precio Condición',
... ... @@ -656,48 +659,48 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
656 659 }
657 660 );
658 661  
659   - modalInstance.result
660   - .then(function (precioCondicion) {
661   - var cabecera = '';
662   - var plazosConcat = '';
663   - if (!Array.isArray(precioCondicion)) {
664   - $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago;
665   - $scope.notaPedido.precioCondicion = precioCondicion;
666   - $scope.notaPedido.idPrecioCondicion = precioCondicion.listaPrecio.ID;
667   - $scope.notaPedido.cliente.MOD = precioCondicion.listaPrecio.ID;
668   - $scope.idLista = parseInt(precioCondicion.listaPrecio.ID) ?
669   - parseInt(precioCondicion.listaPrecio.ID) : -1;
670   - for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
671   - plazosConcat += precioCondicion.plazoPago[i].dias + ', ';
672   - }
673   - plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2);
674   - cabecera = $filter('rellenarDigitos')($scope.idLista, 4) +
675   - ' - ' + precioCondicion.listaPrecio.DES + ' ' + plazosConcat.trim();
676   - } else { //Cuando se ingresan los plazos manualmente
677   - $scope.notaPedido.idPrecioCondicion = 0;
678   - //-1, el modal productos busca todos los productos
679   - $scope.idLista = -1;
680   - $scope.notaPedido.notaPedidoPlazo = precioCondicion;
681   - for (var j = 0; j < precioCondicion.length; j++) {
682   - plazosConcat += precioCondicion[j].dias + ' ';
683   - }
684   - cabecera = 'Ingreso manual ' + plazosConcat.trim();
  662 + modalInstance.result.then(function (precioCondicion) {
  663 + var cabecera = '';
  664 + var plazosConcat = '';
  665 + if (!Array.isArray(precioCondicion)) {
  666 + $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago;
  667 + $scope.notaPedido.precioCondicion = precioCondicion;
  668 + $scope.notaPedido.idPrecioCondicion = precioCondicion.listaPrecio.ID;
  669 + $scope.notaPedido.cliente.MOD = precioCondicion.listaPrecio.ID;
  670 + $scope.idLista = parseInt(precioCondicion.listaPrecio.ID) ?
  671 + parseInt(precioCondicion.listaPrecio.ID) : -1;
  672 + for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
  673 + plazosConcat += precioCondicion.plazoPago[i].dias + ', ';
685 674 }
686   - $scope.cabeceras.push({
687   - label: 'Precios y Condiciones:',
688   - valor: $scope.idLista + ' - ' + precioCondicion.listaPrecio.DES + ' ' +
689   - notaPedidoBusinessService.plazoToString(precioCondicion.plazoPago)
690   - });
  675 + plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2);
  676 + cabecera = $filter('rellenarDigitos')($scope.idLista, 4) +
  677 + ' - ' + precioCondicion.listaPrecio.DES +
  678 + ' ' + plazosConcat.trim();
  679 + } else { //Cuando se ingresan los plazos manualmente
  680 + $scope.notaPedido.idPrecioCondicion = 0;
  681 + //-1, el modal productos busca todos los productos
  682 + $scope.idLista = -1;
  683 + $scope.notaPedido.notaPedidoPlazo = precioCondicion;
  684 + for (var j = 0; j < precioCondicion.length; j++) {
  685 + plazosConcat += precioCondicion[j].dias + ' ';
  686 + }
  687 + cabecera = 'Ingreso manual ' + plazosConcat.trim();
  688 + }
  689 + $scope.cabeceras.push({
  690 + label: 'Precios y Condiciones:',
  691 + valor: $scope.idLista + ' - ' + precioCondicion.listaPrecio.DES + ' ' +
  692 + notaPedidoBusinessService.plazoToString(precioCondicion.plazoPago)
  693 + });
691 694  
692   - $filter('filter')($scope.botonera,
693   - { label: 'Precios y Condiciones' })[0].checked = true;
694   -
695   - addArrayCabecera($scope.cabeceras);
  695 + $filter('filter')($scope.botonera,
  696 + { label: 'Precios y Condiciones' })[0].checked = true;
696 697  
697   - })
  698 + addArrayCabecera($scope.cabeceras);
  699 +
  700 + })
698 701 .catch(function (e) {
699 702 console.log(e);
700   - })
  703 + });
701 704  
702 705 }
703 706 };
... ... @@ -982,12 +985,14 @@ angular.module(&#39;focaCrearNotaPedido&#39;).controller(&#39;notaPedidoCtrl&#39;,
982 985  
983 986 function valorPrecioCondicion() {
984 987 if (notaPedido.idListaPrecio > 0) {
985   - crearNotaPedidoService.getPrecioCondicionById(parseInt(notaPedido.idListaPrecio))
  988 + crearNotaPedidoService
  989 + .getPrecioCondicionById(parseInt(notaPedido.idListaPrecio))
986 990 .then(function (res) {
987 991 $scope.cabeceras.push({
988 992 label: 'Precios y Condiciones:',
989   - valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' +
990   - notaPedidoBusinessService
  993 + valor: parseInt(res.data[0].ID) + ' - ' +
  994 + res.data[0].DES + ' ' +
  995 + notaPedidoBusinessService
991 996 .plazoToString(notaPedido.notaPedidoPlazo)
992 997 });
993 998 addArrayCabecera($scope.cabeceras);