/******************************************************************* App. Name : SISTEM INFORMASI MONITORING DAN EVALUASI Module : /apps/js/valid/kinerja.js Desc. : JS - Validasi Realisasi Kinerja OPD Created By : Siau Pheng (siaupheng@3fonia.com). Created Date : December 7th, 2011. Last Modified : September 7th, 2026. (c) 2011 - 2026, 3FONIA Software; WWW.3FONIA.COM. *******************************************************************/ var ValidKinerjaJS = { PHP: '', KODE: '', loading: function(){ $('#butOPD').click(() => { if ($('#OPDID').val()>0) this.show_hide(1); }); $('#butPROG').click(() => { if ($('#ProgID').val()>0) this.show_hide(2); }); $('#butKEG').click(() => { if ($('#KegID').val()>0) this.show_hide(3); }); this.show_hide(1); }, show_hide: function(no){ $('#divOPD').addClass('d-none'); $('#butOPD').removeClass('btn-secondary').addClass('btn-info'); $('#divPROG').addClass('d-none'); $('#butPROG').removeClass('btn-secondary').addClass('btn-info'); $('#divKEG').addClass('d-none'); $('#butKEG').removeClass('btn-secondary').addClass('btn-info'); $('#divSUB').addClass('d-none'); if (no == 1) { $('#OPDID').val(0); $('#ORGID').val(0); $('#Nama_OPD').val(''); $('#Hak_Bln').val(1); $('#Hak_Tw').val(1); } if (no <= 1) { $('#ProgID').val(0); $('#Nama_PROG').val(''); $('#butOPD').removeClass('btn-info').addClass('btn-secondary'); } if (no <= 2) { $('#KegID').val(0); $('#Nama_KEG').val(''); $('#butPROG').removeClass('btn-info').addClass('btn-secondary'); } if (no <= 3) { $('#butKEG').removeClass('btn-info').addClass('btn-secondary'); } if (no == 1) { $('#divOPD').removeClass('d-none'); this.data_query('tabel-opd'); } if (no == 2) { $('#divPROG').removeClass('d-none'); this.data_query('tabel-prog'); } if (no == 3) { $('#divKEG').removeClass('d-none'); this.data_query('tabel-keg'); } if (no == 4) { $('#divSUB').removeClass('d-none'); this.data_query('tabel-sub'); } }, opd_select: function(acell){ $('#OPDID').val(acell[0]); $('#ORGID').val(acell[1]); $('#Nama_OPD').val(acell[2]); $('#Hak_Bln').val(acell[3]); $('#Hak_Tw').val(acell[4]); this.show_hide(2); }, prog_select: function(acell){ $('#ProgID').val(acell[1]); $('#Nama_PROG').val(acell[2]); this.show_hide(3); }, prog_real: function(acell){ $('#ProgID').val(acell[1]); new Request({ url: this.PHP, sendParam: ['data=detail-prog','Hak_Tw','ORGID','OPDID','ProgID','DPAProgID='+acell[0]], onSuccess: (txt) => { const tombol = [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}]; if ($('#Hak_Tw').val()==0) tombol.pop(); this.winProg = FoniaJS.showWindow('Prog', 'Detail Capaian Program', txt, 'xl', tombol, () => { $('#winProg').find('#butWSimpan').click(() => this.prog_save()); }); } }).send(); }, prog_save: function(){ var _param = ['data=tabel-prog','mode_detail=update','Hak_Tw','ORGID','OPDID','ProgID','DPAProgID']; $(':input[id^="B_Catat_TW_"]').each((i,e) => { _param.push(e.id); }); new Request.JSONF({ url: this.PHP, sendParam: _param, onSuccess: () => { FoniaJS.closeWindow(this.winProg); FoniaJS.showInfo('Sukses menyimpan Capaian Program.'); } }).send(); }, keg_select: function(acell){ $('#KegID').val(acell[1]); $('#Nama_KEG').val(acell[2]); this.show_hide(4); }, /*sub_select: function(acell){ $('#SubID').val(acell[1]); $('#Nama_SUB').val(acell[2]); this.show_hide(5); },*/ sub_ubah: function(acell){ $('#SubID').val(acell[1]); new Request({ url: this.PHP, sendParam: ['data=detail-sub','Hak_Bln','ORGID','OPDID','ProgID','KegID','SubID='+acell[1],'DPASubID='+acell[0]], onSuccess: (txt) => { this.winDSub = FoniaJS.showWindow('DSub', 'Kinerja dan Informasi Sub Kegiatan', txt, 'xl', '', () => { this.data_query('tabel-eviden'); }); } }).send(); }, sub_save: function(){ var _kosong = 0; var _evi = $('#Real_TW').val(); if (_evi && _evi.trim() !== '' && parseFloat(_evi) > 0) { var _dok = $('#LabelEviden1'); _dok.removeClass("btn-outline-success btn-outline-danger") if (parseInt($('#Eviden_TW').val()) === 0) { _kosong++; _dok.addClass("btn-outline-danger"); } else { _dok.addClass("btn-outline-success") } var _catat = $('#Real_Catatan'); _catat.removeClass("is-valid is-invalid") if (_catat.val() === '') { _kosong++; _catat.addClass("is-invalid").focus(); } else { _catat.addClass("is-valid") } } if (_kosong > 0) { FoniaJS.showError('Tolong lengkapi Eviden / Catatan.'); return false; } var _param = ['data=tabel-sub','Hak_Bln','ORGID','OPDID','ProgID','KegID','SubID','DPASubID','Real_Catatan','Real_No_Kontrak','Real_Pelaksana','DPASubOutputID','Real_TW','mode_detail=update']; new Request.JSONF({ url: this.PHP, sendParam: _param, onSuccess: () => { FoniaJS.closeWindow(this.winDSub); FoniaJS.showInfo('Sukses menyimpan Kinerja Sub Kegiatan.'); } }).send(); }, eviden_form: function(acell, div){ new Request.JSON({ url: this.PHP, sendParam: ['data=detail-eviden','Hak_Bln','ORGID','OPDID','DPAEvidenID='+acell[0]], onSuccess: (adata) => { $(div).html(adata.html); $(div) .find('#butSimpanEviden').click(() => this.eviden_save()).end() .find('#butBatalEviden').click(() => this.eviden_batal()); } }).send(); }, eviden_batal: function(){ var dt = $('#tabelEviden').DataTable(), tr, l_row; tr = $('#butBatalEviden').closest('tr'); l_row = dt.row(tr.prev('tr')); if (l_row.child.isShown()) l_row.nodes().to$().find('.fon-tabel-dt').click(); if (l_row.data()[0]=='0') l_row.remove().draw(true); }, eviden_save: function(){ if ($('#B_Catatan').val() == ''){ FoniaJS.showInfo('Mohon lengkapi Catatan & Status Validasi !'); return false; } new Request.JSONF({ url: this.PHP, sendParam: ['data=tabel-eviden','mode_detail=update','Hak_Bln','ORGID','OPDID','DPAEvidenID','B_Catatan','B_Valid'], onSuccess: () => FoniaJS.showInfo('Sukses menyimpan Validasi Eviden.') }).send(); }, eviden_open_doc: function(nfile){ FoniaJS.showConfirm('Konfirmasi', 'Yakin akan buka file Dokumen ?', () => { window.open(nfile); }, 'info'); }, eviden_open_pdf: function(nfile){ var dpdf = new cPDF(nfile); dpdf.set_zoom(100); dpdf.showPDF(); }, data_query: function(tipe, mode){ if (tipe=="tabel-opd"){ new Request.JSONF({ url: this.PHP, sendParam: ['data=tabel-opd'] }).send(); } else if (tipe=="tabel-prog"){ new Request.JSONF({ url: this.PHP, sendParam: ['data=tabel-prog','Hak_Tw','ORGID','OPDID'] }).send(); } else if (tipe=="tabel-keg"){ new Request.JSONF({ url: this.PHP, sendParam: ['data=tabel-keg','Hak_Bln','ORGID','OPDID','ProgID'] }).send(); } else if (tipe=="tabel-sub"){ new Request.JSONF({ url: this.PHP, sendParam: ['data=tabel-sub','Hak_Bln','ORGID','OPDID','ProgID','KegID'] }).send(); } else if (tipe=="tabel-eviden"){ new Request.JSON({ url: this.PHP, sendParam: ['data=tabel-eviden','Hak_Bln','ORGID','OPDID','ProgID','KegID','SubID','DPASubID'], onSuccess: (ajson) => { var opsi = { responsive: true, columnDefs: [{responsivePriority:1,targets:0}, {responsivePriority:2,targets:-1}, {orderable:false,targets:-1}], dom: 'r<"row"<"col-sm-12"t>><"row"<"col-sm-12 col-md-6"<"toolbar">><"col-sm-12 col-md-6"p>>', autoWidth: false, processing: true, searching: false }; opsi.drawCallback = function(){ $('#tabelEviden tbody').on('click', '.fon-tabel-dt', (e) => { var tr = $(e.currentTarget).closest('tr'); var row = otabel.row(tr); if (row.child.isShown()){ row.child.hide(); tr.removeClass('shown'); }else{ if (otabel.row('.shown').length){ $('.fon-tabel-dt', otabel.row('.shown').node()).click(); } var _dt_id = $('
'); row.child(_dt_id).show(); tr.addClass('shown'); ValidKinerjaJS.eviden_form(row.data(), _dt_id); } }); $('#tabelEviden tbody').on('click', 'td.dtr-control', (e) => { var tr = $(e.currentTarget).closest('tr'); var row = otabel.row(tr); if (row.child.isShown()){ row.child.hide(); tr.removeClass('dt-hasChild parent'); }else{ var ind = 0; var tampil = '