Commit 18f2b112191b385359a980cc5c73de9c08fc0804
Exists in
master
Merge branch 'develop' of git.focasoftware.com:npm/foca-crear-remito
Showing
1 changed file
Show diff stats
src/js/controller.js
... | ... | @@ -97,14 +97,14 @@ angular.module('focaCrearRemito').controller('remitoController', |
97 | 97 | |
98 | 98 | $scope.seleccionarNotaPedido = function () { |
99 | 99 | if ($scope.remitoIsDirty) { |
100 | - focaModalService.confirm("¿Desea continuar? Se perderan los cambios") | |
100 | + focaModalService.confirm('¿Desea continuar? Se perderan los cambios') | |
101 | 101 | .then(function () { |
102 | 102 | $scope.getNotaPedidoModal(); |
103 | 103 | }); |
104 | 104 | } else { |
105 | 105 | $scope.getNotaPedidoModal(); |
106 | 106 | } |
107 | - } | |
107 | + }; | |
108 | 108 | |
109 | 109 | $scope.getNotaPedidoModal = function () { |
110 | 110 | if (varlidarRemitoFacturado()) { |
... | ... | @@ -322,7 +322,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
322 | 322 | idProveedor: $scope.remito.proveedor.COD, |
323 | 323 | idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, |
324 | 324 | idCotizacion: $scope.remito.cotizacion.ID, |
325 | - idListaPrecio: $scope.remito.idPrecioCondicion, | |
325 | + idListaPrecio: $scope.remito.idListaPrecio, | |
326 | 326 | flete: $scope.remito.flete, |
327 | 327 | fob: $scope.remito.fob, |
328 | 328 | bomba: $scope.remito.bomba, |
... | ... | @@ -358,7 +358,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
358 | 358 | }, |
359 | 359 | notaPedido: $scope.notaPedido |
360 | 360 | }; |
361 | - | |
361 | + | |
362 | 362 | crearRemitoService.crearRemito(save).then( |
363 | 363 | function (data) { |
364 | 364 | |
... | ... | @@ -368,7 +368,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
368 | 368 | $scope.remito.id = data.data.id; |
369 | 369 | $scope.remito.numeroRemito = data.data.numero; |
370 | 370 | |
371 | - if ($scope.remito.remitoPuntoDescarga.length) { | |
371 | + if ($scope.remito.remitoPuntoDescarga.length > 0) { | |
372 | 372 | remitoBusinessService.addPuntosDescarga(data.data.id, |
373 | 373 | $scope.remito.remitoPuntoDescarga); |
374 | 374 | } |
... | ... | @@ -603,8 +603,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
603 | 603 | $scope.remito.vendedor = res.data; |
604 | 604 | $scope.$broadcast('addCabecera', { |
605 | 605 | label: 'Vendedor:', |
606 | - valor: $filter('rellenarDigitos')($scope.remito.vendedor.NUM, 3) + ' - ' + | |
607 | - $scope.remito.vendedor.NOM | |
606 | + valor: $filter('rellenarDigitos')($scope.remito.vendedor | |
607 | + .NUM, 3) +' - ' + $scope.remito.vendedor.NOM | |
608 | 608 | }); |
609 | 609 | } |
610 | 610 | var domicilioStamp = |
... | ... | @@ -613,7 +613,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
613 | 613 | $scope.remito.domicilioStamp = domicilioStamp; |
614 | 614 | $scope.$broadcast('addCabecera', { |
615 | 615 | label: 'Cliente:', |
616 | - valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom | |
616 | + valor: $filter('rellenarDigitos')(cliente.cod, 3) + | |
617 | + ' - ' + cliente.nom | |
617 | 618 | }); |
618 | 619 | $scope.$broadcast('addCabecera', { |
619 | 620 | label: 'Domicilio:', |
... | ... | @@ -627,13 +628,16 @@ angular.module('focaCrearRemito').controller('remitoController', |
627 | 628 | crearRemitoService |
628 | 629 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) |
629 | 630 | .then(function (res) { |
630 | - if (res.data.length) $scope.seleccionarPuntosDeDescarga(); | |
631 | + if (res.data.length) { | |
632 | + $scope.seleccionarPuntosDeDescarga(); | |
633 | + } | |
631 | 634 | }); |
632 | 635 | } |
633 | 636 | |
634 | - $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | |
637 | + $filter('filter')($scope.botonera, | |
638 | + { label: 'Cliente' })[0].checked = true; | |
635 | 639 | }) |
636 | - .catch(function (e) { console.log(e); }) | |
640 | + .catch(function (e) { console.log(e); }); | |
637 | 641 | }, function () { |
638 | 642 | $scope.seleccionarCliente(true); |
639 | 643 | return; |
... | ... | @@ -682,7 +686,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
682 | 686 | size: 'lg', |
683 | 687 | resolve: { |
684 | 688 | idListaPrecio: function () { return $scope.remito.cliente.MOD || null; }, |
685 | - idCliente: function () { return $scope.remito.cliente.COD } | |
689 | + idCliente: function () { return $scope.remito.cliente.COD; } | |
686 | 690 | } |
687 | 691 | } |
688 | 692 | ); |
... | ... | @@ -902,9 +906,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
902 | 906 | |
903 | 907 | $scope.agregarATabla = function (key) { |
904 | 908 | if (key === 13) { |
905 | - if ($scope.articuloACargar.cantidad === undefined || | |
906 | - $scope.articuloACargar.cantidad === 0 || | |
907 | - $scope.articuloACargar.cantidad === null) { | |
909 | + if (!$scope.articuloACargar.cantidad || !$scope.articuloACargar.precio) { | |
908 | 910 | focaModalService.alert('El valor debe ser al menos 1'); |
909 | 911 | return; |
910 | 912 | } |
... | ... | @@ -935,7 +937,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
935 | 937 | |
936 | 938 | $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) { |
937 | 939 | if (key === 13) { |
938 | - if (!articulo.cantidad || !articulo.precio) { | |
940 | + if (!articulo.cantidad || !articulo.precio || !tmpCantidad || !tmpPrecio) { | |
939 | 941 | focaModalService.alert('Los valores deben ser al menos 1'); |
940 | 942 | return; |
941 | 943 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { |
... | ... | @@ -1174,16 +1176,17 @@ angular.module('focaCrearRemito').controller('remitoController', |
1174 | 1176 | } |
1175 | 1177 | } |
1176 | 1178 | |
1177 | - function deleteCliente() { | |
1178 | - $scope.remito.domicilioStamp = ''; | |
1179 | - $scope.remito.remitoPuntoDescarga = []; | |
1180 | - $scope.remito.domicilio = { dom: '' }; | |
1181 | - $scope.remito.cliente = {}; | |
1182 | - $scope.$broadcast('removeCabecera', 'Cliente:'); | |
1183 | - $scope.$broadcast('removeCabecera', 'Domicilio:'); | |
1184 | - $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); | |
1185 | - $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = false; | |
1186 | - } | |
1179 | + // TODO: Descomentar cuando se use | |
1180 | + // function deleteCliente() { | |
1181 | + // $scope.remito.domicilioStamp = ''; | |
1182 | + // $scope.remito.remitoPuntoDescarga = []; | |
1183 | + // $scope.remito.domicilio = { dom: '' }; | |
1184 | + // $scope.remito.cliente = {}; | |
1185 | + // $scope.$broadcast('removeCabecera', 'Cliente:'); | |
1186 | + // $scope.$broadcast('removeCabecera', 'Domicilio:'); | |
1187 | + // $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); | |
1188 | + // $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = false; | |
1189 | + // } | |
1187 | 1190 | |
1188 | 1191 | function getCabeceraPuntoDescarga(puntosDescarga) { |
1189 | 1192 | var puntosStamp = ''; |