Advertisement
Guest User

component

a guest
Sep 15th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core';
  2. import { DocumentsService } from "../../services/data/documents/documents.service";
  3. import { GridDataResult, PageChangeEvent, SelectableSettings, SelectionEvent } from '@progress/kendo-angular-grid';
  4.  
  5. import{ DocBriefList } from "../../models/Documents";
  6. import { ServiceUtils } from "../../services/Utils/Utils";
  7. import { FullLoadingComponent } from '../../modais/full-loading/full-loading.component';
  8. import { Router } from '@angular/router';
  9.  
  10. @Component({
  11. selector: 'app-dashgrid-documents',
  12. templateUrl: './grid-documents.component.html',
  13. styleUrls: ['./grid-documents.component.css'],
  14. providers: [DocumentsService,ServiceUtils]
  15. })
  16. export class GridDocumentsComponent implements OnInit {
  17.  
  18. public GridData: GridDataResult = null;
  19. public GridPageSize: number = 10;
  20. public GridSkip: number = 0;
  21. public selectableSettings: SelectableSettings;
  22. private _selectedItem:any = null;
  23. @ViewChild('fullLoading') fullLoading: FullLoadingComponent;
  24.  
  25. constructor(private documentService: DocumentsService,
  26. private svcUtils: ServiceUtils,
  27. private router: Router ) {
  28. this.GridSkip = 0;
  29. this.GridReload();
  30. }
  31.  
  32. ngOnInit() {
  33. this.selectableSettings = {
  34. checkboxOnly: false,
  35. mode: "single"
  36. };
  37. }
  38.  
  39. FormatCnpjItem(item:string)
  40. {
  41. return this.svcUtils.ConvertStringToCNPJ(item);
  42. }
  43.  
  44. public pageChange(event: PageChangeEvent): void {
  45. this.GridSkip = event.skip;
  46. this.GridReload();
  47. }
  48.  
  49. public AtualizaGrid() {
  50. this.fullLoading.showLoading();
  51. this.GridReload();
  52. }
  53.  
  54. public GridReload(){
  55. this.documentService.GetDocProcessBrief(this.GridSkip,this.GridPageSize).subscribe(a=>{
  56. this.GridData = {
  57. data: a.Data,
  58. total: a.Total
  59. }
  60. this.fullLoading.hideLoading();
  61. });
  62. }
  63.  
  64. VisualizarProcesso(itemID){
  65. this.router.navigate(
  66. ['/doc-process'],
  67. {
  68. queryParams: {
  69. 'id': itemID
  70. }
  71. }
  72. );
  73. }
  74.  
  75. public docSelectionChange(event:SelectionEvent):void{
  76. if(event.selected && event.selectedRows.length > 0)
  77. {
  78. this._selectedItem = event.selectedRows[0].dataItem;
  79. }
  80. else{
  81. this._selectedItem = null;
  82. }
  83. }
  84. public ReprocessSelItem(){
  85. this.fullLoading.showLoading();
  86. this.documentService.ReprocessDocument(this._selectedItem.ID).subscribe(a=>{
  87. this.GridSkip = 0;
  88. this.GridReload();
  89. });
  90. }
  91.  
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement