Commit e51d8be2478ff85150836e6fa6e842914feb1fd8
1 parent
c401bb111c
Exists in
master
and in
1 other branch
fixs
Showing
2 changed files
with
58 additions
and
1 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -394,6 +394,62 @@ angular.module('focaParametros') |
| 394 | 394 | }); |
| 395 | 395 | }; |
| 396 | 396 | |
| 397 | + $scope.seleccionarPreciosYCondiciones = function() { | |
| 398 | + if (!$scope[getModulo()].cliente || !$scope[getModulo()].cliente.COD) { | |
| 399 | + focaModalService.alert('Primero seleccione un cliente'); | |
| 400 | + return; | |
| 401 | + } | |
| 402 | + | |
| 403 | + var modalInstance = $uibModal.open( | |
| 404 | + { | |
| 405 | + ariaLabelledBy: 'Busqueda de Precio Condición', | |
| 406 | + templateUrl: 'modal-precio-condicion.html', | |
| 407 | + controller: 'focaModalPrecioCondicionController', | |
| 408 | + size: 'lg', | |
| 409 | + resolve: { | |
| 410 | + idListaPrecio: function() { | |
| 411 | + return $scope[getModulo()].cliente.MOD || null; | |
| 412 | + } | |
| 413 | + } | |
| 414 | + } | |
| 415 | + ); | |
| 416 | + | |
| 417 | + modalInstance.result.then( | |
| 418 | + function(precioCondicion) { | |
| 419 | + var cabecera = ''; | |
| 420 | + var plazosConcat = ''; | |
| 421 | + if (!Array.isArray(precioCondicion)) { | |
| 422 | + $scope[getModulo()][getModulo() + 'Plazo' ]= precioCondicion.plazoPago; | |
| 423 | + $scope[getModulo()].precioCondicion = precioCondicion; | |
| 424 | + $scope[getModulo()].idPrecioCondicion = precioCondicion.id; | |
| 425 | + $scope.idLista = precioCondicion.idListaPrecio; | |
| 426 | + for (var i = 0; i < precioCondicion.plazoPago.length; i++) { | |
| 427 | + plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | |
| 428 | + } | |
| 429 | + cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | |
| 430 | + ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | |
| 431 | + } else { //Cuando se ingresan los plazos manualmente | |
| 432 | + $scope[getModulo()].idPrecioCondicion = 0; | |
| 433 | + //-1, el modal productos busca todos los productos | |
| 434 | + $scope.idLista = -1; | |
| 435 | + $scope[getModulo()][ getModulo() + 'Plazo'] = precioCondicion; | |
| 436 | + for (var j = 0; j < precioCondicion.length; j++) { | |
| 437 | + plazosConcat += precioCondicion[j].dias + ' '; | |
| 438 | + } | |
| 439 | + cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
| 440 | + } | |
| 441 | + $scope.$broadcast('addCabecera', { | |
| 442 | + label: 'Precios y condiciones:', | |
| 443 | + seccion: getModulo('label'), | |
| 444 | + valor: cabecera | |
| 445 | + }); | |
| 446 | + }, function() { | |
| 447 | + | |
| 448 | + } | |
| 449 | + ); | |
| 450 | + | |
| 451 | + }; | |
| 452 | + | |
| 397 | 453 | $scope.$watch('botonera', function() { |
| 398 | 454 | |
| 399 | 455 | // Creo el string en donde guardo el objeto parseado |
| ... | ... | @@ -604,7 +660,7 @@ angular.module('focaParametros') |
| 604 | 660 | |
| 605 | 661 | if ($scope[entidad.modulo][entidad.modulo + 'PuntoDescarga']) { |
| 606 | 662 | var puntos = []; |
| 607 | - $scope[entidad.modulo][entidad + 'PuntoDescarga'] | |
| 663 | + $scope[entidad.modulo][entidad.modulo + 'PuntoDescarga'] | |
| 608 | 664 | .forEach(function(entidadPuntoDescarga) { |
| 609 | 665 | puntos.push(entidadPuntoDescarga); |
| 610 | 666 | }); |