Commit 6123a1fad4749899272fcfe0a0f65effcf879f56

Authored by Nicolás Guarnieri
Exists in master

Merge branch 'master' into 'master'

Master

See merge request !30
src/js/controller.js
... ... @@ -209,10 +209,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
209 209 $scope.notaPedido.cliente = {};
210 210 $scope.notaPedido.proveedor = {};
211 211 $scope.notaPedido.domicilio = {};
212   - $scope.notaPedido.flete = null;
213   - $scope.notaPedido.fob = null;
214   - $scope.notaPedido.bomba = null;
215   - $scope.notaPedido.kilometros = null;
  212 + $scope.notaPedido.flete = undefined;
  213 + $scope.notaPedido.fob = undefined;
  214 + $scope.notaPedido.bomba = undefined;
  215 + $scope.notaPedido.kilometros = undefined;
216 216 $scope.articulosTabla = [];
217 217 },
218 218 function(error) {
... ... @@ -419,8 +419,20 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
419 419 modalInstance.result.then(
420 420 function(puntosDescarga) {
421 421 $scope.notaPedido.puntosDescarga = puntosDescarga;
  422 +
  423 + //AGREGO PUNTOS DE DESCARGA A CABECERA
  424 + var puntosStamp = '';
  425 + puntosDescarga.forEach(function(punto, idx, arr) {
  426 + puntosStamp += punto.descripcion;
  427 + if((idx + 1) !== arr.length) puntosStamp += ', ';
  428 + });
  429 +
  430 + $scope.$broadcast('addCabecera', {
  431 + label: 'Puntos de descarga:',
  432 + valor: puntosStamp
  433 + });
422 434 }, function() {
423   -
  435 + $scope.abrirModalDomicilios($scope.cliente);
424 436 }
425 437 );
426 438 }
... ... @@ -499,6 +511,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
499 511 modalInstance.result.then(
500 512 function(cliente) {
501 513 $scope.abrirModalDomicilios(cliente);
  514 + $scope.cliente = cliente;
502 515 }, function() {}
503 516 );
504 517 }
... ... @@ -512,8 +525,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
512 525 controller: 'focaModalDomicilioController',
513 526 resolve: {
514 527 idCliente: function() { return cliente.cod; },
515   - esNuevo: function() { return cliente.esNuevo; },
516   - articulos: function() { return $scope.articulosTabla; },
  528 + esNuevo: function() { return cliente.esNuevo; }
517 529 },
518 530 size: 'lg',
519 531 }
... ... @@ -541,11 +553,16 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
541 553 label: 'Domicilio:',
542 554 valor: domicilioStamp
543 555 });
544   - crearNotaPedidoService
545   - .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
546   - .then(function(res) {
547   - if(res.data.length) $scope.seleccionarPuntosDeDescarga();
548   - });
  556 + if(domicilio.verPuntos) {
  557 + delete $scope.notaPedido.domicilio.verPuntos;
  558 + $scope.seleccionarPuntosDeDescarga();
  559 + }else {
  560 + crearNotaPedidoService
  561 + .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
  562 + .then(function(res) {
  563 + if(res.data.length) $scope.seleccionarPuntosDeDescarga();
  564 + });
  565 + }
549 566 }, function() {
550 567 $scope.seleccionarCliente();
551 568 return;