Commit 6a90469db6e88f6381ea4930e3e791e0a4457a64

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'develop'

Master

See merge request !72
src/js/controller.js
... ... @@ -579,7 +579,16 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
579 579 focaModalService.alert('Primero seleccione un cliente');
580 580 return;
581 581 }
582   - if (validarNotaRemitada()) {
  582 + if ($scope.notaPedido.articulosNotaPedido.length !== 0) {
  583 + focaModalService.confirm('Se perderan los productos ingresados').then(function(data) {
  584 + if (data) {
  585 + abrirModal();
  586 + }
  587 + });
  588 + } else if (validarNotaRemitada()) {
  589 + abrirModal();
  590 + }
  591 + function abrirModal() {
583 592 var modalInstance = $uibModal.open(
584 593 {
585 594 ariaLabelledBy: 'Busqueda de Precio Condición',
... ... @@ -593,6 +602,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
593 602 }
594 603 }
595 604 );
  605 +
596 606 modalInstance.result.then(
597 607 function(precioCondicion) {
598 608 var cabecera = '';
... ... @@ -602,23 +612,23 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
602 612 $scope.notaPedido.precioCondicion = precioCondicion;
603 613 $scope.notaPedido.idPrecioCondicion = precioCondicion.id;
604 614 $scope.idLista = precioCondicion.idListaPrecio;
605   - for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
606   - plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
607   - }
608   - cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
609   - ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim();
  615 + for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
  616 + plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
  617 + }
  618 + cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
  619 + ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim();
610 620 } else { //Cuando se ingresan los plazos manualmente
611 621 $scope.notaPedido.idPrecioCondicion = 0;
612   - //-1, el modal productos busca todos los productos
613   - $scope.idLista = -1;
  622 + //-1, el modal productos busca todos los productos
  623 + $scope.idLista = -1;
614 624 $scope.notaPedido.notaPedidoPlazo = precioCondicion;
615   - for (var j = 0; j < precioCondicion.length; j++) {
616   - plazosConcat += precioCondicion[j].dias + ' ';
617   - }
  625 + for (var j = 0; j < precioCondicion.length; j++) {
  626 + plazosConcat += precioCondicion[j].dias + ' ';
  627 + }
618 628 cabecera = 'Ingreso manual ' + plazosConcat.trim();
619 629 }
620 630 $scope.notaPedido.articulosNotaPedido = [];
621   - $scope.$broadcast('addCabecera', {
  631 + $scope.$broadcast('addCabecera', {
622 632 label: 'Precios y condiciones:',
623 633 valor: cabecera
624 634 });
... ... @@ -901,8 +911,8 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
901 911 notaPedido.numeroNotaPedido, 8
902 912 );
903 913  
904   - if (notaPedido.notaPedidoPuntoDescarga) {
905   - var puntosDescarga = notaPedido.notaPedidoPuntoDescarga
  914 + if (notaPedido.notaPedidoPuntoDescarga) {
  915 + var puntosDescarga = notaPedido.notaPedidoPuntoDescarga;
906 916 cabeceras.push({
907 917 label: 'Puntos de descarga: ',
908 918 valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntosDescarga))