Files
master/apps/js/tab/periode.js
T
2026-07-16 14:07:54 +07:00

94 lines
3.1 KiB
JavaScript

/*******************************************************************
App. Name : SISTEM INFORMASI PERENCANAAN PEMBANGUNAN DAERAH
Module : /apps/js/tab/periode.js
Desc. : JS - Pengaturan Periode Data
Created By : Siau Pheng ([email protected]).
Created Date : May 16th, 2012.
Last Modified : July 18th, 2020.
(c) 2012 - 2020, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var TPeriodeJS = {
PHP: '',
KODE: '',
loading: function(){
this.data_query('detail');
$('#Cari_Tahun').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_Tahun').val('');
this.data_query('detail');
});
FoniaJS.setFocus('#Cari_Tahun');
},
detail_show: function(mode, ThnID){
new Request({
url: this.PHP,
sendParam: ['data=periode-detail','mode='+mode,'THNID='+ThnID],
onSuccess: (txt) => {
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Periode Data', txt, 'md', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winDetail').find('#butWSimpan').click(() => this.detail_save());
});
}
}).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 <b>"'+acell[2]+'"</b> ?', () => {
new Request.JSON({
url: this.PHP,
sendParam: ['data=save','mode=del','THNID='+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_save: function(){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=save','mode','THNID','Tahun','Ket'],
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();
},
data_query: function(tipe, mode){
if (tipe=="detail"){
new Request.JSONF({
url: this.PHP,
sendParam: ['data=detail','Cari_Tahun']
}).send();
}
}
};