Files
cmasa/app/Scripts/system/menu_grup.js
T
siaupheng aaaf0a9215 Refactor member and product scripts to use concise method definitions
- Updated all function declarations to use ES6 shorthand method syntax in member.js, member_grup.js, point_barang.js, point_skema.js, point_tipe.js, kategori.js, operator.js, produk.js, produk_grup.js, rekpos.js, satuan.js, supplier.js, and varian.js.
2026-11-01 14:57:54 +07:00

130 lines
4.6 KiB
JavaScript

/*******************************************************************
PHP Class : /Controller/System/MenugrupController
Description : Grup Login Menu
Created By : Siau Pheng ([email protected]).
Created Date : August 8th, 2013.
Last Modified : August 19th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var MenuGrupJS = {
PHP: '',
KODE: '',
index() {
this.data_query();
$('#Cari_Grup').keydown((e) => {
var key = e.keyCode || e.which || 0;
if (key==13 && e.target.value!='') this.data_query();
});
$('#butSearch').click((e) => this.data_query());
$('#butAll').click(() => {
$('#Cari_Grup').val('');
this.data_query();
});
FoniaJS.setFocus('#Cari_Grup');
},
detail_show(mode, ID) {
new Request({
url: this.PHP + '/detail_grup',
sendParam: ['mode='+mode,'Grup_MenuID='+ID],
onSuccess: (ajson) => {
this.winDetail = FoniaJS.showWindow('Detail', 'Informasi Grup Menu', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winDetail').find('#butWSimpan').click(() => this.detail_save());
});
}
}).send();
},
detail_tambah() {
this.detail_show('add', 0);
},
detail_ubah(acell) {
this.detail_show('edit', acell[0]);
},
detail_hapus(acell) {
FoniaJS.showConfirm("Konfirmasi", "Yakin akan hapus "+acell[1]+"?", function(){
new Request_JSF({
url: this.PHP + '/table_detail',
sendParam: ['mode=del','Grup_MenuID='+acell[0],'Cari_Grup'],
onSuccess: () => FoniaJS.showInfo('Proses hapus data sukses!')
}).send();
}.bind(this), 'danger');
},
detail_save() {
new Request_JSF({
url: this.PHP + '/table_detail',
sendParam: ['mode','Grup_MenuID','Nama_Grup','Ket','Aktif','Cari_Grup'],
onSuccess: () => {
FoniaJS.showInfo('Proses simpan data sukses!');
FoniaJS.closeWindow(this.winDetail);
}
}).send();
},
menu_show(acell) {
new Request({
url: this.PHP + '/detail_menu',
sendParam: ['Grup_MenuID='+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 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() {
$('#tabMenuList input.form-check-input[type=checkbox]').prop('checked', true);
},
menu_hapussemua() {
$('#tabMenuList input.form-check-input[type=checkbox]').prop('checked', false);
},
menu_simpan() {
var alist = [];
$('#tabMenuList tbody input.form-check-input[type=checkbox]:checked').map((i, b) => {
alist.push($(b).val());
});
new Request({
url: this.PHP + '/save_menu',
sendParam: ['Grup_MenuID','Menu='+alist],
onSuccess: (ajson) => {
if (ajson.status==true){
FoniaJS.showInfo('Proses simpan data sukses!');
}else{
FoniaJS.showInfo('Ada masalah dalam proses simpan data!');
}
FoniaJS.closeWindow(this.winMenu);
}
}).send();
},
data_query() {
new Request_JSF({
url: this.PHP + '/table_detail',
sendParam: ['Cari_Grup'],
}).send()
}
};