Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. //está parte seleciona uma pendencia que esta dentro de um dropdown
  2.  
  3. pendenciaSelecionada(nomeDocumento:string){
  4. let index = lodash.findIndex(this.detalhesPendencias,function(item){
  5. return item.nomeDocumento == nomeDocumento;
  6. } );
  7. this.pendenciaDescricao = this.detalhesPendencias[index].pendencias;
  8. }
  9.  
  10. //está parte está no html ativando o botão adicionar e jogando na table
  11. // o this.pendenciaAtiva é o array que monta na tabela
  12.  
  13. public addPendencia() {
  14. if (this.pendenciaDescricao && this.pendenciaDescricao.trim().length > 0 &&
  15. this.pendenciaDocumento && this.pendenciaDocumento.trim().length > 0) {
  16. let pen = new Pendencia();
  17. pen.id = this.cadastropj.pendencias.length;
  18. pen.ativo = true;
  19. pen.data = this.utilService.getDateInUTCLong(new Date());
  20. pen.descricao = this.pendenciaDescricao;
  21. pen.documento = this.pendenciaDocumento;
  22. this.cadastropj.pendencias.push(pen);
  23. this.pendenciasAtivas.push(pen);
  24. this.pendenciaDescricao = "";
  25. //ordem
  26. this.pendenciasAtivas.sort(function (a, b) {
  27. if (a.documento[0] > b.documento) {
  28. return 1;
  29. }
  30. if (a.documento < b.documento) {
  31. return -1;
  32. }
  33.  
  34. return 0;
  35. });
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement