103 lines
3.6 KiB
JavaScript
103 lines
3.6 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/Table/Member/MemberController
|
|
Description : Master Member
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : December 7th, 2010.
|
|
Last Modified : September 3rd, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var MemberJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index: function(){
|
|
this.data_query('detail');
|
|
$('#butPrint').click(() => this.print_show());
|
|
$('#Cari_Member').keydown((e) => {
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('detail');
|
|
});
|
|
$('#butSearch').click(() => this.data_query('detail'));
|
|
$('#butAll').click(() => {
|
|
$('#Cari_Member').val('');
|
|
this.data_query('detail');
|
|
});
|
|
FoniaJS.setFocus('#Cari_Member');
|
|
},
|
|
|
|
print_show: function(){
|
|
new Request({
|
|
url: this.PHP + '/detail_print',
|
|
onSuccess: (ajson) => {
|
|
this.winDPrint = FoniaJS.showWindow('DPrint', 'Cetak Daftar Member', ajson.html, 'lg', [{},{"i":"butWCetak","v":"Cetak","c":"info"},{"i":"butWPreview","v":"Pratinjau","c":"secondary"}], () => {
|
|
$('#winDPrint')
|
|
.find('#butWCetak').click(() => this.print_member(true)).end()
|
|
.find('#butWPreview').click(() => this.print_member());
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
print_member: function(prt){
|
|
var cetak = new Printer(this.PHP + '/print_member');
|
|
cetak.add_param("Grup_MemberID");
|
|
cetak.add_param("Aktif");
|
|
cetak.add_param("Tgl_Cetak");
|
|
if (prt) cetak.doPrint(); else cetak.doPreview();
|
|
FoniaJS.closeWindow(this.winDPrint);
|
|
},
|
|
|
|
detail_show: function(mode, ID){
|
|
new Request({
|
|
url: this.PHP + '/form_member',
|
|
sendParam: ['mode_detail='+mode,'MemberID='+ID],
|
|
onSuccess: (ajson) => {
|
|
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Member', ajson.html, 'xl', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => $('#winDetail').find('#butWSimpan').click(() => this.detail_save()));
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
detail_tambah: function(){
|
|
this.detail_show('insert', 0);
|
|
},
|
|
|
|
detail_ubah: function(acell){
|
|
this.detail_show('update', acell[0]);
|
|
},
|
|
|
|
detail_hapus: function(acell){
|
|
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', () => {
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=delete','MemberID='+acell[0],'Cari_Member'],
|
|
onSuccess: () => FoniaJS.showInfo('Proses hapus data sukses!')
|
|
}).send();
|
|
}, 'danger');
|
|
},
|
|
|
|
detail_save: function(){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail','MemberID','Grup_MemberID','Kode_Member','Nama_Member','Alamat_Member','Kota_Member','Telp_Member','KTP_Member','Tgl_Lahir','Tgl_Daftar','IM','Aktif','Cari_Member'],
|
|
onSuccess: () => {
|
|
FoniaJS.showInfo('Proses simpan data sukses!');
|
|
FoniaJS.closeWindow(this.winDetail);
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
data_query: function(tipe, mode){
|
|
if (tipe=="detail"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['Cari_Member']
|
|
}).send();
|
|
}
|
|
}
|
|
|
|
};
|