Files
cmasa/app/Scripts/table/supplier.js
T

86 lines
2.9 KiB
JavaScript

/*******************************************************************
PHP Class : /Controller/Table/SupplierController
Description : Master Supplier
Created By : Siau Pheng ([email protected]).
Created Date : December 7th, 2010.
Last Modified : August 31st, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var SupplierJS = {
PHP: '',
KODE: '',
index: function(){
this.data_query('detail');
$('#Cari_Sup').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_Sup').val('');
this.data_query('detail');
});
FoniaJS.setFocus('#Cari_Sup');
},
detail_show: function(mode, ID){
new Request({
url: this.PHP + '/form_supplier',
sendParam: ['mode_detail='+mode,'SupID='+ID],
onSuccess: (ajson) => {
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Supplier', ajson.html, 'lg', [{},{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({
url: this.PHP + '/table_detail',
sendParam: ['mode_detail=delete','SupID='+acell[0],'Cari_Sup'],
onSuccess: (adata) => {
if (adata.status==true){
FoniaJS.showInfo('Proses hapus data sukses!');
} else FoniaJS.showInfo('Ada masalah dalam proses hapus data!');
}
}).send();
}, 'danger');
},
detail_save: function(){
new Request_JSF({
url: this.PHP + '/table_detail',
sendParam: ['mode_detail','SupID','Kode_Sup','Nama_Sup','Alamat_Sup','Telp_Sup','No_NPWP','No_NITKU','Aktif','Cari_Sup'],
onSuccess: (adata) => {
if (adata.status==true){
FoniaJS.showInfo('Proses simpan data sukses!');
} else FoniaJS.showInfo('Ada masalah dalam proses simpan data!');
FoniaJS.closeWindow(this.winDetail);
}
}).send();
},
data_query: function(tipe, mode){
if (tipe=="detail"){
new Request_JSF({
url: this.PHP + '/table_detail',
sendParam: ['Cari_Sup']
}).send();
}
}
};