Commit ead69bf5119c5de29e3bce5f242aa2372f4b2cfc
1 parent
0a0a9f0c0d
Exists in
master
and in
1 other branch
puntos de descargA
Showing
2 changed files
with
6 additions
and
52 deletions
Show diff stats
src/js/businessService.js
... | ... | @@ -24,22 +24,15 @@ angular.module('focaCrearNotaPedido') |
24 | 24 | crearNotaPedidoService.crearEstadoParaNotaPedido(estado); |
25 | 25 | }, |
26 | 26 | addPuntosDescarga: function(idNotaPedido, puntosDescarga) { |
27 | + | |
27 | 28 | var puntos = []; |
28 | 29 | |
29 | - if (puntosDescarga && puntosDescarga.length > 0) { | |
30 | - puntosDescarga.forEach(function(punto) { | |
31 | - if (puntos.articulosAgregados && puntos.articulosAgregados.length > 0) { | |
32 | - punto.articulosAgregados.forEach(function(articulo) { | |
33 | - puntos.push({ | |
34 | - idPuntoDescarga: punto.id, | |
35 | - idNotaPedido: idNotaPedido, | |
36 | - idProducto: articulo.id, | |
37 | - cantidad: articulo.cantidad | |
38 | - }); | |
39 | - }); | |
40 | - } | |
30 | + puntosDescarga.forEach(function(punto) { | |
31 | + puntos.push({ | |
32 | + idPuntoDescarga: punto.id, | |
33 | + idNotaPedido: idNotaPedido, | |
41 | 34 | }); |
42 | - } | |
35 | + }); | |
43 | 36 | |
44 | 37 | return crearNotaPedidoService.crearPuntosDescarga(puntos); |
45 | 38 | }, |
src/js/controller.js
... | ... | @@ -908,9 +908,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
908 | 908 | notaPedido.numeroNotaPedido, 8 |
909 | 909 | ); |
910 | 910 | |
911 | - $scope.notaPedido.notaPedidoPuntoDescarga = | |
912 | - formatearPuntosDescarga(notaPedido.notaPedidoPuntoDescarga || []); | |
913 | - | |
914 | 911 | addArrayCabecera(cabeceras); |
915 | 912 | } |
916 | 913 | |
... | ... | @@ -932,42 +929,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
932 | 929 | } |
933 | 930 | } |
934 | 931 | |
935 | - function formatearPuntosDescarga(puntosDescarga) { | |
936 | - var result = []; | |
937 | - | |
938 | - puntosDescarga.forEach(function(el) { | |
939 | - | |
940 | - var puntoDescarga = result.filter(function(resultPunto) { | |
941 | - return resultPunto.id === el.idPuntoDescarga; | |
942 | - }); | |
943 | - | |
944 | - if (puntoDescarga.length) { | |
945 | - puntoDescarga[0].articulosAgregados.push({ | |
946 | - cantidad: el.cantidad, | |
947 | - descripcion: el.producto.descripcion, | |
948 | - id: el.producto.id | |
949 | - }); | |
950 | - } else { | |
951 | - result.push({ | |
952 | - id: el.puntoDescarga.id, | |
953 | - id_cliente: el.puntoDescarga.id_cliente, | |
954 | - id_da_config_0: el.puntoDescarga.id_da_config_0, | |
955 | - latitud: el.puntoDescarga.latitud, | |
956 | - longitud: el.puntoDescarga.longitud, | |
957 | - descripcion: el.puntoDescarga.descripcion, | |
958 | - articulosAgregados: [ | |
959 | - { | |
960 | - cantidad: el.cantidad, | |
961 | - descripcion: el.producto.descripcion, | |
962 | - id: el.producto.id | |
963 | - } | |
964 | - ] | |
965 | - }); | |
966 | - } | |
967 | - }); | |
968 | - return result; | |
969 | - } | |
970 | - | |
971 | 932 | function salir() { |
972 | 933 | var confirmacion = false; |
973 | 934 |