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

149 lines
5.0 KiB
JavaScript

/*******************************************************************
Module : /apps/js/sys/operator.js
Desc. : JS - Manajemen Data Pengguna
Created By : Siau Pheng ([email protected]).
Created Date : March 12th, 2008.
Last Modified : July 14th, 2020.
(c) 2008 - 2020, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var TFraksiJS = {
PHP: '',
KODE: '',
loading: function(){
this.data_query('detail');
$('#Cari_Fraksi').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_Fraksi').val('');
this.data_query('detail');
}.bind(this));
FoniaJS.setFocus('#Cari_Fraksi');
},
detail_show: function(mode, UserID){
new Request({
url: this.PHP,
sendParam: ['data=user-detail','mode='+mode,'UserID='+UserID],
onSuccess: function(txt){
this.winDetail = FoniaJS.showWindow('Detail', 'Informasi Pengguna Fraksi', txt, 500, '_,WK,WS', function(){
$('#winDetail').find('#butWSave').click(function(){this.detail_check();}.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 ["+acell[1]+"] "+acell[2]+"?", function(){
new Request.JSON({
url: this.PHP,
sendParam: ['data=save','mode=del','UserID='+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_check: function(){
if ($('#Username').val().toUpperCase()==$('#UserLama').val().toUpperCase()) {
this.detail_save();
return;
}
new Request.JSON({
url: this.PHP,
sendParam: ['data=user-check','Username'],
onSuccess: function(adata){
if (adata.ada==true) {
FoniaJS.showInfo("ID Pengguna telah ada dalam sistem !");
} else {
this.detail_save();
}
}.bind(this)
}).send();
},
detail_save: function(){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=save','mode','UserID','Username','Nama','Posisi','Password','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();
},
dewan_show: function(acell){
new Request({
url: this.PHP,
sendParam: ['data=dewan','UserID='+acell[0]],
onSuccess: function(txt){
this.winDPRD = FoniaJS.showWindow('DPRD', 'Daftar Anggota Dewan', txt, 600, '_,WK,WS', function(){
$('#winDPRD').find('#butWSave').click(function(){this.dewan_simpan();}.bind(this));
}.bind(this));
}.bind(this)
}).send();
},
dewan_simpan: function(){
var hasil = '';
$('#tabDPRDList :input').each(function(e){
if (this.type=='checkbox' && this.id.indexOf('xDPRD')!==-1 && this.checked) {
hasil += $(this).val() + ',';
}
});
new Request.JSONF({
url: this.PHP,
sendParam: ['data=save-dewan','UserID','AK_DPRD='+hasil],
onSuccess: function(adata){
if (adata.status==true){
FoniaJS.showInfo('Proses simpan data sukses!');
}else{
FoniaJS.showInfo('Ada masalah dalam proses simpan data!');
}
FoniaJS.closeWindow(this.winDPRD);
}.bind(this)
}).send();
},
data_query: function(tipe, mode){
if (tipe=="detail"){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=detail','Cari_Fraksi']
}).send()
}
},
oc_Level: function(){
}
};