first commit
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : SISTEM INFORMASI PERENCANAAN PEMBANGUNAN DAERAH
|
||||
Module : /apps/js/tab/asb.js
|
||||
Desc. : JS - Tabel Master Standar ASB
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : December 7th, 2010.
|
||||
Last Modified : July 30th, 2020.
|
||||
|
||||
(c) 2012 - 2020, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var TASBJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
loading: function(){
|
||||
$('#butASB').click(function(){
|
||||
if ($('#ASBID').val()>0) this.show_hide(1);
|
||||
}.bind(this));
|
||||
this.show_hide(1);
|
||||
$('#Cari_ASB').keydown(function(e){
|
||||
var key = e.keyCode || e.which || 0;
|
||||
if (key==13 && e.target.value!='') this.show_hide(1);
|
||||
}.bind(this));
|
||||
$('#butSearch').click(function(e){
|
||||
this.show_hide(1);
|
||||
}.bind(this));
|
||||
$('#butAll').click(function(){
|
||||
$('#Cari_ASB').val('');
|
||||
this.show_hide(1);
|
||||
}.bind(this));
|
||||
FoniaJS.setFocus('#Cari_ASB');
|
||||
},
|
||||
|
||||
show_hide: function(no){
|
||||
$('#divASB').css('display', 'none'); $('#butASB').removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#divHSPK').css('display', 'none');
|
||||
if (no == 1) {
|
||||
$('#ASBID').val(0);
|
||||
$('#Nama_ASB').val('');
|
||||
}
|
||||
if (no <= 1) {
|
||||
$('#butASB').removeClass('btn-info').addClass('btn-secondary');
|
||||
}
|
||||
if (no == 1) { $('#divASB').css('display', ''); this.data_query('tabel-asb'); }
|
||||
if (no == 2) { $('#divHSPK').css('display', ''); this.data_query('tabel-hspk'); }
|
||||
},
|
||||
|
||||
asb_select: function(acell){
|
||||
$('#ASBID').val(acell[0]);
|
||||
$('#Nama_ASB').val(acell[2]);
|
||||
this.show_hide(2);
|
||||
},
|
||||
|
||||
asb_detail: function(mode, ID){
|
||||
$('#ASBID').val(ID);
|
||||
new Request({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=detail-asb','mode_detail='+mode,'ASBID'],
|
||||
onSuccess: function(txt){
|
||||
this.winASB = FoniaJS.showWindow('ASB', 'Detail Standar ASB', txt, 600, '_,WK,WS', function(){
|
||||
$('#winASB').find('#butWSave').click(function(){this.asb_save();}.bind(this));
|
||||
}.bind(this));
|
||||
}.bind(this)
|
||||
}).send();
|
||||
},
|
||||
|
||||
asb_tambah: function(){
|
||||
this.asb_detail('insert', 0);
|
||||
},
|
||||
|
||||
asb_ubah: function(acell){
|
||||
this.asb_detail('update', acell[0]);
|
||||
},
|
||||
|
||||
asb_hapus: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', function(){
|
||||
new Request.JSON({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=tabel-asb','mode_detail=delete','ASBID='+acell[0]],
|
||||
onSuccess: function(){
|
||||
FoniaJS.showInfo('Proses hapus data sukses!');
|
||||
}.bind(this)
|
||||
}).send();
|
||||
}.bind(this), 'danger');
|
||||
},
|
||||
|
||||
asb_save: function(){
|
||||
new Request.JSONF({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=tabel-asb','mode_detail','ASBID='+$('#ASBID2').val(),'OPDID','K_ASB','N_ASB','D_ASB','Aktif'],
|
||||
onSuccess: function(){
|
||||
FoniaJS.showInfo('Proses simpan data sukses!');
|
||||
FoniaJS.closeWindow(this.winASB);
|
||||
}.bind(this)
|
||||
}).send();
|
||||
},
|
||||
|
||||
hspk_detail: function(mode, ID){
|
||||
new Request({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=detail-hspk','mode_detail='+mode,'ASBID','ID='+ID],
|
||||
onSuccess: function(txt){
|
||||
this.winHSPK = FoniaJS.showWindow('HSPK', 'Detail Komponen HSPK', txt, 600, '_,WK,WS', function(){
|
||||
$('#winHSPK').find('#butWSave').click(function(){this.hspk_save();}.bind(this));
|
||||
}.bind(this));
|
||||
}.bind(this)
|
||||
}).send();
|
||||
},
|
||||
|
||||
hspk_tambah: function(){
|
||||
this.hspk_detail('insert', 0);
|
||||
},
|
||||
|
||||
hspk_ubah: function(acell){
|
||||
this.hspk_detail('update', acell[0]);
|
||||
},
|
||||
|
||||
hspk_hapus: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', function(){
|
||||
new Request.JSON({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=tabel-hspk','mode_detail=delete','ASBID','ID='+acell[0]],
|
||||
onSuccess: function(){
|
||||
FoniaJS.showInfo('Proses hapus data sukses!');
|
||||
}.bind(this)
|
||||
}).send();
|
||||
}.bind(this), 'danger');
|
||||
},
|
||||
|
||||
hspk_save: function(){
|
||||
new Request.JSONF({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=tabel-hspk','mode_detail','ASBID','ID','HSPKID','KOE'],
|
||||
onSuccess: function(){
|
||||
FoniaJS.showInfo('Proses simpan data sukses!');
|
||||
FoniaJS.closeWindow(this.winHSPK);
|
||||
}.bind(this)
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode){
|
||||
if (tipe=="tabel-asb"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=tabel-asb','Cari_ASB']
|
||||
}).send();
|
||||
} else if (tipe=="tabel-hspk"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=tabel-hspk','ASBID']
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user