Commit 3e325c506745f7da26798d7728412e4724e17159

Authored by Jose Pinto
1 parent d12bccc382
Exists in master and in 1 other branch develop

espacios y corrijo errores test

spec/controllerSpec.js
... ... @@ -990,7 +990,6 @@ describe('Controladores módulo crear nota de pedido', function() {
990 990 scope.notaPedido.articulosNotaPedido = [{ precio: 2, cantidad: 1}];
991 991 var esperado = 2;
992 992 var resultado = scope.getTotal();
993   - console.log('resultado', resultado);
994 993  
995 994 //assert
996 995 expect(resultado).toEqual(esperado);
... ... @@ -1739,8 +1738,8 @@ describe('Controladores módulo crear nota de pedido', function() {
1739 1738 crearNotaPedidoService: {
1740 1739 getNumeroNotaPedido: function() {
1741 1740 return {
1742   - then: function() { }
1743   - };
  1741 + then: function() { }
  1742 + };
1744 1743 },
1745 1744 getBotonera: function() { },
1746 1745 getCotizacionByIdMoneda: function() {
spec/controllerSpecCrearPedido.js
... ... @@ -886,11 +886,12 @@ describe('Controladores módulo crear nota de pedido', function() {
886 886 spyOn(notaPedidoBusinessService, 'addArticulos');
887 887 scope.crearNotaPedido();
888 888 //expect
889   - crearNotaPedidoService.crearNotaPedido().then(function() {
  889 +
  890 + promesa.then(function() {
890 891 expect(focaSeguimientoService.guardarPosicion).toHaveBeenCalled();
891 892 expect(notaPedidoBusinessService.addArticulos).toHaveBeenCalled();
892 893 done();
893   - }).catch(done);
  894 + });
894 895  
895 896 });
896 897 });
src/js/controller.js
... ... @@ -61,12 +61,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
61 61 );
62 62  
63 63 $scope.inicial.cotizacion = $scope.notaPedido.cotizacion;
64   -
65 64 });
66   -
  65 +
67 66 init();
68 67 $timeout(function() {getLSNotaPedido();});
69   -
70 68 }
71 69  
72 70 function init() {
... ... @@ -83,7 +81,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
83 81 articulosNotaPedido: [],
84 82 notaPedidoPlazo: []
85 83 };
86   -
87 84 $scope.idLista = undefined;
88 85  
89 86 crearNotaPedidoService.getNumeroNotaPedido().then(
... ... @@ -129,33 +126,33 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
129 126 }, true);
130 127  
131 128 $scope.crearNotaPedido = function() {
132   - if(!$scope.notaPedido.vendedor.id) {
  129 + if (!$scope.notaPedido.vendedor.id) {
133 130 focaModalService.alert('Ingrese Vendedor');
134 131 return;
135   - } else if(!$scope.notaPedido.cliente.COD) {
  132 + } else if (!$scope.notaPedido.cliente.COD) {
136 133 focaModalService.alert('Ingrese Cliente');
137 134 return;
138   - } else if(!$scope.notaPedido.proveedor.COD) {
  135 + } else if (!$scope.notaPedido.proveedor.COD) {
139 136 focaModalService.alert('Ingrese Proveedor');
140 137 return;
141   - } else if(!$scope.notaPedido.cotizacion.ID) {
  138 + } else if (!$scope.notaPedido.cotizacion.ID) {
142 139 focaModalService.alert('Ingrese Cotización');
143 140 return;
144   - } else if(!$scope.notaPedido.cotizacion.moneda.ID) {
  141 + } else if (!$scope.notaPedido.cotizacion.moneda.ID) {
145 142 focaModalService.alert('Ingrese Moneda');
146 143 return;
147   - } else if(!$scope.notaPedido.notaPedidoPlazo) {
  144 + } else if (!$scope.notaPedido.notaPedidoPlazo) {
148 145 focaModalService.alert('Ingrese Precios y Condiciones');
149 146 return;
150   - } else if(
  147 + } else if (
151 148 $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null)
152 149 {
153 150 focaModalService.alert('Ingrese Flete');
154 151 return;
155   - } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto
  152 + } else if (!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto
156 153 focaModalService.alert('Ingrese Domicilio');
157 154 return;
158   - } else if($scope.notaPedido.articulosNotaPedido.length === 0) {
  155 + } else if ($scope.notaPedido.articulosNotaPedido.length === 0) {
159 156 focaModalService.alert('Debe cargar al menos un articulo');
160 157 return;
161 158 }
... ... @@ -169,7 +166,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
169 166 nombreCliente: $scope.notaPedido.cliente.NOM,
170 167 cuitCliente: $scope.notaPedido.cliente.CUIT,
171 168 idProveedor: $scope.notaPedido.proveedor.COD,
172   - idDomicilio: $scope.notaPedido.idDomicilio || $scope.notaPedido.domicilio.id,
  169 + idDomicilio: $scope.notaPedido.domicilio.id,
173 170 idCotizacion: $scope.notaPedido.cotizacion.ID,
174 171 idPrecioCondicion: $scope.notaPedido.idPrecioCondicion,
175 172 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR,
... ... @@ -845,19 +842,19 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
845 842  
846 843  
847 844 function valorPrecioCondicion() {
848   - if(notaPedido.idPrecioCondicion > 0) {
  845 + if (notaPedido.idPrecioCondicion > 0) {
849 846 return notaPedido.precioCondicion.nombre;
850 847 } else {
851 848 return 'Ingreso Manual';
852 849 }
853 850 }
854 851  
855   - if(notaPedido.flete === 1) {
  852 + if (notaPedido.flete === 1) {
856 853 var cabeceraBomba = {
857 854 label: 'Bomba:',
858 855 valor: notaPedido.bomba === 1 ? 'Si' : 'No'
859 856 };
860   - if(notaPedido.kilometros) {
  857 + if (notaPedido.kilometros) {
861 858 var cabeceraKilometros = {
862 859 label: 'Kilometros:',
863 860 valor: notaPedido.kilometros
... ... @@ -870,7 +867,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
870 867 notaPedidoBusinessService.calcularArticulos($scope.notaPedido.articulosNotaPedido,
871 868 notaPedido.cotizacion.VENDEDOR);
872 869  
873   - if(notaPedido.idPrecioCondicion > 0) {
  870 + if (notaPedido.idPrecioCondicion > 0) {
874 871 $scope.idLista = notaPedido.precioCondicion.idListaPrecio;
875 872 } else {
876 873 $scope.idLista = -1;