Commit 3db8d570e28a2cb6e2c5f7d7f62c43e41f2ab02f

Authored by Marcelo Puebla
1 parent 4bde8a415b
Exists in develop

Fix

Arreglo al seleccionar domicilio
Showing 1 changed file with 19 additions and 20 deletions   Show diff stats
src/js/controller.js
... ... @@ -229,14 +229,14 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
229 229 $localStorage.rutas = JSON.stringify(rutaJson);
230 230 }
231 231  
232   - var plazos = $scope.notaPedido.notaPedidoPlazo;
233   - var plazosACrear = [];
234   - plazos.forEach(function (plazo) {
235   - plazosACrear.push({
236   - idNotaPedido: data.data.id,
237   - dias: plazo.dias
238   - });
  232 + var plazos = $scope.notaPedido.notaPedidoPlazo;
  233 + var plazosACrear = [];
  234 + plazos.forEach(function (plazo) {
  235 + plazosACrear.push({
  236 + idNotaPedido: data.data.id,
  237 + dias: plazo.dias
239 238 });
  239 + });
240 240  
241 241 if (plazosACrear.length) {
242 242 crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear);
... ... @@ -539,17 +539,6 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
539 539 .catch(function () {
540 540 });
541 541 }
542   -
543   - // if (angular.equals({}, cliente.vendedor)) {
544   -
545   - // focaModalService
546   - // .alert('El cliente seleccionado no tiene tiene ' +
547   - // 'vendedor asignado.')
548   - // .then($scope.seleccionarCliente);
549   -
550   - // return;
551   - // }
552   -
553 542 $scope.abrirModalDomicilios(cliente);
554 543 }, function () { }
555 544 );
... ... @@ -654,8 +643,18 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl',
654 643 { label: 'Domicilio de Entrega' })[0].checked = true;
655 644  
656 645 }, function () {
657   - $scope.seleccionarCliente(true);
658   - return;
  646 + if (!cliente) {
  647 + $scope.seleccionarCliente(true);
  648 + return;
  649 + }
  650 + $scope.notaPedido.cliente = cliente;
  651 + $scope.$broadcast('addCabecera', {
  652 + label: 'Cliente:',
  653 + valor: $filter('rellenarDigitos')(cliente.COD, 5) +
  654 + ' - ' + cliente.NOM
  655 + });
  656 + $filter('filter')($scope.botonera,
  657 + { label: 'Cliente' })[0].checked = true;
659 658 }
660 659 );
661 660 };