Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, Input, OnInit } from '@angular/core';
- import icSearch from '@iconify/icons-ic/twotone-search';
- import icAdd from '@iconify/icons-ic/twotone-add';
- import icFilterList from '@iconify/icons-ic/twotone-filter-list';
- import icMoreHoriz from '@iconify/icons-ic/twotone-more-horiz';
- import icEdit from '@iconify/icons-ic/twotone-edit';
- import icDelete from '@iconify/icons-ic/twotone-delete';
- import icAccess from '@iconify/icons-ic/twotone-dns';
- import icPageView from '@iconify/icons-ic/twotone-pageview';
- import icCheck from '@iconify/icons-ic/twotone-check';
- import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
- import { RepositoryService } from 'src/app/shared/services/repository.service';
- import { ActivatedRoute } from '@angular/router';
- import { pelaksanaan } from 'src/app/shared/services/uji-tuntas/config';
- import { UjiTuntasService } from 'src/app/shared/services/uji-tuntas/uji-tuntas.service';
- import { DialogComponent } from 'src/app/shared/components/dialog/dialog.component';
- import { DialogInfoComponent } from 'src/app/shared/components/dialog-info/dialog-info.component';
- import { DialogDeletePosComponent } from './dialog-delete-pos/dialog-delete-pos.component';
- import { DialogJumlahRekeningComponent } from './dialog-rekening/jumlah-rekening.component';
- import { DialogSelisihComponent } from './dialog-selisih/dialog-selisih.component';
- import { DialogTambahPosComponent } from './dialog-tambah-pos/dialog-tambah-pos.component';
- @Component({
- selector: 'vex-data-kredit-front-page',
- templateUrl: './data-kredit-front-page.component.html',
- styleUrls: ['./data-kredit-front-page.component.scss']
- })
- export class PengolahanDataKreditFrontPageComponent implements OnInit {
- @Input() dataAtiAtb: any;
- public token: string;
- public rows: Array<object> = [];
- public columns: Array<object>;
- icSearch = icSearch;
- icAdd = icAdd;
- icMoreHoriz = icMoreHoriz;
- icEdit = icEdit;
- icDelete = icDelete;
- icAccess = icAccess;
- icPageView = icPageView;
- icCheck = icCheck;
- icFilterList = icFilterList;
- showFilter = false;
- // role = "Admin";
- role = "Ketua Tim";
- modifiedDate: any = '28-01-2022 08.00 A.M.';
- source: any = 'KK Pemeriksaan LK Generated';
- id:any
- constructor(
- private repositoryService: RepositoryService,
- private ujituntasService: UjiTuntasService,
- public dialog: MatDialog,
- private route: ActivatedRoute,
- ) {
- this.route.params.subscribe((params) => {
- this.id = params['id'];
- })
- }
- ngOnInit(): void {
- this.token = localStorage.getItem('token');
- this.columns = [
- { name: 'Nama Bank', field: 'bankName' },
- { name: 'Jaringan Kantor', field: 'role' },
- { name: 'Periode UT', field: 'createdDate' },
- { name: 'Nama Pelaksana', field: 'name' },
- { name: 'Status', field: 'status' },
- ];
- this.getDataJson();
- }
- getDataJson() {
- this.ujituntasService.getDataWithToken(pelaksanaan.listFrontPageAtiAtb+'/'+ this.dataAtiAtb.masterPenugasanUtid, this.token, null).subscribe((data: any) => {
- this.rows = data.data.data;
- this.modifiedDate = data.data.lastModified;
- this.source = data.data.source;
- },
- (error) => {
- console.log('error', error);
- }
- )
- }
- downloadExcel() {
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Downloading file',
- dialogText: 'Silahkan menunggu...',
- isLoading: true
- };
- const dialogRef = this.dialog.open(DialogComponent, dialogConfig);
- this.ujituntasService.download(pelaksanaan.pengajuanPosAktivaTetapDoc + 'DownloadDocATAsExcel/' + this.dataAtiAtb.masterPenugasanUtid, this.token, 'application/x-www-form-urlencoded')
- .subscribe((value: any) => {
- let url = window.URL.createObjectURL(value);
- let a = document.createElement('a');
- document.body.appendChild(a);
- a.setAttribute('style', 'display: none');
- a.href = url;
- a.download = 'ATI ATB.xlsx';
- a.click();
- window.URL.revokeObjectURL(url);
- dialogRef.close();
- },
- (err) => {
- dialogRef.close();
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Download gagal',
- dialogText: err.error.detail,
- isLoading: false
- };
- const dialogErr = this.dialog.open(DialogInfoComponent, dialogConfig);
- console.log(err);
- });
- }
- dialogTambahPos() {
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.width = '600px';
- dialogConfig.data = [null];
- const dialogRef = this.dialog.open(DialogTambahPosComponent, dialogConfig);
- dialogRef.afterClosed().subscribe(result => {
- if (result == true) {
- // this.updatePage({ first: 0, rows: 5 });
- }
- });
- }
- dialogJumlahRekening() {
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.width = '1200px';
- dialogConfig.data = [null];
- const dialogRef = this.dialog.open(DialogJumlahRekeningComponent, dialogConfig);
- dialogRef.afterClosed().subscribe(result => {
- if (result == true) {
- // this.updatePage({ first: 0, rows: 5 });
- }
- });
- }
- dialogSelisih() {
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.width = '1300px';
- dialogConfig.data = [null];
- const dialogRef = this.dialog.open(DialogSelisihComponent, dialogConfig);
- dialogRef.afterClosed().subscribe(result => {
- if (result == true) {
- // this.updatePage({ first: 0, rows: 5 });
- }
- });
- }
- deletePos() {
- const dialogConfig = new MatDialogConfig();
- // dialogConfig.disableClose = true;
- // dialogConfig.data = this.selected;
- // dialogConfig.data.isChecklist = true;
- const dialogRef = this.dialog.open(DialogDeletePosComponent, dialogConfig);
- dialogRef.afterClosed().subscribe(result => {
- console.log(`Dialog result: ${result}`);
- if (result) {
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement