Commit 1083a8005ec0d5cd5b826b73d56ec55ea495c9e8
Exists in
master
Merge branch 'master' into 'develop'
Master See merge request !59
Showing
3 changed files
Show diff stats
spec/controllerSpec.js
... | ... | @@ -211,7 +211,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
211 | 211 | $filter: filter, |
212 | 212 | $timeout: timeout, |
213 | 213 | crearNotaPedidoService: { |
214 | - getNumeroNotaPedido: function() { | |
214 | + getNumeroNotaPedido: function() { | |
215 | 215 | return { |
216 | 216 | then: function() { } |
217 | 217 | }; |
... | ... | @@ -255,7 +255,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
255 | 255 | 'undefined', function() |
256 | 256 | { |
257 | 257 | //arrange |
258 | - var scope = { | |
258 | + var scope = { | |
259 | 259 | $watch: function() { }, |
260 | 260 | $broadcast: function() { } |
261 | 261 | }; |
... | ... | @@ -379,7 +379,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
379 | 379 | $filter: filter, |
380 | 380 | $timeout: timeout, |
381 | 381 | crearNotaPedidoService: { |
382 | - getNumeroNotaPedido: function() { | |
382 | + getNumeroNotaPedido: function() { | |
383 | 383 | return { |
384 | 384 | then: function() { } |
385 | 385 | }; |
... | ... | @@ -910,16 +910,18 @@ describe('Controladores módulo crear nota de pedido', function() { |
910 | 910 | var cliente = { |
911 | 911 | COD: undefined, |
912 | 912 | CUIT: undefined, |
913 | - NOM: undefined | |
913 | + NOM: undefined, | |
914 | + MOD: undefined | |
914 | 915 | }; |
915 | 916 | |
916 | 917 | //act |
917 | 918 | spyOn(uibModal, 'open').and.returnValue(promesaRespuesta); |
918 | 919 | spyOn(scope, '$broadcast'); |
919 | - scope.abrirModalDomicilios({ }); | |
920 | + scope.abrirModalDomicilios(cliente); | |
920 | 921 | |
921 | 922 | //assert |
922 | 923 | promesaRespuesta.result.then(function() { |
924 | + //scope.notaPedido.domicilio sea vacio | |
923 | 925 | expect(scope.notaPedido.domicilio).toEqual(respuesta); |
924 | 926 | expect(scope.notaPedido.cliente).toEqual(cliente); |
925 | 927 | expect(scope.$broadcast).toHaveBeenCalled(); |
... | ... | @@ -1073,7 +1075,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1073 | 1075 | $localStorage: {} |
1074 | 1076 | }); |
1075 | 1077 | |
1076 | - scope.notaPedido = {}; | |
1078 | + scope.notaPedido = { | |
1079 | + cliente: { COD: true } | |
1080 | + }; | |
1077 | 1081 | |
1078 | 1082 | var respuesta = { result: {then: function() { } } }; |
1079 | 1083 | |
... | ... | @@ -1128,7 +1132,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
1128 | 1132 | }); |
1129 | 1133 | scope.idLista = true; |
1130 | 1134 | scope.notaPedido = { |
1131 | - vendedor: { NUM: true } | |
1135 | + vendedor: { NUM: true }, | |
1136 | + cliente: { COD: true } | |
1132 | 1137 | }; |
1133 | 1138 | var respuesta = { plazoPago: { } }; |
1134 | 1139 | var promesaRespuesta = { result: Promise.resolve(respuesta) }; |
src/js/controller.js
... | ... | @@ -48,7 +48,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
48 | 48 | if (APP === 'distribuidor') { |
49 | 49 | $scope.idVendedor = focaLoginService.getLoginData().vendedorCobrador; |
50 | 50 | } |
51 | - | |
51 | + | |
52 | 52 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
53 | 53 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
54 | 54 | var monedaPorDefecto = res.data[0]; |
... | ... | @@ -341,8 +341,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
341 | 341 | } |
342 | 342 | }; |
343 | 343 | |
344 | - $scope.seleccionarTransportista = function() { | |
345 | - $scope.seleccionarProveedor(function() { | |
344 | + $scope.seleccionarProveedor = function() { | |
345 | + $scope.abrirModalProveedores(function() { | |
346 | 346 | if (validarNotaRemitada()) { |
347 | 347 | var modalInstance = $uibModal.open( |
348 | 348 | { |
... | ... | @@ -468,7 +468,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
468 | 468 | }, ocultarVendedor); |
469 | 469 | }; |
470 | 470 | |
471 | - $scope.seleccionarProveedor = function(callback) { | |
471 | + $scope.abrirModalProveedores = function(callback) { | |
472 | 472 | if (validarNotaRemitada()) { |
473 | 473 | var parametrosModal = { |
474 | 474 | titulo: 'Búsqueda de Proveedor', |
... | ... | @@ -587,7 +587,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
587 | 587 | focaModalService.alert('Primero seleccione un cliente'); |
588 | 588 | return; |
589 | 589 | } |
590 | - if(validarNotaRemitada()) { | |
590 | + if (validarNotaRemitada()) { | |
591 | 591 | var modalInstance = $uibModal.open( |
592 | 592 | { |
593 | 593 | ariaLabelledBy: 'Busqueda de Precio Condición', |
... | ... | @@ -816,7 +816,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
816 | 816 | }); |
817 | 817 | cabeceras.push({ |
818 | 818 | label: 'Fecha cotizacion:', |
819 | - valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
819 | + valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
820 | 820 | 'dd/MM/yyyy') |
821 | 821 | }); |
822 | 822 | cabeceras.push({ |
... | ... | @@ -892,24 +892,24 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
892 | 892 | } |
893 | 893 | cabeceras.push(cabeceraBomba); |
894 | 894 | } |
895 | - | |
895 | + | |
896 | 896 | notaPedidoBusinessService.calcularArticulos($scope.notaPedido.articulosNotaPedido, |
897 | 897 | notaPedido.cotizacion.VENDEDOR); |
898 | - | |
898 | + | |
899 | 899 | if (notaPedido.idPrecioCondicion > 0) { |
900 | 900 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
901 | 901 | } else { |
902 | 902 | $scope.idLista = -1; |
903 | 903 | } |
904 | - | |
904 | + | |
905 | 905 | $scope.puntoVenta = $filter('rellenarDigitos')( |
906 | 906 | notaPedido.sucursal, 4 |
907 | 907 | ); |
908 | - | |
908 | + | |
909 | 909 | $scope.comprobante = $filter('rellenarDigitos')( |
910 | 910 | notaPedido.numeroNotaPedido, 8 |
911 | 911 | ); |
912 | - | |
912 | + | |
913 | 913 | $scope.notaPedido.notaPedidoPuntoDescarga = |
914 | 914 | formatearPuntosDescarga(notaPedido.notaPedidoPuntoDescarga || []); |
915 | 915 | addArrayCabecera(cabeceras); |