Commit e5e28ec46905fc44ba520aca07884b3a7d997f5d
Exists in
master
Merge remote-tracking branch 'upstream/develop'
Showing
1 changed file
Show diff stats
src/js/controller.js
| ... | ... | @@ -398,6 +398,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 398 | 398 | $scope.notaPedido.bomba = false; |
| 399 | 399 | $scope.notaPedido.kilometros = null; |
| 400 | 400 | } |
| 401 | + | |
| 402 | + $filter('filter')($scope.botonera, | |
| 403 | + { label: 'Proveedor'})[0].checked = true; | |
| 401 | 404 | }, function() { |
| 402 | 405 | $scope.seleccionarTransportista(); |
| 403 | 406 | } |
| ... | ... | @@ -549,10 +552,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 549 | 552 | label: 'Cliente:', |
| 550 | 553 | valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom |
| 551 | 554 | }); |
| 555 | + | |
| 552 | 556 | $scope.$broadcast('addCabecera', { |
| 553 | 557 | label: 'Domicilio:', |
| 554 | 558 | valor: domicilioStamp |
| 555 | 559 | }); |
| 560 | + | |
| 556 | 561 | if (domicilio.verPuntos) { |
| 557 | 562 | delete $scope.notaPedido.domicilio.verPuntos; |
| 558 | 563 | $scope.seleccionarPuntosDeDescarga(); |
| ... | ... | @@ -563,6 +568,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 563 | 568 | if (res.data.length) $scope.seleccionarPuntosDeDescarga(); |
| 564 | 569 | }); |
| 565 | 570 | } |
| 571 | + | |
| 572 | + // Seteo checked en botonera | |
| 573 | + $filter('filter')($scope.botonera, { label: 'Cliente'})[0].checked = true; | |
| 574 | + | |
| 566 | 575 | }, function() { |
| 567 | 576 | $scope.seleccionarCliente(true); |
| 568 | 577 | return; |
| ... | ... | @@ -646,6 +655,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 646 | 655 | label: 'Precios y condiciones:', |
| 647 | 656 | valor: cabecera |
| 648 | 657 | }); |
| 658 | + | |
| 659 | + $filter('filter')($scope.botonera, | |
| 660 | + { label: 'Precios y Condiciones'})[0].checked = true; | |
| 649 | 661 | }, function() { |
| 650 | 662 | |
| 651 | 663 | } |
| ... | ... | @@ -739,6 +751,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 739 | 751 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
| 740 | 752 | }); |
| 741 | 753 | } |
| 754 | + | |
| 755 | + $filter('filter')($scope.botonera, { label: 'Moneda'})[0].checked = true; | |
| 742 | 756 | }, function() { |
| 743 | 757 | |
| 744 | 758 | } |
| ... | ... | @@ -823,6 +837,17 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 823 | 837 | articulo.precio = parseFloat(articulo.precio); |
| 824 | 838 | }; |
| 825 | 839 | |
| 840 | + // TODO: quitar watch usar función de articulos pedido cuando se haga | |
| 841 | + $scope.$watch('notaPedido.articulosNotaPedido', function() { | |
| 842 | + if ($scope.notaPedido.articulosNotaPedido.length) { | |
| 843 | + $filter('filter')($scope.botonera, | |
| 844 | + { label: 'Productos'})[0].checked = true; | |
| 845 | + } else { | |
| 846 | + $filter('filter')($scope.botonera, | |
| 847 | + { label: 'Productos'})[0].checked = false; | |
| 848 | + } | |
| 849 | + }, true); | |
| 850 | + | |
| 826 | 851 | function setearNotaPedido(notaPedido) { |
| 827 | 852 | //añado cabeceras |
| 828 | 853 | $scope.notaPedido = notaPedido; |
| ... | ... | @@ -854,6 +879,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 854 | 879 | }); |
| 855 | 880 | } |
| 856 | 881 | |
| 882 | + if (notaPedido.cotizacion.moneda) { | |
| 883 | + $filter('filter')($scope.botonera, { label: 'Moneda'})[0].checked = true; | |
| 884 | + } | |
| 885 | + | |
| 857 | 886 | if (notaPedido.vendedor.NUM) { |
| 858 | 887 | cabeceras.push({ |
| 859 | 888 | label: 'Vendedor:', |
| ... | ... | @@ -871,6 +900,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 871 | 900 | label: 'Domicilio:', |
| 872 | 901 | valor: notaPedido.domicilioStamp |
| 873 | 902 | }); |
| 903 | + | |
| 904 | + $filter('filter')($scope.botonera, { label: 'Cliente'})[0].checked = true; | |
| 874 | 905 | } |
| 875 | 906 | |
| 876 | 907 | if (notaPedido.proveedor.COD) { |
| ... | ... | @@ -879,6 +910,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 879 | 910 | valor: $filter('rellenarDigitos')(notaPedido.proveedor.COD, 5) + |
| 880 | 911 | ' - ' + notaPedido.proveedor.NOM |
| 881 | 912 | }); |
| 913 | + | |
| 914 | + $filter('filter')($scope.botonera, { label: 'Proveedor'})[0].checked = true; | |
| 882 | 915 | } |
| 883 | 916 | |
| 884 | 917 | if (notaPedido.notaPedidoPlazo.length) { |
| ... | ... | @@ -888,6 +921,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 888 | 921 | notaPedidoBusinessService |
| 889 | 922 | .plazoToString(notaPedido.notaPedidoPlazo) |
| 890 | 923 | }); |
| 924 | + | |
| 925 | + $filter('filter')($scope.botonera, | |
| 926 | + { label: 'Precios y Condiciones'})[0].checked = true; | |
| 891 | 927 | } |
| 892 | 928 | |
| 893 | 929 | if (notaPedido.flete !== undefined) { |
| ... | ... | @@ -923,7 +959,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 923 | 959 | |
| 924 | 960 | if (notaPedido.idPrecioCondicion > 0) { |
| 925 | 961 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
| 926 | - } else { | |
| 962 | + } else if (notaPedido.idPrecioCondicion) { | |
| 927 | 963 | $scope.idLista = -1; |
| 928 | 964 | } |
| 929 | 965 |