Advertisement
coffeecode12

frontpage-kredit

Mar 22nd, 2022
1,209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4. import { Component, Input, OnInit } from '@angular/core';
  5. import icSearch from '@iconify/icons-ic/twotone-search';
  6. import icAdd from '@iconify/icons-ic/twotone-add';
  7. import icFilterList from '@iconify/icons-ic/twotone-filter-list';
  8. import icMoreHoriz from '@iconify/icons-ic/twotone-more-horiz';
  9. import icEdit from '@iconify/icons-ic/twotone-edit';
  10. import icDelete from '@iconify/icons-ic/twotone-delete';
  11. import icAccess from '@iconify/icons-ic/twotone-dns';
  12. import icPageView from '@iconify/icons-ic/twotone-pageview';
  13. import icCheck from '@iconify/icons-ic/twotone-check';
  14. import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
  15. import { RepositoryService } from 'src/app/shared/services/repository.service';
  16. import { ActivatedRoute } from '@angular/router';
  17. import { pelaksanaan } from 'src/app/shared/services/uji-tuntas/config';
  18. import { UjiTuntasService } from 'src/app/shared/services/uji-tuntas/uji-tuntas.service';
  19. import { DialogComponent } from 'src/app/shared/components/dialog/dialog.component';
  20. import { DialogInfoComponent } from 'src/app/shared/components/dialog-info/dialog-info.component';
  21. import { DialogDeletePosComponent } from './dialog-delete-pos/dialog-delete-pos.component';
  22. import { DialogJumlahRekeningComponent } from './dialog-rekening/jumlah-rekening.component';
  23. import { DialogSelisihComponent } from './dialog-selisih/dialog-selisih.component';
  24. import { DialogTambahPosComponent } from './dialog-tambah-pos/dialog-tambah-pos.component';
  25.  
  26. @Component({
  27.   selector: 'vex-data-kredit-front-page',
  28.   templateUrl: './data-kredit-front-page.component.html',
  29.   styleUrls: ['./data-kredit-front-page.component.scss']
  30. })
  31. export class PengolahanDataKreditFrontPageComponent implements OnInit {
  32.  
  33.   @Input() dataAtiAtb: any;
  34.   public token: string;
  35.   public rows: Array<object> = [];
  36.   public columns: Array<object>;
  37.   icSearch = icSearch;
  38.   icAdd = icAdd;
  39.   icMoreHoriz = icMoreHoriz;
  40.   icEdit = icEdit;
  41.   icDelete = icDelete;
  42.   icAccess = icAccess;
  43.   icPageView = icPageView;
  44.   icCheck = icCheck;
  45.   icFilterList = icFilterList;
  46.   showFilter = false;
  47.   // role = "Admin";
  48.   role = "Ketua Tim";
  49.   modifiedDate: any = '28-01-2022 08.00 A.M.';
  50.   source: any = 'KK Pemeriksaan LK Generated';
  51.   id:any
  52.   constructor(
  53.     private repositoryService: RepositoryService,
  54.     private ujituntasService: UjiTuntasService,
  55.     public dialog: MatDialog,
  56.     private route: ActivatedRoute,
  57.   ) {
  58.     this.route.params.subscribe((params) => {
  59.             this.id = params['id'];
  60.         })
  61.    }
  62.  
  63.   ngOnInit(): void {
  64.     this.token = localStorage.getItem('token');
  65.     this.columns = [
  66.       { name: 'Nama Bank', field: 'bankName' },
  67.       { name: 'Jaringan Kantor', field: 'role' },
  68.       { name: 'Periode UT', field: 'createdDate' },
  69.       { name: 'Nama Pelaksana', field: 'name' },
  70.       { name: 'Status', field: 'status' },
  71.     ];
  72.  
  73.     this.getDataJson();
  74.   }
  75.  
  76.  
  77.   getDataJson() {
  78.     this.ujituntasService.getDataWithToken(pelaksanaan.listFrontPageAtiAtb+'/'+ this.dataAtiAtb.masterPenugasanUtid, this.token, null).subscribe((data: any) => {
  79.       this.rows = data.data.data;
  80.       this.modifiedDate = data.data.lastModified;
  81.       this.source = data.data.source;
  82.     },
  83.       (error) => {
  84.         console.log('error', error);
  85.       }
  86.     )
  87.   }
  88.  
  89.   downloadExcel() {
  90.     const dialogConfig = new MatDialogConfig();
  91.     dialogConfig.disableClose = true;
  92.     dialogConfig.data = {
  93.         dialogTitle: 'Downloading file',
  94.         dialogText: 'Silahkan menunggu...',
  95.         isLoading: true
  96.     };
  97.    
  98.     const dialogRef = this.dialog.open(DialogComponent, dialogConfig);
  99.     this.ujituntasService.download(pelaksanaan.pengajuanPosAktivaTetapDoc + 'DownloadDocATAsExcel/' + this.dataAtiAtb.masterPenugasanUtid, this.token, 'application/x-www-form-urlencoded')
  100.         .subscribe((value: any) => {
  101.             let url = window.URL.createObjectURL(value);
  102.             let a = document.createElement('a');
  103.             document.body.appendChild(a);
  104.             a.setAttribute('style', 'display: none');
  105.             a.href = url;
  106.             a.download = 'ATI ATB.xlsx';
  107.             a.click();
  108.             window.URL.revokeObjectURL(url);
  109.             dialogRef.close();
  110.         },
  111.         (err) => {
  112.             dialogRef.close();
  113.             dialogConfig.disableClose = true;
  114.             dialogConfig.data = {
  115.               dialogTitle: 'Download gagal',
  116.               dialogText: err.error.detail,
  117.               isLoading: false
  118.             };
  119.             const dialogErr = this.dialog.open(DialogInfoComponent, dialogConfig);
  120.             console.log(err);
  121.         });
  122.   }
  123.  
  124.   dialogTambahPos() {
  125.     const dialogConfig = new MatDialogConfig();
  126.     dialogConfig.disableClose = true;
  127.     dialogConfig.width = '600px';
  128.     dialogConfig.data = [null];
  129.  
  130.     const dialogRef = this.dialog.open(DialogTambahPosComponent, dialogConfig);
  131.  
  132.     dialogRef.afterClosed().subscribe(result => {
  133.       if (result == true) {
  134.         // this.updatePage({ first: 0, rows: 5 });
  135.       }
  136.     });
  137.   }
  138.  
  139.   dialogJumlahRekening() {
  140.     const dialogConfig = new MatDialogConfig();
  141.     dialogConfig.disableClose = true;
  142.     dialogConfig.width = '1200px';
  143.     dialogConfig.data = [null];
  144.  
  145.     const dialogRef = this.dialog.open(DialogJumlahRekeningComponent, dialogConfig);
  146.  
  147.     dialogRef.afterClosed().subscribe(result => {
  148.       if (result == true) {
  149.         // this.updatePage({ first: 0, rows: 5 });
  150.       }
  151.     });
  152.   }
  153.  
  154.   dialogSelisih() {
  155.     const dialogConfig = new MatDialogConfig();
  156.     dialogConfig.disableClose = true;
  157.     dialogConfig.width = '1300px';
  158.     dialogConfig.data = [null];
  159.  
  160.     const dialogRef = this.dialog.open(DialogSelisihComponent, dialogConfig);
  161.  
  162.     dialogRef.afterClosed().subscribe(result => {
  163.       if (result == true) {
  164.         // this.updatePage({ first: 0, rows: 5 });
  165.       }
  166.     });
  167.   }
  168.  
  169.   deletePos() {
  170.     const dialogConfig = new MatDialogConfig();
  171.     // dialogConfig.disableClose = true;
  172.     // dialogConfig.data = this.selected;
  173.     // dialogConfig.data.isChecklist = true;
  174.  
  175.     const dialogRef = this.dialog.open(DialogDeletePosComponent, dialogConfig);
  176.     dialogRef.afterClosed().subscribe(result => {
  177.       console.log(`Dialog result: ${result}`);
  178.  
  179.       if (result) {
  180.        
  181.       }
  182.     });
  183.   }
  184.  
  185.  
  186.  
  187. }
  188.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement