Commit 57b88ae8ad89fdd3610fd4a285a4f67f515f162c

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'develop'

Arreglo en nota pedido no mostraba la cabecera elegida al dar pausa.

See merge request !70
src/js/controller.js
... ... @@ -323,16 +323,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
323 323 function(puntosDescarga) {
324 324 $scope.notaPedido.notaPedidoPuntoDescarga = puntosDescarga;
325 325  
326   - //AGREGO PUNTOS DE DESCARGA A CABECERA
327   - var puntosStamp = '';
328   - puntosDescarga.forEach(function(punto, idx, arr) {
329   - puntosStamp += punto.descripcion;
330   - if ((idx + 1) !== arr.length) puntosStamp += ', ';
331   - });
332   -
333 326 $scope.$broadcast('addCabecera', {
334 327 label: 'Puntos de descarga:',
335   - valor: puntosStamp
  328 + valor: getCabeceraPuntoDescarga(puntosDescarga)
336 329 });
337 330 }, function() {
338 331 $scope.abrirModalDomicilios($scope.cliente);
... ... @@ -827,6 +820,14 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
827 820 });
828 821 }
829 822  
  823 + if (notaPedido.vendedor.NUM) {
  824 + cabeceras.push({
  825 + label: 'Vendedor:',
  826 + valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) +
  827 + ' - ' + notaPedido.vendedor.NOM
  828 + });
  829 + }
  830 +
830 831 if (notaPedido.cliente.COD) {
831 832 cabeceras.push({
832 833 label: 'Cliente:',
... ... @@ -838,14 +839,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
838 839 });
839 840 }
840 841  
841   - if (notaPedido.vendedor.NUM) {
842   - cabeceras.push({
843   - label: 'Vendedor:',
844   - valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) +
845   - ' - ' + notaPedido.vendedor.NOM
846   - });
847   - }
848   -
849 842 if (notaPedido.proveedor.COD) {
850 843 cabeceras.push({
851 844 label: 'Proveedor:',
... ... @@ -908,9 +901,26 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
908 901 notaPedido.numeroNotaPedido, 8
909 902 );
910 903  
  904 + if (notaPedido.notaPedidoPuntoDescarga) {
  905 + var puntosDescarga = notaPedido.notaPedidoPuntoDescarga
  906 + cabeceras.push({
  907 + label: 'Puntos de descarga: ',
  908 + valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntosDescarga))
  909 + });
  910 + }
  911 +
911 912 addArrayCabecera(cabeceras);
912 913 }
913 914  
  915 + function getCabeceraPuntoDescarga(puntosDescarga){
  916 + var puntosStamp = '';
  917 + puntosDescarga.forEach(function(punto, idx, arr) {
  918 + puntosStamp += punto.descripcion;
  919 + if ((idx + 1) !== arr.length) puntosStamp += ', ';
  920 + });
  921 + return puntosStamp;
  922 + }
  923 +
914 924 function addArrayCabecera(array) {
915 925 for (var i = 0; i < array.length; i++) {
916 926 $scope.$broadcast('addCabecera', {
... ... @@ -959,7 +969,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
959 969  
960 970 function deleteCliente() {
961 971 delete $scope.notaPedido.domicilioStamp;
962   - delete $scope.notaPedido.notaPedidoPuntosDescarga;
  972 + delete $scope.notaPedido.notaPedidoPuntoDescarga;
963 973 $scope.notaPedido.domicilio = {dom: ''};
964 974 $scope.notaPedido.cliente = {};
965 975 $scope.$broadcast('removeCabecera', 'Cliente:');