Files
robinson/apps/js/tab/satuan.js
T
2026-01-22 11:06:19 +07:00

87 lines
2.8 KiB
JavaScript

/*******************************************************************
App. Name : INVENTORY AND SALES SYSTEMS
Module : /apps/js/tab/satuan.js
Desc. : JS - Tabel Master Satuan Barang
Created By : Siau Pheng ([email protected]).
Created Date : May 19th, 2010.
Last Modified : October 5th, 2025.
(c) 2010 - 2025, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var SatuanJS = {
PHP: '',
KODE: '',
loading: function(){
this.data_query('detail');
$('#Cari_Satuan').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_Satuan').val('');
this.data_query('detail');
}.bind(this));
FoniaJS.setFocus('#Cari_Satuan');
},
detail_show: function(mode, ID){
new Request({
url: this.PHP,
sendParam: ['data=satuan-detail','mode_detail='+mode,'SatuanID='+ID],
onSuccess: function(txt){
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Satuan', txt, 600, [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], function(){
$('#winDetail').find('#butWSimpan').click(function(){this.detail_save();}.bind(this));
}.bind(this));
}.bind(this)
}).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> ?', function(){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=detail','mode_detail=delete','SatuanID='+acell[0],'Cari_Satuan'],
onSuccess: function(){
FoniaJS.showInfo('Proses hapus data sukses!');
}.bind(this)
}).send();
}.bind(this), 'danger');
},
detail_save: function(){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=detail','mode_detail','SatuanID','Kode_Satuan','Nama_Satuan','Aktif','Cari_Satuan'],
onSuccess: function(){
FoniaJS.showInfo('Proses simpan data sukses!');
FoniaJS.closeWindow(this.winDetail);
}.bind(this)
}).send();
},
data_query: function(tipe, mode){
if (tipe=="detail"){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=detail','Cari_Satuan']
}).send();
}
}
};