Files
ias/apps/js/tab/pegawai.js
T
2026-01-22 15:30:17 +07:00

97 lines
3.2 KiB
JavaScript

/*******************************************************************
App. Name : Inventory Advanced Systems
Module : /apps/js/tab/pegawai.js
Desc. : JS - Tabel Master Pegawai
Created By : Siau Pheng ([email protected]).
Created Date : December 7th, 2010.
Last Modified : March 20th, 2023.
(c) 2010 - 2013, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var PegawaiJS = {
PHP: '',
KODE: '',
loading: function(){
this.data_query('detail');
$('#Cari_Peg').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_Peg').val('');
this.data_query('detail');
}.bind(this));
FoniaJS.setFocus('#Cari_Peg');
},
detail_show: function(mode, ID){
new Request({
url: this.PHP,
sendParam: ['data=pegawai-detail','mode='+mode,'PegID='+ID],
onSuccess: function(txt){
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Pegawai', txt, 600, [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], function(){
$('#winDetail').find('#butWSimpan').click(function(){this.detail_save();}.bind(this));
}.bind(this));
}.bind(this)
}).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','PegID='+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.JSON({
url: this.PHP,
sendParam: ['data=save','mode','PegID','Jenis_PegID','Kode_Pegawai','Nama_Pegawai','Alamat_Pegawai','Telp_Pegawai','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_Peg']
}).send();
}
}
};