Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnDestroy, OnInit } from '@angular/core';
- import icAdd from '@iconify/icons-ic/twotone-add';
- import icDelete from '@iconify/icons-ic/delete';
- import icDone from '@iconify/icons-ic/done';
- import icSave from '@iconify/icons-ic/save';
- import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
- import { UploadKreditTigaComponent } from './upload-kredit-tiga/upload-kredit-tiga.component';
- import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
- import { TambahKreditTigaComponent } from './tambah-kredit-tiga/tambah-kredit-tiga.component';
- import { ActivatedRoute } from '@angular/router';
- import { DialogComponent } from '../../../../../../../shared/components/dialog/dialog.component';
- import { DialogInfoComponent } from '../../../../../../../shared/components/dialog-info/dialog-info.component';
- import { Observable, Subject } from 'rxjs';
- import { SubmitKreditTigaComponent } from './submit-kredit-tiga/submit-kredit-tiga.component';
- import { TableRequest } from 'src/app/model/module/uji-tuntas/uji-tuntas.model';
- import { UjiTuntasService } from 'src/app/services/module/uji-tuntas/uji-tuntas.service';
- import { KreditService } from 'src/app/services/module/uji-tuntas/kredit.service';
- import { PelaksanaanService } from 'src/app/services/module/uji-tuntas/pelaksanaan.service';
- import { takeUntil } from 'rxjs/operators';
- @Component({
- selector: 'vex-detail-kredit-tiga',
- templateUrl: './detail-kredit-tiga.component.html',
- styleUrls: ['./detail-kredit-tiga.component.scss']
- })
- export class DetailKreditTigaComponent implements OnInit, OnDestroy {
- private readonly unsubs: Subject<void> = new Subject<void>();
- icAdd = icAdd;
- icDelete = icDelete;
- icDone = icDone;
- icSave = icSave;
- isSimpan = false;
- public currentLink: string;
- public previousLink: string;
- public crumbsValue: any[] = [];
- form: FormGroup;
- formPenilaian: FormGroup;
- informasiNasabahFormGroup: FormGroup;
- public paramRequest: TableRequest;
- public rows: any[] = [];
- public rowsPenilaian: Array<any> = [];
- public columns: any[] = [];
- public rowsKualitasPembiayaan: any[] = [];
- public columnsKualitasPembiayaan: any[] = [];
- rowsInformasiAgunan: any[] = [];
- recordsTotal: number = 0;
- listPemeriksaan: any;
- listNasabah: any;
- pageSize: number = 5;
- isLoading: boolean = false;
- id: any;
- masterPenugasanUtId: any;
- pemeriksaanId: any;
- idNasabah: any;
- bankName: any;
- tanggalUt: any;
- isCheckedAll: boolean = false;
- tampungArraySelected: any = [];
- summaryFormGroup: FormGroup;
- isSummarySaved: boolean = false;
- index: any;
- search: string;
- sortField: string;
- firstPage: string = "1";
- sort: string;
- colsName: any = [];
- public rowsTemplate = [];
- public listKolPemeriksa = [];
- totalNilaiagunan :any;
- totalPPA:any;
- constructor(
- private formBuilder: FormBuilder,
- public dialog: MatDialog,
- private router: ActivatedRoute,
- private ujiTuntasService: UjiTuntasService,
- private pelaksanaanService: PelaksanaanService,
- private kreditService: KreditService,
- ) {
- this.router.params.subscribe((params) => {
- this.id = params['PemeriksaanUtKreditNasabahID'];
- this.masterPenugasanUtId = params['id'];
- this.pemeriksaanId = params['pemeriksaanId'];
- });
- }
- ngOnInit(): void {
- this.currentLink = window.location.href;
- this.previousLink = this.currentLink.split('tiga-pilar')[0];
- this.crumbsValue = [
- { label: 'GPEB', route: this.currentLink },
- { label: 'Pelaksanaan Uji Tuntas', route: this.currentLink },
- { label: 'Laporan Pemeriksaan Kredit', route: this.previousLink },
- { label: 'Kredit Tiga Pilar', route: this.currentLink },
- ];
- this.columnsKualitasPembiayaan = [
- { name: 'Faktor Penilaian Kualitas Pembiayaan', field: 'kualitasPembiayaan' },
- { name: 'Kol Pemeriksa', field: 'pemeriksa' },
- { name: 'Catatan', field: 'catatan' },
- { name: 'Dokumen Pendukung', field: 'upload' },
- ];
- this.columns = [
- { name: 'id', field: 'id' },
- ];
- this.sortField = 'id';
- this.pageSize = 5;
- this.paramRequest = {
- start: 0,
- length: this.pageSize,
- };
- this.form = this.formBuilder.group({
- isCheckedAll: [false],
- });
- this.fc.isCheckedAll.setValue(this.isCheckedAll ? this.isCheckedAll : false);
- this.getLastStatus();
- this.getInformasiAgunan(this.paramRequest);
- this.ngInitForm();
- this.getDummyData();
- this.getInfoNasabah();
- this.getDataPenilaian();
- this.getInfoPemeriksa();
- }
- ngInitForm() {
- this.listKolPemeriksa = [
- { id: "1", name: 1 },
- { id: "2", name: 2 },
- { id: "3", name: 3 },
- { id: "4", name: 4 },
- { id: "5", name: 5 }
- ]
- this.formPenilaian = this.formBuilder.group({
- penilaianList: this.formBuilder.array([])
- });
- this.clearFormArrayPenilaian();
- this.summaryFormGroup = this.formBuilder.group({
- KolNasabahPemeriksaSummary: [{ value: '', disabled: false }],
- PPABankSummary: [{ value: '', disabled: true }],
- KolNasabahBankSummary: [{ value: '', disabled: true }],
- PlafonSummary: [{ value: '', disabled: false }, [Validators.required]],
- BakiDebetSummary: [{ value: '', disabled: false }, [Validators.required]],
- PPAPemeriksaSummary: [{ value: '', disabled: false }, [Validators.required]],
- CatatanPemeriksaSummary: [{ value: '', disabled: false }]
- })
- this.informasiNasabahFormGroup = this.formBuilder.group({
- nasabahBergerakdiBidang: [{ value: '', disabled: false }, [Validators.required]],
- mulaiBeroperasiSejak: [{ value: '', disabled: false }, [Validators.required]],
- nasabahMenPembiayaanBankSejak: [{ value: '', disabled: false }, [Validators.required]],
- denganPlafonAwal: [{ value: '', disabled: false }, [Validators.required]],
- pernahMenRestrukturSebanyak: [{ value: '', disabled: false }, [Validators.required]]
- })
- }
- clearFormArrayPenilaian() {
- const arr = this.formPenilaian.controls['penilaianList'] as FormArray;
- arr.controls = [];
- }
- get listPenilaian() {
- return this.formPenilaian.controls['penilaianList'] as FormArray;
- }
- get fc() {
- return this.form.controls;
- }
- get summaryForm() {
- return this.summaryFormGroup.controls;
- }
- get informasiNasabahForm() {
- return this.informasiNasabahFormGroup.controls;
- }
- getDataPenilaian() {
- this.isLoading = true;
- this.kreditService.getListPenilaian(this.id).pipe(takeUntil(this.unsubs)).subscribe((data: any) => {
- if (data.data) {
- data.data.forEach(value => {
- this.addRowPenilaian(value);
- });
- this.isLoading = false;
- } else {
- this.simpanPenilaian("baru", false)
- }
- },
- (error) => {
- console.log('error', error);
- this.isLoading = false;
- }
- );
- }
- addRowPenilaian(dataRow?: any) {
- let penilaianForm: any;
- penilaianForm = this.formBuilder.group({
- id: [dataRow ? dataRow.id : 0],
- faktorPenilaian: [dataRow ? dataRow.faktorPenilaian : ''],
- kolPemeriksa: [dataRow ? dataRow.kolPemeriksa : ''],
- catatan: [dataRow ? dataRow.catatan : false]
- });
- this.listPenilaian.push(penilaianForm);
- this.rowsPenilaian = [];
- this.rowsPenilaian.push(penilaianForm.value);
- }
- simpanPenilaian(type: any, isKirim: boolean) {
- const dialogConfig = new MatDialogConfig();
- this.isLoading = true;
- let submitObservable: Observable<any> = null;
- const templateForm: any[] = [];
- if (type == "update") {
- this.listPenilaian.controls.forEach(value => {
- templateForm.push({
- id: value.get('id').value,
- pemeriksaanUtkreditNasabahID: this.id,
- kolPemeriksa: value.get('kolPemeriksa').value,
- catatan: value.get('catatan').value,
- faktorPenilaian: value.get('faktorPenilaian').value
- });
- });
- } else if (type == "baru") {
- templateForm.push({
- id: 0,
- pemeriksaanUtkreditNasabahID: this.id,
- kolPemeriksa: "1",
- catatan: "",
- faktorPenilaian: "Prospek Usaha"
- });
- templateForm.push({
- id: 0,
- pemeriksaanUtkreditNasabahID: this.id,
- kolPemeriksa: "1",
- catatan: "",
- faktorPenilaian: "Kinerja Debitur/Nasabah"
- });
- templateForm.push({
- id: 0,
- pemeriksaanUtkreditNasabahID: this.id,
- kolPemeriksa: "1",
- catatan: "",
- faktorPenilaian: "Kemampuan Membayar"
- });
- }
- submitObservable = this.kreditService.savePenilaian(templateForm);
- submitObservable.pipe(takeUntil(this.unsubs)).subscribe(res => {
- if (res) {
- if (type == "update") {
- if (!isKirim) {
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Save sukses',
- dialogText: res.detail,
- isLoading: false
- };
- const dialogRef = this.dialog.open(DialogInfoComponent, dialogConfig);
- } else {
- this.saveInformasiNasabah(true)
- }
- }
- this.isLoading = false;
- this.clearFormArrayPenilaian();
- this.getDataPenilaian();
- }
- }, error => {
- this.isLoading = false;
- if (type == "update") {
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Save gagal',
- dialogText: error.error.detail,
- isLoading: false
- };
- const dialogRef = this.dialog.open(DialogInfoComponent, dialogConfig);
- }
- console.log('error', error)
- });
- }
- getLastStatus() {
- this.kreditService.getNasabah(this.id).pipe(takeUntil(this.unsubs)).subscribe((res: any) => {
- if (res.data) {
- const status = res.data.status;
- if (status == 0 || status == 3)
- this.isSimpan = false;
- else if (status == 1 || status == 2)
- this.isSimpan = true;
- }
- })
- }
- submit() {
- if (this.summaryFormGroup.invalid || this.informasiNasabahFormGroup.invalid) {
- this.summaryForm.PlafonSummary.markAsTouched();
- this.summaryForm.BakiDebetSummary.markAsTouched();
- this.summaryForm.KolNasabahPemeriksaSummary.markAsTouched();
- this.summaryForm.PPAPemeriksaSummary.markAsTouched();
- this.summaryForm.CatatanPemeriksaSummary.markAsTouched();
- this.informasiNasabahForm.nasabahBergerakdiBidang.markAsTouched();
- this.informasiNasabahForm.mulaiBeroperasiSejak.markAsTouched();
- this.informasiNasabahForm.nasabahMenPembiayaanBankSejak.markAsTouched();
- this.informasiNasabahForm.denganPlafonAwal.markAsTouched();
- this.informasiNasabahForm.pernahMenRestrukturSebanyak.markAsTouched();
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Tidak Bisa Kirim',
- dialogText: 'Data harus dilengkapi terlebih dahulu',
- isLoading: false
- };
- const dialogRef = this.dialog.open(DialogComponent, dialogConfig);
- } else {
- this.simpanPenilaian("update", true)
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.width = '500px';
- dialogConfig.data = {
- title: "Kredit Tiga Pilar",
- function: "Add",
- masterPenugasanUtId: this.masterPenugasanUtId,
- idNasabah: this.id
- }
- const dialogRef = this.dialog.open(SubmitKreditTigaComponent, dialogConfig);
- dialogRef.afterClosed().pipe(takeUntil(this.unsubs)).subscribe(result => {
- console.log(`Dialog result: ${result}`);
- if (result.status == "success" || result.status == "fail") {
- dialogRef.close()
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: result.title,
- dialogText: result.message,
- isLoading: false
- };
- const dialogErr = this.dialog.open(DialogInfoComponent, dialogConfig);
- this.getLastStatus();
- this.getInfoNasabah();
- this.clearFormArrayPenilaian();
- this.getDataPenilaian();
- }
- });
- }
- }
- getInfoPemeriksa() {
- this.isLoading = true;
- this.pelaksanaanService.getPemeriksaanUt(this.pemeriksaanId).pipe(takeUntil(this.unsubs)).subscribe((res: any) => {
- if (res.data) {
- this.isLoading = false;
- this.bankName = res.data?.bankName;
- this.tanggalUt = res.data?.tanggalAwalPelaksanaan;
- this.listPemeriksaan = [
- { name: 'Nama Pemeriksa', value: res.data?.pemeriksa },
- { name: 'Nama Reviewer', value: res.data?.reviewer },
- { name: 'Posisi Pemeriksaan', value: res.data?.jenisPemeriksaanUT },
- { name: 'Tanggal', value: res.data?.posisiPemeriksaan },
- ]
- }
- },
- (error) => {
- console.log('error', error);
- this.isLoading = false;
- }
- );
- }
- getInfoNasabah() {
- this.kreditService.getNasabahSummaryTiga(this.id).pipe(takeUntil(this.unsubs)).subscribe((res: any) => {
- this.summaryForm.PlafonSummary.setValue(res.data?.plafonSummary);
- this.summaryForm.BakiDebetSummary.setValue(res.data?.bakiDebetSummary);
- this.summaryForm.KolNasabahPemeriksaSummary.setValue(res.data?.kolNasabahPemeriksaSummary);
- this.summaryForm.PPAPemeriksaSummary.setValue(res.data?.ppaPemeriksaSummary);
- this.summaryForm.CatatanPemeriksaSummary.setValue(res.data?.catatanPemeriksaSummary);
- this.summaryForm.PPABankSummary.setValue(res.data?.ppaBankSummary);
- this.summaryForm.KolNasabahBankSummary.setValue(res.data?.kolNasabahBankSummary);
- this.informasiNasabahForm.nasabahBergerakdiBidang.setValue(res.data?.nasabahBergerakdiBidang);
- this.informasiNasabahForm.mulaiBeroperasiSejak.setValue(res.data?.mulaiBeroperasiSejak);
- this.informasiNasabahForm.nasabahMenPembiayaanBankSejak.setValue(res.data?.nasabahMenPembiayaanBankSejak);
- this.informasiNasabahForm.denganPlafonAwal.setValue(res.data?.denganPlafonAwal);
- this.informasiNasabahForm.pernahMenRestrukturSebanyak.setValue(res.data?.pernahMenRestrukturSebanyak);
- this.listNasabah = [
- { name: 'Nama Nasabah', value: res.data?.namaNasabah },
- { name: 'Total Plafond', value: res.data?.totalPlafond },
- { name: 'Total Baki Debet', value: res.data?.totalBakiDebet },
- { name: 'Tunggakan Pokok', value: res.data?.tunggakanPokok },
- { name: 'Tunggakan Bunga/Margin/Bagi Hasil', value: res.data?.tunggakanBungaMarginBagiHasil },
- { name: 'DPD (hari)', value: res.data?.dpDhari },
- ]
- if (res.data != null && res.data?.plafonSummary != null && res.data?.bakiDebetSummary != null && res.data?.kolNasabahPemeriksaSummary != null &&
- res.data?.ppaPemeriksaSummary != null && res.data?.catatanPemeriksaSummary != null) {
- this.summaryForm.PlafonSummary.disable();
- this.summaryForm.BakiDebetSummary.disable();
- this.summaryForm.KolNasabahPemeriksaSummary.disable();
- this.summaryForm.PPAPemeriksaSummary.disable();
- this.summaryForm.CatatanPemeriksaSummary.disable();
- this.isSummarySaved = true;
- }
- })
- }
- updateDate(date) {
- if (date) {
- date.setDate(date.getDate() + 1);
- }
- return date;
- }
- saveInformasiNasabah(isKirim: boolean) {
- if (this.informasiNasabahFormGroup.invalid) {
- this.informasiNasabahForm.nasabahBergerakdiBidang.markAsTouched();
- this.informasiNasabahForm.mulaiBeroperasiSejak.markAsTouched();
- this.informasiNasabahForm.nasabahMenPembiayaanBankSejak.markAsTouched();
- this.informasiNasabahForm.denganPlafonAwal.markAsTouched();
- this.informasiNasabahForm.pernahMenRestrukturSebanyak.markAsTouched();
- } else {
- const requestBody = {
- id: this.id,
- masterPenugasanUtId: this.masterPenugasanUtId,
- nasabahBergerakdiBidang: this.informasiNasabahForm.nasabahBergerakdiBidang.value,
- mulaiBeroperasiSejak: this.informasiNasabahForm.mulaiBeroperasiSejak.value,
- nasabahMenPembiayaanBankSejak: this.updateDate(new Date(this.informasiNasabahForm.nasabahMenPembiayaanBankSejak.value)),
- denganPlafonAwal: this.informasiNasabahForm.denganPlafonAwal.value,
- pernahMenRestrukturSebanyak: this.informasiNasabahForm.pernahMenRestrukturSebanyak.value
- }
- const dialogConfig = new MatDialogConfig();
- this.kreditService.saveInfoNasabahTiga(requestBody).pipe(takeUntil(this.unsubs)).subscribe((res) => {
- if (!isKirim) {
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Simpan Berhasil',
- dialogText: 'Berhasil Simpan Data',
- isLoading: false
- };
- const dialogRef = this.dialog.open(DialogInfoComponent, dialogConfig);
- this.getInfoNasabah();
- } else {
- this.saveSummary(true);
- }
- },
- (error) => {
- console.log('error', error);
- if (!isKirim) {
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Simpan Gagal',
- dialogText: error.error.detail,
- isLoading: false
- };
- const dialogRef = this.dialog.open(DialogInfoComponent, dialogConfig);
- }
- })
- }
- }
- saveSummary(isKirim: boolean) {
- if (this.summaryFormGroup.invalid) {
- this.summaryForm.PlafonSummary.markAsTouched();
- this.summaryForm.BakiDebetSummary.markAsTouched();
- this.summaryForm.KolNasabahPemeriksaSummary.markAsTouched();
- this.summaryForm.PPAPemeriksaSummary.markAsTouched();
- this.summaryForm.CatatanPemeriksaSummary.markAsTouched();
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Data Kosong',
- dialogText: 'Data Summary tidak boleh kosong',
- isLoading: false
- };
- const dialogRef = this.dialog.open(DialogComponent, dialogConfig);
- } else {
- const requestBody = {
- pemeriksaanUTKreditNasabahId: this.id,
- plafon: this.summaryForm.PlafonSummary.value,
- bakiDebet: this.summaryForm.BakiDebetSummary.value,
- kolNasabahPemeriksa: this.summaryForm.KolNasabahPemeriksaSummary.value,
- ppaPemeriksa: this.summaryForm.PPAPemeriksaSummary.value,
- catatan: this.summaryForm.CatatanPemeriksaSummary.value,
- }
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.data = {
- dialogTitle: 'Loading',
- dialogText: 'Silahkan menunggu...',
- isLoading: true
- };
- const dialogRef = this.dialog.open(DialogComponent, dialogConfig);
- this.kreditService.saveAnalisisTiga(requestBody).pipe(takeUntil(this.unsubs)).subscribe((res) => {
- dialogRef.close();
- if (!isKirim) {
- const dialogConfigError = new MatDialogConfig();
- dialogConfigError.disableClose = true;
- dialogConfigError.data = {
- dialogTitle: 'Simpan Berhasil',
- dialogText: 'Berhasil Simpan Data',
- isLoading: false
- };
- this.getInfoNasabah();
- }
- this.summaryForm.PlafonSummary.disable();
- this.summaryForm.BakiDebetSummary.disable();
- this.summaryForm.KolNasabahPemeriksaSummary.disable();
- this.summaryForm.PPAPemeriksaSummary.disable();
- this.summaryForm.CatatanPemeriksaSummary.disable();
- this.isSummarySaved = true;
- },
- (error) => {
- console.log('error', error);
- const dialogConfigError = new MatDialogConfig();
- dialogRef.close();
- dialogConfigError.disableClose = true;
- dialogConfigError.data = {
- dialogTitle: 'Simpan Gagal',
- dialogText: error.error.detail,
- isLoading: false
- };
- const dialogErr = this.dialog.open(DialogInfoComponent, dialogConfigError);
- })
- }
- }
- editSummary() {
- this.isSummarySaved = false;
- this.summaryForm.PlafonSummary.enable();
- this.summaryForm.BakiDebetSummary.enable();
- this.summaryForm.KolNasabahPemeriksaSummary.enable();
- this.summaryForm.PPAPemeriksaSummary.enable();
- this.summaryForm.CatatanPemeriksaSummary.enable();
- }
- getInformasiAgunan(param: TableRequest) {
- let TotalNilaiAgunan = '0'
- let TotalPPA = '0'
- this.isLoading = true;
- const index = this.index ? this.index : 0;
- const formData = new FormData();
- formData.append('start', param.start.toString());
- formData.append('length', param.length.toString());
- formData.append('search[value]', this.search ? this.search.toString() : '');
- formData.append('search[regex]', 'false');
- formData.append('columns[' + index + '][data]', index + 1);
- formData.append('columns[' + index + '][orderable]', 'true');
- formData.append('columns[' + index + '][searchable]', 'true');
- formData.append('columns[' + index + '][name]', this.sortField);
- formData.append('order[0][column]', index + 1);
- formData.append('order[0][dir]', this.sort ? this.sort : 'desc');
- this.kreditService.postListAgunanTiga(this.id, formData)
- .pipe(takeUntil(this.unsubs))
- .subscribe((res: any) => {
- if (res.data.data) {
- this.rowsInformasiAgunan = res.data.data;
- this.recordsTotal = res.data.recordsTotal;
- this.rowsInformasiAgunan.map((item) => {
- TotalNilaiAgunan += item.nilaiAgunanYgDiAkui.toString();
- TotalPPA += item.agunanPengurangPPA.toString();
- console.log('totalPPA',item.agunanPengurangPPA.toString())
- });
- this.totalNilaiagunan = TotalNilaiAgunan
- this.totalPPA = TotalPPA
- this.colsName = res.data.colsName.split(', ');
- this.checkUncheckAll(false)
- this.isLoading = false;
- } else {
- this.rowsInformasiAgunan = [];
- this.isLoading = false;
- }
- },
- (err) => {
- console.log('error : ', err);
- });
- }
- getDataTable(param: TableRequest) {
- // this.isLoading = true;
- // const index = this.index ? this.index : 0;
- // const formData = new FormData();
- // // formData.append('filter[bank]', this.kodeBank ? this.kodeBank: '');
- // // formData.append('filter[status]', this.idStatus ? this.idStatus: '');
- // // formData.append('filter[from]', this.tanggalAwal ? new Date(this.tanggalAwal).toDateString() : '');
- // // formData.append('filter[to]', this.tanggalAkhir ? new Date(this.tanggalAkhir).toDateString() : '');
- // formData.append('start', param.start.toString());
- // formData.append('length', param.length.toString());
- // formData.append('search[value]', this.search ? this.search.toString() : '');
- // formData.append('search[regex]', 'false');
- // formData.append('columns[' + index + '][data]', index + 1);
- // formData.append('columns[' + index + '][orderable]', 'true');
- // formData.append('columns[' + index + '][searchable]', 'true');
- // formData.append('columns[' + index + '][name]', this.sortField);
- // formData.append('order[0][column]', index + 1);
- // formData.append('order[0][dir]', this.sort ? this.sort : 'desc');
- // console.log('id : ', this.id);
- // this.ujituntasService.postDataWithToken(pelaksanaan.listBap + '?masterPenugasanUtId=' + this.id, formData, this.token, null).subscribe((res: any) => {
- // this.recordsTotal = res.data.recordsFiltered as number;
- // this.colsName = res.data.colsName.split(', ');
- // console.log('data : ', res.data.data);
- // // res.data.data.map(item => {
- // // item.bankId = item.masterPenugasanUt.detailPenugasan.bankId
- // // item.id = item.id
- // // item.masterPenugasanUtid = item.masterPenugasanUt?.detailPenugasan?.id
- // // item.name = item.masterJenisPemeriksaanUt?.name
- // // item.bankName = item.masterPenugasanUt?.detailPenugasan?.bankName
- // // item.tanggalAwalPelaksanaan = item.masterPenugasanUt?.detailPenugasan?.tanggalAwalPelaksanaan
- // // item.tanggalAkhirPelaksanaan = item.masterPenugasanUt?.detailPenugasan?.tanggalAkhirPelaksanaan
- // // item.nomorSuratTugas = item.masterPenugasanUt?.detailPenugasan?.nomorSuratTugas
- // // })
- // this.rows = res.data.data;
- // this.isLoading = false;
- // },
- // (err: any) => {
- // console.log('error', err);
- // this.isLoading = false;
- // this.snackbar.open('Opsss.. ' + err.name, 'Error', {
- // duration: 10000,
- // });
- // });
- }
- tambahInfoAgunan() {
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.width = '1200px';
- dialogConfig.data = {
- function: 'Add',
- pemeriksaanUtkreditNasabahId: this.id,
- };
- const dialogRef = this.dialog.open(TambahKreditTigaComponent, dialogConfig);
- dialogRef.afterClosed().pipe(takeUntil(this.unsubs)).subscribe(result => {
- console.log(`Dialog result: ${result}`);
- if (result == true) {
- console.log('huhuhu')
- this.getInformasiAgunan(this.paramRequest);
- }
- });
- }
- editInfoAgunan(id: any) {
- const index = this.rowsInformasiAgunan.findIndex(item => item['id'] === id);
- const modelData = this.rowsInformasiAgunan[index];
- // console.log(id, modelData);
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.width = '1200px';
- dialogConfig.data = {
- function: 'Edit',
- pemeriksaanUtkreditNasabahId: this.id,
- modelData: modelData,
- };
- const dialogRef = this.dialog.open(TambahKreditTigaComponent, dialogConfig);
- dialogRef.afterClosed().pipe(takeUntil(this.unsubs)).subscribe(result => {
- console.log(`Dialog result: ${result}`);
- if (result == true) {
- this.getInformasiAgunan(this.paramRequest);
- }
- });
- }
- upload(data) {
- const dialogConfig = new MatDialogConfig();
- dialogConfig.disableClose = true;
- dialogConfig.width = '900px';
- dialogConfig.data = {
- id: data.id,
- faktorPenilaian: data.faktorPenilaian,
- bankName: this.bankName,
- tanggalUt: this.tanggalUt
- }
- const dialogRef = this.dialog.open(UploadKreditTigaComponent, dialogConfig);
- }
- getDummyData() {
- this.rows = [
- { id: 'id' },
- ];
- this.rowsKualitasPembiayaan = [
- { kualitasPembiayaan: 'Prospek Usaha', pemeriksa: '3' },
- { kualitasPembiayaan: 'Kinerja Debitur/Nasabah', pemeriksa: '3' },
- { kualitasPembiayaan: 'Kemampuan Membayar', pemeriksa: '2' },
- ];
- // this.listPemeriksaan = [
- // { name: 'Nama Pemeriksa', value: 'Rahmad Sanjaya' },
- // { name: 'Nama Reviewer', value: 'Muh Arief Radul Fiqri' },
- // { name: 'Posisi Pemeriksaan', value: 'Uji Tuntas' },
- // { name: 'Tanggal', value: '03 Mar 2022' },
- // ]
- this.listNasabah = [
- { name: 'Nama Nasabah', value: 'Abd Khadir' },
- { name: 'Total Plafond', value: '1000000' },
- { name: 'Total Baki Debet', value: '1000000' },
- { name: 'Tunggakan Pokok', value: '0' },
- { name: 'Tunggakan Bunga/Margin/Bagi Hasil', value: '0' },
- { name: 'DPD (hari)', value: '0' },
- ]
- }
- sortPage(page: any) {
- let sortField = page.sortField.toLowerCase();
- this.index = this.colsName?.findIndex(item => item == sortField);
- this.sort = page?.sortOrder === 1 ? 'asc' : 'desc';
- this.sortField = sortField ? sortField : 'id';
- }
- updatePage(event: any) {
- if (event && event.sortField && event.sortOrder) {
- this.sortPage(event);
- }
- this.paramRequest = {
- start: event.first / event.rows,
- length: event.rows,
- };
- this.getInformasiAgunan(this.paramRequest);
- }
- deleteAgunan() {
- const dialogConfigError = new MatDialogConfig();
- this.isLoading = true
- this.kreditService.postDeleteAgunanTiga(this.id, this.isCheckedAll, this.tampungArraySelected).pipe(takeUntil(this.unsubs)).subscribe((res: any) => {
- if (res.status === 200) {
- this.isLoading = false;
- dialogConfigError.disableClose = true;
- dialogConfigError.data = {
- dialogTitle: 'Hapus',
- dialogText: 'Data Berhasil Di Hapus',
- isLoading: false
- };
- const dialogErr = this.dialog.open(DialogInfoComponent, dialogConfigError);
- this.tampungArraySelected = []
- this.getInformasiAgunan(this.paramRequest);
- }
- (err: any) => {
- this.isLoading = true
- console.log('error', err);
- dialogConfigError.disableClose = true;
- dialogConfigError.data = {
- dialogTitle: 'Hapus',
- dialogText: err.err.detail,
- isLoading: false
- };
- const dialogErr = this.dialog.open(DialogInfoComponent, dialogConfigError);
- }
- },
- )
- }
- checkboxSelected(event: any, objectValue: any) {
- if (event.checked) {
- if (this.rows.find((res) => res.id === objectValue.id) === undefined) {
- if (this.isCheckedAll) {
- var index = this.tampungArraySelected.indexOf(objectValue);
- if (index !== -1) {
- this.tampungArraySelected.splice(index, 1);
- }
- } else {
- this.tampungArraySelected.push(
- objectValue
- )
- }
- }
- } else {
- if (this.isCheckedAll) {
- this.tampungArraySelected.push(
- objectValue
- )
- } else {
- var index = this.tampungArraySelected.indexOf(objectValue);
- if (index !== -1) {
- this.tampungArraySelected.splice(index, 1);
- }
- }
- }
- }
- checkUncheckAll(clearArray: boolean) {
- this.isCheckedAll = this.fc.isCheckedAll.value;
- if (clearArray)
- this.tampungArraySelected = []
- this.rowsInformasiAgunan.map(items => {
- items.sampling = this.isCheckedAll;
- if (this.tampungArraySelected.length > 0) {
- if (this.isCheckedAll) {
- var index = this.tampungArraySelected.indexOf(items.id);
- if (index !== -1) {
- items.sampling = false;
- }
- } else {
- var index = this.tampungArraySelected.indexOf(items.id);
- if (index !== -1) {
- items.sampling = true;
- }
- }
- }
- })
- }
- ngOnDestroy(): void {
- this.unsubs.next()
- this.unsubs.complete()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement