diff --git a/src/js/controller.js b/src/js/controller.js index 85cd1bc..834689d 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -476,6 +476,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', ); modalInstance.result.then( function (cliente) { + cliente.mod = cliente.mod; $scope.abrirModalDomicilios(cliente); $scope.cliente = cliente; }, function () { } @@ -637,27 +638,27 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', controller: 'focaModalPrecioCondicionController', size: 'lg', resolve: { - idListaPrecio: function () { - return $scope.notaPedido.cliente.MOD || null; - } + idListaPrecio: function () { return $scope.notaPedido.cliente.MOD || null; }, + idCliente: function () { return $scope.notaPedido.cliente.COD } } } ); - modalInstance.result.then( - function (precioCondicion) { + modalInstance.result + .then(function (precioCondicion) { var cabecera = ''; var plazosConcat = ''; if (!Array.isArray(precioCondicion)) { $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago; $scope.notaPedido.precioCondicion = precioCondicion; - $scope.notaPedido.idPrecioCondicion = precioCondicion.id; - $scope.idLista = precioCondicion.idListaPrecio; + $scope.notaPedido.idPrecioCondicion = precioCondicion.listaPrecio.ID; + $scope.idLista = precioCondicion.listaPrecio.ID; for (var i = 0; i < precioCondicion.plazoPago.length; i++) { - plazosConcat += precioCondicion.plazoPago[i].dias + ' '; - } - cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + - ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); + plazosConcat += precioCondicion.plazoPago[i].dias + ', '; + } + var plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2); + cabecera = $filter('rellenarDigitos')(precioCondicion.listaPrecio.ID, 4) + + ' - ' + precioCondicion.listaPrecio.DES + ' ' + plazosConcat.trim(); } else { //Cuando se ingresan los plazos manualmente $scope.notaPedido.idPrecioCondicion = 0; //-1, el modal productos busca todos los productos @@ -676,10 +677,11 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', $filter('filter')($scope.botonera, { label: 'Precios y Condiciones' })[0].checked = true; - }, function () { + }) + .catch(function (e) { + console.log(e); + }) - } - ); } }; @@ -794,8 +796,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', $scope.agregarATabla = function (key) { if (key === 13) { - if (!$scope.articuloACargar.cantidad || !$scope.articuloACargar.precio) - { + if (!$scope.articuloACargar.cantidad || !$scope.articuloACargar.precio) { focaModalService.alert('El valor debe ser al menos 1'); return; }