Commit 6168be67868a04d3652854015475f583199625c4
1 parent
d2fa34eb33
Exists in
master
and in
1 other branch
puntos de descarga
Showing
2 changed files
with
17 additions
and
16 deletions
Show diff stats
src/js/businessService.js
src/js/controller.js
| ... | ... | @@ -280,7 +280,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 280 | 280 | } else if (!$scope.remito.cliente.COD) { |
| 281 | 281 | focaModalService.alert('Ingrese Cliente'); |
| 282 | 282 | return; |
| 283 | - } else if (!$scope.remito.proveedor) { | |
| 283 | + } else if (!$scope.remito.proveedor.COD) { | |
| 284 | 284 | focaModalService.alert('Ingrese Proveedor'); |
| 285 | 285 | return; |
| 286 | 286 | } else if (!$scope.remito.cotizacion.moneda.id && |
| ... | ... | @@ -309,8 +309,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 309 | 309 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
| 310 | 310 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
| 311 | 311 | idVendedor: $scope.remito.idVendedor, |
| 312 | - idProveedor: $scope.remito.idProveedor, | |
| 313 | - idDomicilio: $scope.remito.idDomicilio, | |
| 312 | + idProveedor: $scope.remito.proveedor.COD, | |
| 313 | + idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, | |
| 314 | 314 | idCotizacion: $scope.remito.cotizacion.ID, |
| 315 | 315 | idPrecioCondicion: $scope.remito.idPrecioCondicion, |
| 316 | 316 | flete: $scope.remito.flete, |
| ... | ... | @@ -358,7 +358,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 358 | 358 | $scope.remito.id = data.data.id; |
| 359 | 359 | $scope.remito.numeroRemito = data.data.numero; |
| 360 | 360 | |
| 361 | - if ($scope.remito.remitoPuntoDescarga) { | |
| 361 | + if ($scope.remito.remitoPuntoDescarga.length) { | |
| 362 | 362 | remitoBusinessService.addPuntosDescarga(data.data.id, |
| 363 | 363 | $scope.remito.remitoPuntoDescarga); |
| 364 | 364 | } |
| ... | ... | @@ -482,12 +482,18 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 482 | 482 | ); |
| 483 | 483 | modalInstance.result.then( |
| 484 | 484 | function(puntosDescarga) { |
| 485 | - $scope.remito.remitoPuntoDescarga = puntosDescarga; | |
| 485 | + | |
| 486 | + puntosDescarga.forEach(function(punto) { | |
| 487 | + $scope.remito.remitoPuntoDescarga.push( | |
| 488 | + { | |
| 489 | + puntoDescarga: punto | |
| 490 | + } | |
| 491 | + ); | |
| 492 | + }); | |
| 486 | 493 | |
| 487 | 494 | $scope.$broadcast('addCabecera', { |
| 488 | 495 | label: 'Puntos de descarga:', |
| 489 | - valor: getCabeceraPuntoDescarga( | |
| 490 | - $scope.remito.remitoPuntoDescarga) | |
| 496 | + valor: getCabeceraPuntoDescarga(puntosDescarga) | |
| 491 | 497 | }); |
| 492 | 498 | }, function () { |
| 493 | 499 | $scope.abrirModalDomicilios($scope.cliente); |
| ... | ... | @@ -645,12 +651,6 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 645 | 651 | if (domicilio.verPuntos) { |
| 646 | 652 | delete $scope.remito.domicilio.verPuntos; |
| 647 | 653 | $scope.seleccionarPuntosDeDescarga(); |
| 648 | - } else { | |
| 649 | - crearRemitoService | |
| 650 | - .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) | |
| 651 | - .then(function (res) { | |
| 652 | - if (res.data.length) $scope.seleccionarPuntosDeDescarga(); | |
| 653 | - }); | |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
| ... | ... | @@ -1195,13 +1195,14 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | function deleteCliente() { |
| 1198 | - delete $scope.remito.domicilioStamp; | |
| 1199 | - delete $scope.remito.puntosDescarga; | |
| 1198 | + $scope.remito.domicilioStamp = ''; | |
| 1199 | + $scope.remito.remitoPuntoDescarga = []; | |
| 1200 | 1200 | $scope.remito.domicilio = { dom: '' }; |
| 1201 | 1201 | $scope.remito.cliente = {}; |
| 1202 | 1202 | $scope.$broadcast('removeCabecera', 'Cliente:'); |
| 1203 | 1203 | $scope.$broadcast('removeCabecera', 'Domicilio:'); |
| 1204 | 1204 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); |
| 1205 | + $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = false; | |
| 1205 | 1206 | } |
| 1206 | 1207 | |
| 1207 | 1208 | function getCabeceraPuntoDescarga(puntosDescarga) { |