diff --git a/src/js/controllerUltimosDespachos.js b/src/js/controllerUltimosDespachos.js index faa4aff..b49865a 100644 --- a/src/js/controllerUltimosDespachos.js +++ b/src/js/controllerUltimosDespachos.js @@ -11,8 +11,39 @@ angular.module('focaCrearFactura') function config() { + $scope.productos = []; + crearFacturaService.getUltimosDespachos(parametros.planilla).then(function (res) { - $scope.productos = res.data.slice(1, res.data.length); + + res.data.slice(1, res.data.length).forEach(function (producto) { + + producto.mangueras = []; + + producto.despachos.forEach(function (despacho) { + + var findCsu = producto.mangueras.filter(function (csu) { + return csu.csu === despacho.CSU.trim(); + })[0]; + + if (!findCsu) { + + var manguera = { + csu: despacho.CSU.trim(), + despachos: [despacho], + show: true + }; + + producto.mangueras.unshift(manguera); + } else { + findCsu.despachos.push(despacho); + } + }); + + $scope.productos.push(producto); + }); + + console.log($scope.productos); + }); } diff --git a/src/js/service.js b/src/js/service.js index aeea056..77e1897 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -16,7 +16,7 @@ angular.module('focaCrearFactura') return $http.get(route + '/turnos/productos/' + numeroPlanilla); }, getUltimosDespachos: function (numeroPlanilla) { - return $http.get(route + '/turnos/productos/' + numeroPlanilla + '/true'); + return $http.get('http://10.231.45.194:9900' + '/turnos/productos/' + numeroPlanilla + '/true'); }, setearDespachoOcupado: function (parametros) { return $http.post(route + '/turnos/despacho-en-uso', parametros); diff --git a/src/views/modal-ultimos-despachos.html b/src/views/modal-ultimos-despachos.html index 8521758..30f30e6 100644 --- a/src/views/modal-ultimos-despachos.html +++ b/src/views/modal-ultimos-despachos.html @@ -16,39 +16,39 @@

-
-
- - - - - - - - - - - -
- -
-
-
+
+
+ + + + + + + + + + + +
+ +
+
+