188 lines
6.8 KiB
JavaScript
188 lines
6.8 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/System/OperatorController
|
|
Description : Data Pengguna
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : August 1st, 2008.
|
|
Last Modified : August 27th, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var OperatorJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index: function(){
|
|
this.data_query('detail');
|
|
$('#Cari_User').keydown((e) => {
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('detail');
|
|
});
|
|
$('#butSearch').click((e) => this.data_query('detail'));
|
|
$('#butAll').click(() => {
|
|
$('#Cari_User').val('');
|
|
this.data_query('detail');
|
|
});
|
|
$('#butFilter').click(() => this.filter_show());
|
|
FoniaJS.setFocus('#Cari_User');
|
|
},
|
|
|
|
filter_show: function(){
|
|
new Request({
|
|
url: this.PHP + '/detail_filter',
|
|
sendParam: ['Filter_Level'],
|
|
onSuccess: (ajson) => {
|
|
this.winFilter = FoniaJS.showWindow('FLevel', 'Filter Data Pengguna / Level', ajson.html, 400, [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
|
$('#winFLevel')
|
|
.find('#butWSimpan').click(() => this.filter_simpan()).end()
|
|
.find('#Fi_Level').focus();
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
filter_simpan: function(){
|
|
$('#Filter_Level').val($('#Fi_Level').val());
|
|
FoniaJS.closeWindow(this.winFilter);
|
|
this.data_query('detail');
|
|
},
|
|
|
|
detail_show: function(mode, UserID){
|
|
new Request({
|
|
url: this.PHP + '/detail_user',
|
|
sendParam: ['mode='+mode,'UserID='+UserID],
|
|
onSuccess: (ajson) => {
|
|
this.winDetail = FoniaJS.showWindow('Detail', 'Informasi Pengguna', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
|
$('#winDetail').find('#butWSimpan').click(() => this.detail_check());
|
|
this.oc_Level();
|
|
});
|
|
}
|
|
}).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]+"?", () => {
|
|
new Request({
|
|
url: this.PHP + '/save_user',
|
|
sendParam: ['mode=del','UserID='+acell[0]],
|
|
onSuccess: (adata) => {
|
|
if (adata.status==true){
|
|
this.data_query('detail');
|
|
FoniaJS.showInfo('Proses hapus data sukses!');
|
|
}else{
|
|
FoniaJS.showInfo('Ada masalah dalam proses hapus data!');
|
|
}
|
|
}
|
|
}).send();
|
|
}, 'danger');
|
|
},
|
|
|
|
detail_check: function(){
|
|
if ($('#Username').val().toUpperCase()==$('#UserLama').val().toUpperCase()) {
|
|
this.detail_save();
|
|
return;
|
|
}
|
|
new Request({
|
|
url: this.PHP + '/check_user',
|
|
sendParam: ['Username'],
|
|
onSuccess: (adata) => {
|
|
if (adata.ada==true) {
|
|
FoniaJS.showInfo("Username telah ada dalam sistem !");
|
|
} else {
|
|
this.detail_save();
|
|
}
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
detail_save: function(){
|
|
new Request({
|
|
url: this.PHP + '/save_user',
|
|
sendParam: ['mode','UserID','Username','Nama','Posisi','Level','Password','Grup_MenuID','Aktif'],
|
|
onSuccess: (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);
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
menu_show: function(acell){
|
|
new Request({
|
|
url: this.PHP + '/detail_menu',
|
|
sendParam: ['UserID='+acell[0]],
|
|
onSuccess: (ajson) => {
|
|
this.winMenu = FoniaJS.showWindow('Menu', 'Hak Akses Modul', ajson.html, 'lg', [{i:'butWSelAll',v:'Pilih Semua',c:'info'},{i:'butWClrAll',v:'Hapus Semua',c:'info'},{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
|
$('#winMenu')
|
|
.find('#butWSelAll').click(() => this.menu_ceksemua()).end()
|
|
.find('#butWClrAll').click(() => this.menu_hapussemua()).end()
|
|
.find('#butWSimpan').click(() => this.menu_simpan()).end()
|
|
.find('#tabMenuList thead input[type="checkbox"]:disabled').prop('indeterminate', true).end()
|
|
.find('#tabMenuList input.form-check-input[class*=cek-modul][type=checkbox]').each((i, el) => {
|
|
const elm = $(el);
|
|
elm.on('change', () => {
|
|
$('#tabMenuList tbody input.form-check-input[class*='+elm.attr('omodul')+'][type=checkbox]').map((i, b) => {
|
|
$(b).prop('checked', elm.is(':checked'));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
menu_ceksemua: function(){
|
|
$('#tabMenuList input.form-check-input[type=checkbox]:not(:disabled)').prop('checked', true);
|
|
},
|
|
|
|
menu_hapussemua: function(){
|
|
$('#tabMenuList input.form-check-input[type=checkbox]:not(:disabled)').prop('checked', false);
|
|
},
|
|
|
|
menu_simpan: function(){
|
|
var alist = [];
|
|
$('#tabMenuList tbody input.form-check-input[type=checkbox]:not(:disabled):checked').map((i, b) => {
|
|
alist.push($(b).val());
|
|
});
|
|
new Request({
|
|
url: this.PHP + '/save_menu',
|
|
sendParam: ['UserID','Menu='+alist],
|
|
onSuccess: (adata) => {
|
|
if (adata.status==true){
|
|
FoniaJS.showInfo('Proses simpan data sukses!');
|
|
}else{
|
|
FoniaJS.showInfo('Ada masalah dalam proses simpan data!');
|
|
}
|
|
FoniaJS.closeWindow(this.winMenu);
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
data_query: function(tipe, mode){
|
|
if (tipe=="detail"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['Filter_Level','Cari_User']
|
|
}).send()
|
|
}
|
|
},
|
|
|
|
oc_Level: function(){
|
|
}
|
|
|
|
};
|