Commit 45bc7e520b39ecd2b70266feacacabd25d693da1

Authored by Marcelo Puebla
1 parent 9d4ac61c34
Exists in master

Codigo indentado.

Showing 1 changed file with 110 additions and 112 deletions   Show diff stats
src/js/controller.js
1   -angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
  1 +angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
2 2 [
3 3 '$scope',
4 4 '$uibModal',
... ... @@ -14,11 +14,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
14 14 'APP',
15 15 'focaLoginService',
16 16 '$localStorage',
17   - function(
  17 + function (
18 18 $scope, $uibModal, $location, $filter, $timeout, crearNotaPedidoService,
19 19 focaBotoneraLateralService, focaModalService, notaPedidoBusinessService,
20   - $rootScope, focaSeguimientoService, APP, focaLoginService, $localStorage)
21   - {
  20 + $rootScope, focaSeguimientoService, APP, focaLoginService, $localStorage) {
22 21 config();
23 22 var cotizacionPArgentino = {};
24 23  
... ... @@ -38,9 +37,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
38 37 maxDate: new Date(),
39 38 minDate: new Date(2010, 0, 1)
40 39 };
41   -
  40 +
42 41 //SETEO BOTONERA LATERAL
43   - $timeout(function() {
  42 + $timeout(function () {
44 43 focaBotoneraLateralService.showSalir(false);
45 44 focaBotoneraLateralService.showPausar(true);
46 45 focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido);
... ... @@ -52,10 +51,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
52 51 $scope.idVendedor = focaLoginService.getLoginData().vendedorCobrador;
53 52 }
54 53  
55   - crearNotaPedidoService.getParametros().then(function(res) {
  54 + crearNotaPedidoService.getParametros().then(function (res) {
56 55 var parametros = JSON.parse(res.data[0].jsonText);
57 56 if ($localStorage.notaPedido) {
58   - $timeout(function() { getLSNotaPedido();} );
  57 + $timeout(function () { getLSNotaPedido(); });
59 58 } else {
60 59 for (var property in parametros) {
61 60 $scope.notaPedido[property] = parametros[property];
... ... @@ -76,7 +75,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
76 75 id: 0,
77 76 cliente: {},
78 77 proveedor: {},
79   - domicilio: {dom: ''},
  78 + domicilio: { dom: '' },
80 79 vendedor: {},
81 80 fechaCarga: new Date(),
82 81 cotizacion: {},
... ... @@ -87,16 +86,16 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
87 86 $scope.idLista = undefined;
88 87  
89 88 crearNotaPedidoService.getNumeroNotaPedido().then(
90   - function(res) {
  89 + function (res) {
91 90 $scope.puntoVenta = $filter('rellenarDigitos')(
92 91 res.data.sucursal, 4
93 92 );
94   -
  93 +
95 94 $scope.comprobante = $filter('rellenarDigitos')(
96 95 res.data.numeroNotaPedido, 8
97 96 );
98 97 },
99   - function(err) {
  98 + function (err) {
100 99 focaModalService.alert('La terminal no esta configurada correctamente');
101 100 console.info(err);
102 101 }
... ... @@ -104,7 +103,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
104 103  
105 104 if (APP === 'distribuidor') {
106 105 crearNotaPedidoService.getVendedorById($scope.idVendedor).then(
107   - function(res) {
  106 + function (res) {
108 107 var vendedor = res.data;
109 108 $scope.$broadcast('addCabecera', {
110 109 label: 'Vendedor:',
... ... @@ -121,14 +120,14 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
121 120 $scope.inicial = angular.copy($scope.notaPedido);
122 121 }
123 122  
124   - $scope.$watch('notaPedido', function(newValue) {
  123 + $scope.$watch('notaPedido', function (newValue) {
125 124 focaBotoneraLateralService.setPausarData({
126 125 label: 'notaPedido',
127 126 val: newValue
128 127 });
129 128 }, true);
130 129  
131   - $scope.crearNotaPedido = function() {
  130 + $scope.crearNotaPedido = function () {
132 131 if (!$scope.notaPedido.cliente.COD) {
133 132 focaModalService.alert('Ingrese Cliente');
134 133 return;
... ... @@ -148,8 +147,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
148 147 focaModalService.alert('Ingrese Precios y Condiciones');
149 148 return;
150 149 } else if (
151   - $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null)
152   - {
  150 + $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) {
153 151 focaModalService.alert('Ingrese Flete');
154 152 return;
155 153 } else if (!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto
... ... @@ -185,7 +183,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
185 183 total: $scope.getTotal()
186 184 };
187 185 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
188   - function(data) {
  186 + function (data) {
189 187 // Al guardar los datos de la nota de pedido logueamos la
190 188 // actividad para su seguimiento.
191 189 //TODO: GUARDAR POSISIONAMIENTO AL EDITAR?
... ... @@ -205,7 +203,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
205 203  
206 204 var plazos = $scope.notaPedido.notaPedidoPlazo;
207 205 var plazosACrear = [];
208   - plazos.forEach(function(plazo) {
  206 + plazos.forEach(function (plazo) {
209 207 plazosACrear.push({
210 208 idNotaPedido: data.data.id,
211 209 dias: plazo.dias
... ... @@ -223,7 +221,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
223 221 $scope.saveLoading = false;
224 222  
225 223 config();
226   - }, function(error) {
  224 + }, function (error) {
227 225 focaModalService.alert('Hubo un error al crear la nota de pedido');
228 226 focaBotoneraLateralService.endGuardar();
229 227 $scope.saveLoading = false;
... ... @@ -231,7 +229,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
231 229 });
232 230 };
233 231  
234   - $scope.seleccionarNotaPedido = function() {
  232 + $scope.seleccionarNotaPedido = function () {
235 233 var modalInstance = $uibModal.open(
236 234 {
237 235 ariaLabelledBy: 'Busqueda de Nota de Pedido',
... ... @@ -239,8 +237,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
239 237 controller: 'focaModalNotaPedidoController',
240 238 size: 'lg',
241 239 resolve: {
242   - usadoPor: function() {return 'notaPedido';},
243   - idVendedor: function() {
  240 + usadoPor: function () { return 'notaPedido'; },
  241 + idVendedor: function () {
244 242 if (APP === 'distribuidor')
245 243 return $scope.notaPedido.vendedor.id;
246 244 else
... ... @@ -252,7 +250,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
252 250 modalInstance.result.then(setearNotaPedido);
253 251 };
254 252  
255   - $scope.seleccionarProductos = function() {
  253 + $scope.seleccionarProductos = function () {
256 254  
257 255 if ($scope.idLista === undefined) {
258 256 focaModalService.alert(
... ... @@ -278,7 +276,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
278 276 }
279 277 );
280 278 modalInstance.result.then(
281   - function(producto) {
  279 + function (producto) {
282 280 var newArt =
283 281 {
284 282 id: 0,
... ... @@ -296,7 +294,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
296 294 ivaUnitario: producto.IMPIVA,
297 295 impuestoInternoUnitario: producto.ImpInt,
298 296 impuestoInterno1Unitario: producto.ImpInt2,
299   - impuestoInterno2Unitario: producto.ImpInt3,
  297 + impuestoInterno2Unitario: producto.ImpInt3,
300 298 precioLista: producto.precio,
301 299 combustible: 1,
302 300 facturado: 0,
... ... @@ -309,13 +307,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
309 307  
310 308 $scope.articuloACargar = newArt;
311 309 $scope.cargando = false;
312   - }, function() {
  310 + }, function () {
313 311 // funcion ejecutada cuando se cancela el modal
314 312 }
315 313 );
316 314 };
317 315  
318   - $scope.seleccionarPuntosDeDescarga = function() {
  316 + $scope.seleccionarPuntosDeDescarga = function () {
319 317 if (!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) {
320 318 focaModalService.alert('Primero seleccione un cliente y un domicilio');
321 319 return;
... ... @@ -338,9 +336,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
338 336 }
339 337 );
340 338 modalInstance.result.then(
341   - function(puntoDescarga) {
  339 + function (puntoDescarga) {
342 340  
343   - puntoDescarga.forEach(function(punto) {
  341 + puntoDescarga.forEach(function (punto) {
344 342 $scope.notaPedido.notaPedidoPuntoDescarga.push(
345 343 {
346 344 puntoDescarga: punto
... ... @@ -352,15 +350,15 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
352 350 label: 'Puntos de descarga:',
353 351 valor: getCabeceraPuntoDescarga(puntoDescarga)
354 352 });
355   - }, function() {
  353 + }, function () {
356 354 $scope.abrirModalDomicilios($scope.cliente);
357 355 }
358 356 );
359 357 }
360 358 };
361 359  
362   - $scope.seleccionarProveedor = function() {
363   - $scope.abrirModalProveedores(function() {
  360 + $scope.seleccionarProveedor = function () {
  361 + $scope.abrirModalProveedores(function () {
364 362 if (validarNotaRemitada()) {
365 363 var modalInstance = $uibModal.open(
366 364 {
... ... @@ -370,12 +368,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
370 368 size: 'lg',
371 369 resolve: {
372 370 parametrosFlete:
373   - function() {
  371 + function () {
374 372 return {
375 373 flete: $scope.notaPedido.fob ? 'FOB' :
376   - ( $scope.notaPedido.flete ? '1' :
377   - ($scope.notaPedido.flete === undefined ?
378   - null : '0')),
  374 + ($scope.notaPedido.flete ? '1' :
  375 + ($scope.notaPedido.flete === undefined ?
  376 + null : '0')),
379 377 bomba: $scope.notaPedido.bomba ? '1' :
380 378 ($scope.notaPedido.bomba === undefined ?
381 379 null : '0'),
... ... @@ -386,7 +384,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
386 384 }
387 385 );
388 386 modalInstance.result.then(
389   - function(datos) {
  387 + function (datos) {
390 388 $scope.notaPedido.flete = datos.flete;
391 389 $scope.notaPedido.fob = datos.FOB;
392 390 $scope.notaPedido.bomba = datos.bomba;
... ... @@ -412,8 +410,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
412 410 }
413 411  
414 412 $filter('filter')($scope.botonera,
415   - { label: 'Proveedor'})[0].checked = true;
416   - }, function() {
  413 + { label: 'Proveedor' })[0].checked = true;
  414 + }, function () {
417 415 $scope.seleccionarTransportista();
418 416 }
419 417 );
... ... @@ -421,7 +419,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
421 419 });
422 420 };
423 421  
424   - $scope.seleccionarVendedor = function(callback, ocultarVendedor) {
  422 + $scope.seleccionarVendedor = function (callback, ocultarVendedor) {
425 423 if (APP === 'distribuidor' || ocultarVendedor) {
426 424 callback();
427 425 return;
... ... @@ -448,7 +446,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
448 446 size: 'md'
449 447 };
450 448 focaModalService.modal(parametrosModal).then(
451   - function(vendedor) {
  449 + function (vendedor) {
452 450 $scope.$broadcast('addCabecera', {
453 451 label: 'Vendedor:',
454 452 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' +
... ... @@ -457,13 +455,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
457 455 $scope.notaPedido.vendedor = vendedor;
458 456 deleteCliente();
459 457 callback();
460   - }, function() {}
  458 + }, function () { }
461 459 );
462 460 }
463 461 };
464 462  
465   - $scope.seleccionarCliente = function(ocultarVendedor) {
466   - $scope.seleccionarVendedor(function() {
  463 + $scope.seleccionarCliente = function (ocultarVendedor) {
  464 + $scope.seleccionarVendedor(function () {
467 465 if (validarNotaRemitada()) {
468 466 var modalInstance = $uibModal.open(
469 467 {
... ... @@ -471,17 +469,17 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
471 469 templateUrl: 'foca-busqueda-cliente-modal.html',
472 470 controller: 'focaBusquedaClienteModalController',
473 471 resolve: {
474   - vendedor: function() { return $scope.notaPedido.vendedor; },
475   - cobrador: function() { return null; }
  472 + vendedor: function () { return null; },
  473 + cobrador: function () { return null; }
476 474 },
477 475 size: 'lg'
478 476 }
479 477 );
480 478 modalInstance.result.then(
481   - function(cliente) {
  479 + function (cliente) {
482 480 $scope.abrirModalDomicilios(cliente);
483 481 $scope.cliente = cliente;
484   - }, function() {
  482 + }, function () {
485 483 if (APP !== 'distribuidor') $scope.seleccionarCliente();
486 484 }
487 485 );
... ... @@ -489,7 +487,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
489 487 }, ocultarVendedor);
490 488 };
491 489  
492   - $scope.abrirModalProveedores = function(callback) {
  490 + $scope.abrirModalProveedores = function (callback) {
493 491 if (validarNotaRemitada()) {
494 492 var parametrosModal = {
495 493 titulo: 'Búsqueda de Proveedor',
... ... @@ -513,10 +511,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
513 511 }
514 512 ],
515 513 tipo: 'POST',
516   - json: {razonCuitCod: ''}
  514 + json: { razonCuitCod: '' }
517 515 };
518 516 focaModalService.modal(parametrosModal).then(
519   - function(proveedor) {
  517 + function (proveedor) {
520 518 $scope.notaPedido.proveedor = proveedor;
521 519 $scope.$broadcast('addCabecera', {
522 520 label: 'Proveedor:',
... ... @@ -524,28 +522,28 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
524 522 proveedor.NOM
525 523 });
526 524 callback();
527   - }, function() {
  525 + }, function () {
528 526  
529 527 }
530 528 );
531 529 }
532 530 };
533 531  
534   - $scope.abrirModalDomicilios = function(cliente) {
  532 + $scope.abrirModalDomicilios = function (cliente) {
535 533 var modalInstanceDomicilio = $uibModal.open(
536 534 {
537 535 ariaLabelledBy: 'Busqueda de Domicilios',
538 536 templateUrl: 'modal-domicilio.html',
539 537 controller: 'focaModalDomicilioController',
540   - resolve: {
541   - idCliente: function() { return cliente.cod; },
542   - esNuevo: function() { return cliente.esNuevo; }
  538 + resolve: {
  539 + idCliente: function () { return cliente.cod; },
  540 + esNuevo: function () { return cliente.esNuevo; }
543 541 },
544 542 size: 'lg',
545 543 }
546 544 );
547 545 modalInstanceDomicilio.result.then(
548   - function(domicilio) {
  546 + function (domicilio) {
549 547 $scope.notaPedido.domicilio = domicilio;
550 548 $scope.notaPedido.cliente = {
551 549 COD: cliente.cod,
... ... @@ -553,8 +551,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
553 551 NOM: cliente.nom,
554 552 MOD: cliente.mod
555 553 };
556   - var domicilioStamp =
557   - domicilio.Calle + ' ' + domicilio.Numero + ', ' +
  554 + var domicilioStamp =
  555 + domicilio.Calle + ' ' + domicilio.Numero + ', ' +
558 556 domicilio.Localidad + ', ' + domicilio.Provincia;
559 557 $scope.notaPedido.domicilioStamp = domicilioStamp;
560 558  
... ... @@ -574,16 +572,16 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
574 572 }
575 573  
576 574 // Seteo checked en botonera
577   - $filter('filter')($scope.botonera, { label: 'Cliente'})[0].checked = true;
  575 + $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true;
578 576  
579   - }, function() {
  577 + }, function () {
580 578 $scope.seleccionarCliente(true);
581 579 return;
582 580 }
583 581 );
584 582 };
585 583  
586   - $scope.getTotal = function() {
  584 + $scope.getTotal = function () {
587 585 var total = 0;
588 586 if ($scope.notaPedido.articulosNotaPedido) {
589 587 var arrayTempArticulos = $scope.notaPedido.articulosNotaPedido;
... ... @@ -594,13 +592,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
594 592 return parseFloat(total.toFixed(2));
595 593 };
596 594  
597   - $scope.getSubTotal = function() {
  595 + $scope.getSubTotal = function () {
598 596 if ($scope.articuloACargar) {
599 597 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
600 598 }
601 599 };
602 600  
603   - $scope.seleccionarPreciosYCondiciones = function() {
  601 + $scope.seleccionarPreciosYCondiciones = function () {
604 602  
605 603 if (!validarNotaRemitada()) {
606 604 return;
... ... @@ -611,12 +609,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
611 609 return;
612 610 }
613 611 if ($scope.notaPedido.articulosNotaPedido.length !== 0) {
614   - focaModalService.confirm('Se perderan los productos ingresados')
615   - .then(function(data) {
616   - if (data) {
617   - abrirModal();
618   - }
619   - });
  612 + focaModalService.confirm('Se perderan los productos ingresados')
  613 + .then(function (data) {
  614 + if (data) {
  615 + abrirModal();
  616 + }
  617 + });
620 618 } else if (validarNotaRemitada()) {
621 619 abrirModal();
622 620 }
... ... @@ -628,7 +626,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
628 626 controller: 'focaModalPrecioCondicionController',
629 627 size: 'lg',
630 628 resolve: {
631   - idListaPrecio: function() {
  629 + idListaPrecio: function () {
632 630 return $scope.notaPedido.cliente.MOD || null;
633 631 }
634 632 }
... ... @@ -636,7 +634,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
636 634 );
637 635  
638 636 modalInstance.result.then(
639   - function(precioCondicion) {
  637 + function (precioCondicion) {
640 638 var cabecera = '';
641 639 var plazosConcat = '';
642 640 if (!Array.isArray(precioCondicion)) {
... ... @@ -652,7 +650,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
652 650 } else { //Cuando se ingresan los plazos manualmente
653 651 $scope.notaPedido.idPrecioCondicion = 0;
654 652 //-1, el modal productos busca todos los productos
655   - $scope.idLista = -1;
  653 + $scope.idLista = -1;
656 654 $scope.notaPedido.notaPedidoPlazo = precioCondicion;
657 655 for (var j = 0; j < precioCondicion.length; j++) {
658 656 plazosConcat += precioCondicion[j].dias + ' ';
... ... @@ -666,15 +664,15 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
666 664 });
667 665  
668 666 $filter('filter')($scope.botonera,
669   - { label: 'Precios y Condiciones'})[0].checked = true;
670   - }, function() {
  667 + { label: 'Precios y Condiciones' })[0].checked = true;
  668 + }, function () {
671 669  
672 670 }
673 671 );
674 672 }
675 673 };
676 674  
677   - $scope.seleccionarMoneda = function() {
  675 + $scope.seleccionarMoneda = function () {
678 676 if (validarNotaRemitada()) {
679 677 var parametrosModal = {
680 678 titulo: 'Búsqueda de monedas',
... ... @@ -692,7 +690,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
692 690 size: 'md'
693 691 };
694 692 focaModalService.modal(parametrosModal).then(
695   - function(moneda) {
  693 + function (moneda) {
696 694  
697 695 if (moneda.ID !== 1) {
698 696 $scope.abrirModalCotizacion(moneda);
... ... @@ -713,7 +711,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
713 711 }
714 712 };
715 713  
716   - $scope.seleccionarObservaciones = function() {
  714 + $scope.seleccionarObservaciones = function () {
717 715 var observacion = {
718 716 titulo: 'Ingrese Observaciones',
719 717 value: $scope.notaPedido.observaciones,
... ... @@ -723,12 +721,12 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
723 721  
724 722 focaModalService
725 723 .prompt(observacion)
726   - .then(function(observaciones) {
  724 + .then(function (observaciones) {
727 725 $scope.notaPedido.observaciones = observaciones;
728 726 });
729 727 };
730 728  
731   - $scope.abrirModalCotizacion = function(moneda) {
  729 + $scope.abrirModalCotizacion = function (moneda) {
732 730 var modalInstance = $uibModal.open(
733 731 {
734 732 ariaLabelledBy: 'Busqueda de Cotización',
... ... @@ -736,29 +734,29 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
736 734 controller: 'focaModalCotizacionController',
737 735 size: 'lg',
738 736 resolve: {
739   - idMoneda: function() {
  737 + idMoneda: function () {
740 738 return moneda.ID;
741 739 }
742 740 }
743 741 }
744 742 );
745 743 modalInstance.result.then(
746   - function(cotizacion) {
  744 + function (cotizacion) {
747 745  
748 746 cotizacion.moneda = moneda;
749 747 actualizarCabeceraMoneda(cotizacion);
750 748  
751 749 $scope.notaPedido.cotizacion = cotizacion;
752   - $filter('filter')($scope.botonera, { label: 'Moneda'})[0].checked = true;
753   - }, function() {
  750 + $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true;
  751 + }, function () {
754 752  
755 753 }
756 754 );
757 755 };
758 756  
759   - function actualizarCabeceraMoneda (cotizacion) {
  757 + function actualizarCabeceraMoneda(cotizacion) {
760 758  
761   - $scope.notaPedido.articulosNotaPedido.forEach(function(art) {
  759 + $scope.notaPedido.articulosNotaPedido.forEach(function (art) {
762 760 art.precio = (art.precio * $scope.notaPedido.cotizacion.VENDEDOR).toFixed(4);
763 761 art.precio = (art.precio / cotizacion.VENDEDOR).toFixed(4);
764 762 });
... ... @@ -783,13 +781,13 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
783 781 }
784 782 }
785 783  
786   - $scope.agregarATabla = function(key) {
  784 + $scope.agregarATabla = function (key) {
787 785 if (key === 13) {
788 786 if ($scope.articuloACargar.cantidad === undefined ||
789 787 $scope.articuloACargar.cantidad === 0 ||
790   - $scope.articuloACargar.cantidad === null ) {
791   - focaModalService.alert('El valor debe ser al menos 1');
792   - return;
  788 + $scope.articuloACargar.cantidad === null) {
  789 + focaModalService.alert('El valor debe ser al menos 1');
  790 + return;
793 791 }
794 792 delete $scope.articuloACargar.sectorCodigo;
795 793 $scope.notaPedido.articulosNotaPedido.push($scope.articuloACargar);
... ... @@ -797,13 +795,13 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
797 795 }
798 796 };
799 797  
800   - $scope.quitarArticulo = function(key) {
  798 + $scope.quitarArticulo = function (key) {
801 799 if (validarNotaRemitada()) {
802 800 $scope.notaPedido.articulosNotaPedido.splice(key, 1);
803 801 }
804 802 };
805 803  
806   - $scope.editarArticulo = function(key, articulo, tmpCantidad, tmpPrecio) {
  804 + $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) {
807 805 if (key === 13) {
808 806 if (!articulo.cantidad || !articulo.precio) {
809 807 focaModalService.alert('Los valores deben ser al menos 1');
... ... @@ -819,13 +817,13 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
819 817 }
820 818 };
821 819  
822   - $scope.cancelarEditar = function(articulo) {
  820 + $scope.cancelarEditar = function (articulo) {
823 821 $scope.tmpCantidad = articulo.cantidad;
824 822 $scope.tmpPrecio = articulo.precio;
825 823 articulo.editCantidad = articulo.editPrecio = false;
826 824 };
827 825  
828   - $scope.cambioEdit = function(articulo, propiedad) {
  826 + $scope.cambioEdit = function (articulo, propiedad) {
829 827 if (propiedad === 'cantidad') {
830 828 articulo.editCantidad = true;
831 829 } else if (propiedad === 'precio') {
... ... @@ -833,12 +831,12 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
833 831 }
834 832 };
835 833  
836   - $scope.resetFilter = function() {
  834 + $scope.resetFilter = function () {
837 835 $scope.articuloACargar = {};
838 836 $scope.cargando = true;
839 837 };
840 838 //Recibe aviso si el teclado está en uso
841   - $rootScope.$on('usarTeclado', function(event, data) {
  839 + $rootScope.$on('usarTeclado', function (event, data) {
842 840 if (data) {
843 841 $scope.mostrarTeclado = true;
844 842 return;
... ... @@ -846,7 +844,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
846 844 $scope.mostrarTeclado = false;
847 845 });
848 846  
849   - $scope.selectFocus = function($event) {
  847 + $scope.selectFocus = function ($event) {
850 848 // Si el teclado esta en uso no selecciona el valor
851 849 if ($scope.mostrarTeclado) {
852 850 return;
... ... @@ -854,23 +852,23 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
854 852 $event.target.select();
855 853 };
856 854  
857   - $scope.salir = function() {
  855 + $scope.salir = function () {
858 856 $location.path('/');
859 857 };
860 858  
861   - $scope.parsearATexto = function(articulo) {
  859 + $scope.parsearATexto = function (articulo) {
862 860 articulo.cantidad = parseFloat(articulo.cantidad);
863 861 articulo.precio = parseFloat(articulo.precio);
864 862 };
865 863  
866 864 // TODO: quitar watch usar función de articulos pedido cuando se haga
867   - $scope.$watch('notaPedido.articulosNotaPedido', function() {
  865 + $scope.$watch('notaPedido.articulosNotaPedido', function () {
868 866 if ($scope.notaPedido.articulosNotaPedido.length) {
869 867 $filter('filter')($scope.botonera,
870   - { label: 'Productos'})[0].checked = true;
  868 + { label: 'Productos' })[0].checked = true;
871 869 } else {
872 870 $filter('filter')($scope.botonera,
873   - { label: 'Productos'})[0].checked = false;
  871 + { label: 'Productos' })[0].checked = false;
874 872 }
875 873 }, true);
876 874  
... ... @@ -906,7 +904,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
906 904 }
907 905  
908 906 if (notaPedido.cotizacion.moneda) {
909   - $filter('filter')($scope.botonera, { label: 'Moneda'})[0].checked = true;
  907 + $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true;
910 908 }
911 909  
912 910 if (notaPedido.vendedor.NUM) {
... ... @@ -927,7 +925,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
927 925 valor: notaPedido.domicilioStamp
928 926 });
929 927  
930   - $filter('filter')($scope.botonera, { label: 'Cliente'})[0].checked = true;
  928 + $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true;
931 929 }
932 930  
933 931 if (notaPedido.proveedor.COD) {
... ... @@ -937,7 +935,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
937 935 ' - ' + notaPedido.proveedor.NOM
938 936 });
939 937  
940   - $filter('filter')($scope.botonera, { label: 'Proveedor'})[0].checked = true;
  938 + $filter('filter')($scope.botonera, { label: 'Proveedor' })[0].checked = true;
941 939 }
942 940  
943 941 if (notaPedido.notaPedidoPlazo.length) {
... ... @@ -949,7 +947,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
949 947 });
950 948  
951 949 $filter('filter')($scope.botonera,
952   - { label: 'Precios y condiciones'})[0].checked = true;
  950 + { label: 'Precios y condiciones' })[0].checked = true;
953 951 }
954 952  
955 953 if (notaPedido.flete !== undefined) {
... ... @@ -999,7 +997,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
999 997  
1000 998 if (notaPedido.notaPedidoPuntoDescarga.length) {
1001 999 var puntos = [];
1002   - notaPedido.notaPedidoPuntoDescarga.forEach(function(notaPedidoPuntoDescarga) {
  1000 + notaPedido.notaPedidoPuntoDescarga.forEach(function (notaPedidoPuntoDescarga) {
1003 1001 puntos.push(notaPedidoPuntoDescarga.puntoDescarga);
1004 1002 });
1005 1003 cabeceras.push({
... ... @@ -1020,7 +1018,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
1020 1018  
1021 1019 function getCabeceraPuntoDescarga(puntoDescarga) {
1022 1020 var puntosStamp = '';
1023   - puntoDescarga.forEach(function(punto, idx, arr) {
  1021 + puntoDescarga.forEach(function (punto, idx, arr) {
1024 1022 puntosStamp += punto.descripcion;
1025 1023 if ((idx + 1) !== arr.length) puntosStamp += ', ';
1026 1024 });
... ... @@ -1055,7 +1053,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
1055 1053 if (confirmacion) {
1056 1054 focaModalService.confirm(
1057 1055 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
1058   - ).then(function(data) {
  1056 + ).then(function (data) {
1059 1057 if (data) {
1060 1058 $location.path('/');
1061 1059 }
... ... @@ -1076,12 +1074,12 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
1076 1074 function deleteCliente() {
1077 1075 $scope.notaPedido.domicilioStamp = '';
1078 1076 $scope.notaPedido.notaPedidoPuntoDescarga = [];
1079   - $scope.notaPedido.domicilio = {dom: ''};
  1077 + $scope.notaPedido.domicilio = { dom: '' };
1080 1078 $scope.notaPedido.cliente = {};
1081 1079 $scope.$broadcast('removeCabecera', 'Cliente:');
1082 1080 $scope.$broadcast('removeCabecera', 'Domicilio:');
1083 1081 $scope.$broadcast('removeCabecera', 'Puntos de descarga:');
1084   - $filter('filter')($scope.botonera, { label: 'Cliente'})[0].checked = false;
  1082 + $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = false;
1085 1083 }
1086 1084 }
1087 1085 ]);