Commit 826755dfcdcc787de45a6feeb4b58cb86fb78446
Exists in
master
Merge branch 'master' into 'develop'
Master See merge request !62
Showing
2 changed files
Show diff stats
spec/controllerSpec.js
... | ... | @@ -524,14 +524,31 @@ describe('controladores módulo crear cobranza', function() { |
524 | 524 | return { |
525 | 525 | then: function() { } |
526 | 526 | }; |
527 | + }, | |
528 | + getCobradorById: function() { | |
529 | + return { | |
530 | + then: function() { } | |
531 | + }; | |
532 | + } | |
533 | + }, | |
534 | + focaModalService: { | |
535 | + modal: function() { | |
536 | + return { | |
537 | + then: function() {} | |
538 | + }; | |
527 | 539 | } |
528 | 540 | }, |
529 | - focaModalService: {}, | |
530 | 541 | $filter: $filter, |
531 | 542 | focaSeguimientoService: {}, |
532 | 543 | focaBotoneraLateralService: {}, |
533 | - APP: {}, | |
534 | - focaLoginService: {}, | |
544 | + APP: 'cobranza', | |
545 | + focaLoginService: { | |
546 | + getLoginData: function() { | |
547 | + return { | |
548 | + vendedorCobrador: true | |
549 | + }; | |
550 | + } | |
551 | + }, | |
535 | 552 | $localStorage: true |
536 | 553 | }); |
537 | 554 | scope.cobranza = { |
src/js/controller.js
... | ... | @@ -409,6 +409,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
409 | 409 | clienteMayus.NOM |
410 | 410 | }); |
411 | 411 | $scope.cobranza.cliente = clienteMayus; |
412 | + $scope.cobranza.facturas = []; | |
412 | 413 | }, function() { |
413 | 414 | if (APP !== 'cobranza') $scope.seleccionarCliente(); |
414 | 415 | } |
... | ... | @@ -484,10 +485,18 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
484 | 485 | ); |
485 | 486 | modalInstance.result.then( |
486 | 487 | function(facturas) { |
487 | - $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturas); | |
488 | - }, function() { | |
488 | + var facturasResult = []; | |
489 | + //AGREGO A FACTURASRESULT LAS FACTURAS QUE NO HAN SIDO SELECCIONADAS | |
490 | + facturas.forEach(function(factura) { | |
491 | + var existe = $scope.cobranza.facturas.filter(function(e) { | |
492 | + return angular.equals(factura, e); | |
493 | + }); | |
489 | 494 | |
490 | - } | |
495 | + if (!existe.length) facturasResult.push(factura); | |
496 | + }); | |
497 | + | |
498 | + $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturasResult); | |
499 | + }, function() { } | |
491 | 500 | ); |
492 | 501 | }; |
493 | 502 |