Commit ebf3e5e8d688ec8d0a37c3b5ae738eee6a62afc8
1 parent
8cc007888b
Exists in
master
- Agregué el modal de cotización.
- Modifiqué la lógica para continuar desde moneda a cotización. - Modifiqué addCabecera y removeCabecera para hacer perfect match. - Agregué límite de fecha hasta hoy.
Showing
2 changed files
with
34 additions
and
4 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -305,7 +305,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 305 | 305 | var plazosConcat = ''; |
| 306 | 306 | if(!Array.isArray(precioCondicion)) { |
| 307 | 307 | $scope.plazosPagos = precioCondicion.plazoPago; |
| 308 | - idLista = precioCondicion.idListaPrecio; | |
| 308 | + idLista = precioCondicion.idListaPrecio; | |
| 309 | 309 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 310 | 310 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
| 311 | 311 | } |
| ... | ... | @@ -317,7 +317,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 317 | 317 | plazosConcat += precioCondicion[j].dias + ' '; |
| 318 | 318 | } |
| 319 | 319 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
| 320 | - } | |
| 320 | + } | |
| 321 | 321 | $scope.articulosTabla = []; |
| 322 | 322 | addCabecera('Precios y condiciones:', cabecera); |
| 323 | 323 | }, function() { |
| ... | ... | @@ -383,6 +383,35 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 383 | 383 | }; |
| 384 | 384 | |
| 385 | 385 | addCabecera('Moneda:', moneda.DETALLE); |
| 386 | + $scope.abrirModalCotizacion(moneda.ID); | |
| 387 | + }, function() { | |
| 388 | + | |
| 389 | + } | |
| 390 | + ); | |
| 391 | + }; | |
| 392 | + | |
| 393 | + $scope.abrirModalCotizacion = function(idMoneda) { | |
| 394 | + var modalInstance = $uibModal.open( | |
| 395 | + { | |
| 396 | + ariaLabelledBy: 'Busqueda de Cotización', | |
| 397 | + templateUrl: 'modal-cotizacion.html', | |
| 398 | + controller: 'focaModalCotizacionController', | |
| 399 | + size: 'lg', | |
| 400 | + resolve: {idMoneda: function() {return idMoneda;}} | |
| 401 | + } | |
| 402 | + ); | |
| 403 | + modalInstance.result.then( | |
| 404 | + function(cotizacion) { | |
| 405 | + $scope.notaPedido.cotizacion = { | |
| 406 | + id: cotizacion.ID, | |
| 407 | + cotizacion: cotizacion.COTIZACION | |
| 408 | + }; | |
| 409 | + | |
| 410 | + addCabecera( | |
| 411 | + 'Fecha cotizacion:', | |
| 412 | + $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | |
| 413 | + ); | |
| 414 | + addCabecera('Cotizacion:', cotizacion.COTIZACION); | |
| 386 | 415 | }, function() { |
| 387 | 416 | |
| 388 | 417 | } |
| ... | ... | @@ -458,7 +487,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 458 | 487 | }; |
| 459 | 488 | |
| 460 | 489 | function addCabecera(label, valor) { |
| 461 | - var propiedad = $filter('filter')($scope.cabecera, {label: label}); | |
| 490 | + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | |
| 462 | 491 | if(propiedad.length === 1) { |
| 463 | 492 | propiedad[0].valor = valor; |
| 464 | 493 | } else { |
| ... | ... | @@ -467,7 +496,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 467 | 496 | } |
| 468 | 497 | |
| 469 | 498 | function removeCabecera(label) { |
| 470 | - var propiedad = $filter('filter')($scope.cabecera, {label: label}); | |
| 499 | + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | |
| 471 | 500 | if(propiedad.length === 1){ |
| 472 | 501 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 473 | 502 | } |