Commit 838d23c45dd81745fdf47b87c7eed41eec1ea296

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

Merge branch 'master' into 'develop'

Master

See merge request !55
... ... @@ -28,10 +28,7 @@
28 28 "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git",
29 29 "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git",
30 30 "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git",
31   - "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git",
32 31 "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git",
33   - "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git",
34   - "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git",
35 32 "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git"
36 33 },
37 34 "devDependencies": {
... ... @@ -47,10 +44,7 @@
47 44 "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git",
48 45 "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git",
49 46 "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git",
50   - "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git",
51 47 "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git",
52   - "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git",
53   - "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git",
54 48 "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git",
55 49 "font-awesome": "^4.7.0",
56 50 "gulp": "^3.9.1",
src/js/controller.js
... ... @@ -232,7 +232,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
232 232 resolve: {
233 233 usadoPor: function() {return 'notaPedido';},
234 234 idVendedor: function() {
235   - if(APP === 'distribuidor')
  235 + if (APP === 'distribuidor')
236 236 return $scope.notaPedido.vendedor.id;
237 237 else
238 238 return null;
... ... @@ -299,10 +299,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
299 299 };
300 300  
301 301 $scope.seleccionarPuntosDeDescarga = function() {
302   - if(!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) {
  302 + if (!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) {
303 303 focaModalService.alert('Primero seleccione un cliente y un domicilio');
304 304 return;
305   - }else {
  305 + } else {
306 306 var modalInstance = $uibModal.open(
307 307 {
308 308 ariaLabelledBy: 'Búsqueda de Puntos de descarga',
... ... @@ -327,7 +327,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
327 327 var puntosStamp = '';
328 328 puntosDescarga.forEach(function(punto, idx, arr) {
329 329 puntosStamp += punto.descripcion;
330   - if((idx + 1) !== arr.length) puntosStamp += ', ';
  330 + if ((idx + 1) !== arr.length) puntosStamp += ', ';
331 331 });
332 332  
333 333 $scope.$broadcast('addCabecera', {
... ... @@ -406,7 +406,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
406 406 return;
407 407 }
408 408  
409   - if(validarNotaRemitada()) {
  409 + if (validarNotaRemitada()) {
410 410 var parametrosModal = {
411 411 titulo: 'Búsqueda vendedores',
412 412 query: '/vendedor',
... ... @@ -469,7 +469,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
469 469 };
470 470  
471 471 $scope.seleccionarProveedor = function(callback) {
472   - if(validarNotaRemitada()) {
  472 + if (validarNotaRemitada()) {
473 473 var parametrosModal = {
474 474 titulo: 'Búsqueda de Proveedor',
475 475 query: '/proveedor',
... ... @@ -553,7 +553,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
553 553 crearNotaPedidoService
554 554 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
555 555 .then(function(res) {
556   - if(res.data.length) $scope.seleccionarPuntosDeDescarga();
  556 + if (res.data.length) $scope.seleccionarPuntosDeDescarga();
557 557 });
558 558 }
559 559 }, function() {
... ... @@ -576,13 +576,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
576 576 };
577 577  
578 578 $scope.getSubTotal = function() {
579   - if($scope.articuloACargar) {
  579 + if ($scope.articuloACargar) {
580 580 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
581 581 }
582 582 };
583 583  
584 584 $scope.seleccionarPreciosYCondiciones = function() {
585   - if(validarNotaRemitada()) {
  585 + if (validarNotaRemitada()) {
586 586 var modalInstance = $uibModal.open(
587 587 {
588 588 ariaLabelledBy: 'Busqueda de Precio Condición',
... ... @@ -595,12 +595,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
595 595 function(precioCondicion) {
596 596 var cabecera = '';
597 597 var plazosConcat = '';
598   - if(!Array.isArray(precioCondicion)) {
  598 + if (!Array.isArray(precioCondicion)) {
599 599 $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago;
600 600 $scope.notaPedido.precioCondicion = precioCondicion;
601 601 $scope.notaPedido.idPrecioCondicion = precioCondicion.id;
602 602 $scope.idLista = precioCondicion.idListaPrecio;
603   - for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
  603 + for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
604 604 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
605 605 }
606 606 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
... ... @@ -610,7 +610,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
610 610 //-1, el modal productos busca todos los productos
611 611 $scope.idLista = -1;
612 612 $scope.notaPedido.notaPedidoPlazo = precioCondicion;
613   - for(var j = 0; j < precioCondicion.length; j++) {
  613 + for (var j = 0; j < precioCondicion.length; j++) {
614 614 plazosConcat += precioCondicion[j].dias + ' ';
615 615 }
616 616 cabecera = 'Ingreso manual ' + plazosConcat.trim();
... ... @@ -628,7 +628,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
628 628 };
629 629  
630 630 $scope.seleccionarMoneda = function() {
631   - if(validarNotaRemitada()) {
  631 + if (validarNotaRemitada()) {
632 632 var parametrosModal = {
633 633 titulo: 'Búsqueda de monedas',
634 634 query: '/moneda',
... ... @@ -655,13 +655,20 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
655 655 };
656 656  
657 657 $scope.seleccionarObservaciones = function() {
  658 + var observacion = {
  659 + titulo: 'Ingrese Observaciones',
  660 + value: $scope.notaPedido.observaciones,
  661 + maxlength: 155,
  662 + textarea: true
  663 + };
  664 +
658 665 focaModalService
659   - .prompt({
660   - titulo: 'Ingrese observaciones',
661   - value: $scope.notaPedido.observaciones,
662   - textarea: true
663   - })
  666 + .prompt(observacion)
664 667 .then(function(observaciones) {
  668 + $scope.$broadcast('addCabecera', {
  669 + label: 'Observaciones:',
  670 + valor: observaciones
  671 + });
665 672 $scope.notaPedido.observaciones = observaciones;
666 673 });
667 674 };
... ... @@ -683,7 +690,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
683 690 modalInstance.result.then(
684 691 function(cotizacion) {
685 692 var articulosTablaTemp = $scope.notaPedido.articulosNotaPedido || [];
686   - for(var i = 0; i < articulosTablaTemp.length; i++) {
  693 + for (var i = 0; i < articulosTablaTemp.length; i++) {
687 694 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
688 695 $scope.notaPedido.cotizacion.VENDEDOR;
689 696 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
... ... @@ -692,7 +699,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
692 699 $scope.notaPedido.articulosNotaPedido = articulosTablaTemp;
693 700 $scope.notaPedido.cotizacion = cotizacion;
694 701 $scope.notaPedido.cotizacion.moneda = moneda;
695   - if(moneda.DETALLE === 'PESOS ARGENTINOS') {
  702 + if (moneda.DETALLE === 'PESOS ARGENTINOS') {
696 703 $scope.$broadcast('removeCabecera', 'Moneda:');
697 704 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
698 705 $scope.$broadcast('removeCabecera', 'Cotizacion:');
... ... @@ -717,8 +724,8 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
717 724 };
718 725  
719 726 $scope.agregarATabla = function(key) {
720   - if(key === 13) {
721   - if($scope.articuloACargar.cantidad === undefined ||
  727 + if (key === 13) {
  728 + if ($scope.articuloACargar.cantidad === undefined ||
722 729 $scope.articuloACargar.cantidad === 0 ||
723 730 $scope.articuloACargar.cantidad === null ) {
724 731 focaModalService.alert('El valor debe ser al menos 1');
... ... @@ -735,8 +742,8 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
735 742 };
736 743  
737 744 $scope.editarArticulo = function(key, articulo) {
738   - if(key === 13) {
739   - if(articulo.cantidad === null || articulo.cantidad === 0 ||
  745 + if (key === 13) {
  746 + if (articulo.cantidad === null || articulo.cantidad === 0 ||
740 747 articulo.cantidad === undefined) {
741 748 focaModalService.alert('El valor debe ser al menos 1');
742 749 return;
... ... @@ -747,9 +754,9 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
747 754 };
748 755  
749 756 $scope.cambioEdit = function(articulo, propiedad) {
750   - if(propiedad === 'cantidad') {
  757 + if (propiedad === 'cantidad') {
751 758 articulo.editCantidad = true;
752   - } else if(propiedad === 'precio') {
  759 + } else if (propiedad === 'precio') {
753 760 articulo.editPrecio = true;
754 761 }
755 762 };
... ... @@ -760,7 +767,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
760 767 };
761 768 //Recibe aviso si el teclado está en uso
762 769 $rootScope.$on('usarTeclado', function(event, data) {
763   - if(data) {
  770 + if (data) {
764 771 $scope.mostrarTeclado = true;
765 772 return;
766 773 }
... ... @@ -769,7 +776,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
769 776  
770 777 $scope.selectFocus = function($event) {
771 778 // Si el teclado esta en uso no selecciona el valor
772   - if($scope.mostrarTeclado) {
  779 + if ($scope.mostrarTeclado) {
773 780 return;
774 781 }
775 782 $event.target.select();
... ... @@ -808,6 +815,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
808 815 '2')
809 816 });
810 817 }
  818 +
811 819 if (notaPedido.cliente.COD) {
812 820 cabeceras.push({
813 821 label: 'Cliente:',
... ... @@ -818,6 +826,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
818 826 valor: notaPedido.domicilioStamp
819 827 });
820 828 }
  829 +
821 830 if (notaPedido.vendedor.NUM) {
822 831 cabeceras.push({
823 832 label: 'Vendedor:',
... ... @@ -825,6 +834,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
825 834 ' - ' + notaPedido.vendedor.NOM
826 835 });
827 836 }
  837 +
828 838 if (notaPedido.proveedor.COD) {
829 839 cabeceras.push({
830 840 label: 'Proveedor:',
... ... @@ -832,6 +842,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
832 842 ' - ' + notaPedido.proveedor.NOM
833 843 });
834 844 }
  845 +
835 846 if (notaPedido.notaPedidoPlazo.length) {
836 847 cabeceras.push({
837 848 label: 'Precios y condiciones:',
... ... @@ -840,6 +851,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
840 851 .plazoToString(notaPedido.notaPedidoPlazo)
841 852 });
842 853 }
  854 +
843 855 if (notaPedido.flete !== undefined) {
844 856 cabeceras.push({
845 857 label: 'Flete:',
... ... @@ -848,7 +860,6 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
848 860 });
849 861 }
850 862  
851   -
852 863 function valorPrecioCondicion() {
853 864 if (notaPedido.idPrecioCondicion > 0) {
854 865 return notaPedido.precioCondicion.nombre;
... ... @@ -895,7 +906,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
895 906 }
896 907  
897 908 function addArrayCabecera(array) {
898   - for(var i = 0; i < array.length; i++) {
  909 + for (var i = 0; i < array.length; i++) {
899 910 $scope.$broadcast('addCabecera', {
900 911 label: array[i].label,
901 912 valor: array[i].valor
... ... @@ -904,9 +915,9 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
904 915 }
905 916  
906 917 function validarNotaRemitada() {
907   - if(!$scope.notaPedido.idRemito) {
  918 + if (!$scope.notaPedido.idRemito) {
908 919 return true;
909   - }else{
  920 + } else {
910 921 focaModalService.alert('No se puede editar una nota de pedido remitada');
911 922 return false;
912 923 }