Commit 39d9e5d4408fddb39f90c08cdcf6a58e36e5796f
Exists in
master
Merge remote-tracking branch 'upstream/develop'
Showing
3 changed files
Show diff stats
package.json
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | "description": "Listado y ABM nota de pedidos", |
5 | 5 | "main": "index.js", |
6 | 6 | "scripts": { |
7 | + "refresh": "gulp uglify && cp tmp/foca-crear-nota-pedido.js ../wrapper-demo/node_modules/foca-crear-nota-pedido/dist/foca-crear-nota-pedido.min.js", | |
7 | 8 | "test": "test.html", |
8 | 9 | "compile": "gulp uglify", |
9 | 10 | "gulp-pre-commit": "gulp pre-commit", |
src/js/controller.js
... | ... | @@ -343,7 +343,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
343 | 343 | { |
344 | 344 | puntoDescarga: punto |
345 | 345 | } |
346 | - ) | |
346 | + ); | |
347 | 347 | }); |
348 | 348 | |
349 | 349 | $scope.$broadcast('addCabecera', { |
... | ... | @@ -460,7 +460,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
460 | 460 | } |
461 | 461 | }; |
462 | 462 | |
463 | - $scope.seleccionarCliente = function (ocultarVendedor) { | |
463 | + $scope.seleccionarCliente = function () { | |
464 | 464 | if (validarNotaRemitada()) { |
465 | 465 | var modalInstance = $uibModal.open( |
466 | 466 | { |
... | ... | @@ -476,6 +476,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
476 | 476 | ); |
477 | 477 | modalInstance.result.then( |
478 | 478 | function (cliente) { |
479 | + cliente.mod = cliente.mod; | |
479 | 480 | $scope.abrirModalDomicilios(cliente); |
480 | 481 | $scope.cliente = cliente; |
481 | 482 | }, function () { } |
... | ... | @@ -554,8 +555,9 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
554 | 555 | $scope.notaPedido.vendedor = res.data; |
555 | 556 | $scope.$broadcast('addCabecera', { |
556 | 557 | label: 'Vendedor:', |
557 | - valor: $filter('rellenarDigitos')($scope.notaPedido.vendedor.NUM, 3) + ' - ' + | |
558 | - $scope.notaPedido.vendedor.NOM | |
558 | + valor: $filter('rellenarDigitos') | |
559 | + ($scope.notaPedido.vendedor.NUM, 3) + | |
560 | + ' - ' + $scope.notaPedido.vendedor.NOM | |
559 | 561 | }); |
560 | 562 | } |
561 | 563 | var domicilioStamp = |
... | ... | @@ -565,7 +567,8 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
565 | 567 | |
566 | 568 | $scope.$broadcast('addCabecera', { |
567 | 569 | label: 'Cliente:', |
568 | - valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom | |
570 | + valor: $filter('rellenarDigitos')(cliente.cod, 5) + | |
571 | + ' - ' + cliente.nom | |
569 | 572 | }); |
570 | 573 | |
571 | 574 | $scope.$broadcast('addCabecera', { |
... | ... | @@ -579,9 +582,10 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
579 | 582 | } |
580 | 583 | |
581 | 584 | // Seteo checked en botonera |
582 | - $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | |
585 | + $filter('filter')($scope.botonera, | |
586 | + { label: 'Cliente' })[0].checked = true; | |
583 | 587 | }) |
584 | - .catch(function (e) { console.log(e); }) | |
588 | + .catch(function (e) { console.log(e); }); | |
585 | 589 | }, function () { |
586 | 590 | $scope.seleccionarCliente(true); |
587 | 591 | return; |
... | ... | @@ -634,27 +638,27 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
634 | 638 | controller: 'focaModalPrecioCondicionController', |
635 | 639 | size: 'lg', |
636 | 640 | resolve: { |
637 | - idListaPrecio: function () { | |
638 | - return $scope.notaPedido.cliente.MOD || null; | |
639 | - } | |
641 | + idListaPrecio: function () { return $scope.notaPedido.cliente.MOD || null; }, | |
642 | + idCliente: function () { return $scope.notaPedido.cliente.COD } | |
640 | 643 | } |
641 | 644 | } |
642 | 645 | ); |
643 | 646 | |
644 | - modalInstance.result.then( | |
645 | - function (precioCondicion) { | |
647 | + modalInstance.result | |
648 | + .then(function (precioCondicion) { | |
646 | 649 | var cabecera = ''; |
647 | 650 | var plazosConcat = ''; |
648 | 651 | if (!Array.isArray(precioCondicion)) { |
649 | 652 | $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago; |
650 | 653 | $scope.notaPedido.precioCondicion = precioCondicion; |
651 | - $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | |
652 | - $scope.idLista = precioCondicion.idListaPrecio; | |
654 | + $scope.notaPedido.idPrecioCondicion = precioCondicion.listaPrecio.ID; | |
655 | + $scope.idLista = precioCondicion.listaPrecio.ID; | |
653 | 656 | for (var i = 0; i < precioCondicion.plazoPago.length; i++) { |
654 | - plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | |
655 | - } | |
656 | - cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | |
657 | - ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | |
657 | + plazosConcat += precioCondicion.plazoPago[i].dias + ', '; | |
658 | + } | |
659 | + plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2); | |
660 | + cabecera = $filter('rellenarDigitos')(parseInt(precioCondicion.listaPrecio.ID), 4) + | |
661 | + ' - ' + precioCondicion.listaPrecio.DES + ' ' + plazosConcat.trim(); | |
658 | 662 | } else { //Cuando se ingresan los plazos manualmente |
659 | 663 | $scope.notaPedido.idPrecioCondicion = 0; |
660 | 664 | //-1, el modal productos busca todos los productos |
... | ... | @@ -673,10 +677,11 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
673 | 677 | |
674 | 678 | $filter('filter')($scope.botonera, |
675 | 679 | { label: 'Precios y Condiciones' })[0].checked = true; |
676 | - }, function () { | |
680 | + }) | |
681 | + .catch(function (e) { | |
682 | + console.log(e); | |
683 | + }) | |
677 | 684 | |
678 | - } | |
679 | - ); | |
680 | 685 | } |
681 | 686 | }; |
682 | 687 | |
... | ... | @@ -791,9 +796,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
791 | 796 | |
792 | 797 | $scope.agregarATabla = function (key) { |
793 | 798 | if (key === 13) { |
794 | - if ($scope.articuloACargar.cantidad === undefined || | |
795 | - $scope.articuloACargar.cantidad === 0 || | |
796 | - $scope.articuloACargar.cantidad === null) { | |
799 | + if (!$scope.articuloACargar.cantidad || !$scope.articuloACargar.precio) { | |
797 | 800 | focaModalService.alert('El valor debe ser al menos 1'); |
798 | 801 | return; |
799 | 802 | } |
... | ... | @@ -811,7 +814,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
811 | 814 | |
812 | 815 | $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) { |
813 | 816 | if (key === 13) { |
814 | - if (!articulo.cantidad || !articulo.precio) { | |
817 | + if (!articulo.cantidad || !articulo.precio || !tmpCantidad || !tmpPrecio) { | |
815 | 818 | focaModalService.alert('Los valores deben ser al menos 1'); |
816 | 819 | return; |
817 | 820 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { |
src/js/service.js
... | ... | @@ -99,7 +99,7 @@ angular.module('focaCrearNotaPedido') |
99 | 99 | return $http.get(API_ENDPOINT.URL + '/proveedor/' + id); |
100 | 100 | }, |
101 | 101 | getParametros: function() { |
102 | - return $http.get(API_ENDPOINT.URL + '/parametros/' + 'notaPedido') | |
102 | + return $http.get(API_ENDPOINT.URL + '/parametros/' + 'notaPedido'); | |
103 | 103 | } |
104 | 104 | }; |
105 | 105 | }]); |