Files
master/apps/js/tab/opd.js
T
2026-07-16 14:07:54 +07:00

97 lines
3.3 KiB
JavaScript

/*******************************************************************
App. Name : SISTEM INFORMASI PERENCANAAN PEMBANGUNAN DAERAH
Module : /apps/js/tab/opd.js
Desc. : JS - Tabel Master OPD
Created By : Siau Pheng ([email protected]).
Created Date : December 7th, 2010.
Last Modified : February 21st, 2023.
(c) 2012 - 2023, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var TOPDJS = {
PHP: '',
KODE: '',
loading: function(){
this.data_query('detail');
$('#Cari_OPD').keydown(function(e){
var key = e.keyCode || e.which || 0;
if (key==13 && e.target.value!='') this.data_query('detail');
}.bind(this));
$('#butSearch').click(function(e){
this.data_query('detail');
}.bind(this));
$('#butAll').click(function(){
$('#Cari_OPD').val('');
this.data_query('detail');
}.bind(this));
FoniaJS.setFocus('#Cari_OPD');
},
detail_show: function(mode, ID){
new Request({
url: this.PHP,
sendParam: ['data=opd-detail','mode='+mode,'OPDID='+ID],
onSuccess: (txt) => {
this.winDetail = FoniaJS.showWindow('Detail', 'Detail OPD', txt, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winDetail').find('#butWSimpan').click(() => this.detail_save());
});
}
}).send();
},
detail_tambah: function(){
this.detail_show('add', 0);
},
detail_ubah: function(acell){
this.detail_show('edit', acell[0]);
},
detail_hapus: function(acell){
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', function(){
new Request.JSON({
url: this.PHP,
sendParam: ['data=save','mode=del','OPDID='+acell[0]],
onSuccess: function(adata){
if (adata.status==true){
this.data_query('detail');
FoniaJS.showInfo('Proses hapus data sukses!');
}else{
FoniaJS.showInfo('Ada masalah dalam proses hapus data!');
}
}.bind(this)
}).send();
}.bind(this), 'danger');
},
detail_save: function(){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=save','mode','OPDID','K_Bidu1','K_Bidu2','K_Bidu3','U_Bidu','N_OPD','S_OPD','N_Lokasi','SidangID','ForumID','IV','IK','P_NIP','P_Nama','P_Jabatan','P_Pangkat','B_NIP','B_Nama','Aktif'],
onSuccess: function(adata){
if (adata.status==true){
this.data_query('detail');
FoniaJS.showInfo('Proses simpan data sukses!');
}else{
FoniaJS.showInfo('Ada masalah dalam proses simpan data!');
}
FoniaJS.closeWindow(this.winDetail);
}.bind(this)
}).send();
},
data_query: function(tipe, mode){
if (tipe=="detail"){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=detail','Cari_OPD']
}).send();
}
}
};