function f_biayapmb_form(id_module,ds) { var ds_thnakademik2 = store_thnakademik2(); var ds_status = store_status(); var ds_jkls = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'pendaftaran/c_biayapmb/get_jkls', method: 'POST' }), totalProperty: 'results', root: 'data', autoLoad: true, fields: [{ name: 'idjnskls', mapping: 'idjnskls' },{ name: 'nmjnskls', mapping: 'nmjnskls' }] }); var arr_pilihprodi = [['1', '1 Pilihan'],['2', '2 Pilihan'],['3', 'Khusus']]; var ds_pilihprodi = new Ext.data.ArrayStore({ fields: ['idpilihprodi', 'nmpilihprodi'], data : arr_pilihprodi }); var form_bp_general = new Ext.form.FormPanel({ border: false, id: 'form_bp_general', defaults: { labelWidth: 100, labelStyle: 'text-align: right;width:300;' }, buttonAlign: 'left', bodyStyle: 'padding:10px 3px 3px 5px', // atas, kanan, bawah, kiri monitorValid: true, height: 450, width: 640, layout: 'form', autoScroll: true, reader: new Ext.data.JsonReader ({ root: 'data', totalProperty: 'results', id: 'id', fields: [ { name: "idsetbiayapmb", mapping: "idsetbiayapmb" }, { name: "kdsetbiayapmb", mapping: "kdsetbiayapmb" }, { name: "nmsetbiayapmb", mapping: "nmsetbiayapmb" }, { name: "kdstsemester", mapping: "kdstsemester" }, { name: "nmthnakademik", mapping: "nmthnakademik" }, { name: "nominal", mapping: "nominal" }, { name: "idstatus", mapping: "idstatus" }, { name: "nmstatus", mapping: "nmstatus" }, { name: "idpilihprodi", mapping: "idpilihprodi" }, { name: 'idjnskls', mapping: 'idjnskls' }, { name: 'nmjnskls', mapping: 'nmjnskls' } ] }), items: [ { xtype: 'textfield', fieldLabel: '', width: 200, hidden:true, name: 'idsetbiayapmb' },{ xtype: 'textfield', fieldLabel: 'Kode ', width: 200, name: 'kdsetbiayapmb' },{ xtype: 'textfield', fieldLabel: 'Nama ', width: 505, name: 'nmsetbiayapmb' }, { xtype: 'htmleditor', fieldLabel: 'Deskripsi ', height:100, name: 'deskripsi', id: 'deskripsi' }, { xtype: 'numericfield', style: 'text-align: right;', fieldLabel: 'Nominal ', id: 'nominal', name: 'nominal', maskRe: /[0-9.]/, width: 150, decimalSeparator: ',', decimalPrecision: 0, alwaysDisplayDecimals: true, useThousandSeparator: true, thousandSeparator: '.', allowBlank: false }, { xtype: 'combo', width: 150, height: 50, allowBlank: false, store: ds_pilihprodi, fieldLabel: 'Pilihan Prodi', id: 'idpilihprodi', triggerAction: 'all', editable: false, valueField: 'idpilihprodi', displayField: 'nmpilihprodi', forceSelection: true, submitValue: true, hiddenName: 'h_pilihprodi', listeners: {}, typeAhead: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:true }, { xtype: 'combo', width: 150, height: 50, allowBlank: false, store: ds_thnakademik2, fieldLabel: 'T.A - Smt', id: 'kdstsemester', triggerAction: 'all', editable: false, valueField: 'kdstsemester', displayField: 'nmthnakademik', forceSelection: true, submitValue: true, hiddenName: 'h_kdstsemester', listeners: {}, typeAhead: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:true }, { xtype: 'combo', width: 200, height: 50, allowBlank: false, store: ds_jkls, fieldLabel: 'Jenis Kelas ', id: 'idjnskls', triggerAction: 'all', editable: false, valueField: 'idjnskls', displayField: 'nmjnskls', forceSelection: true, submitValue: true, hiddenName: 'h_jkls', listeners: {}, typeAhead: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:true }, { xtype: 'textarea', fieldLabel: 'Keterangan Kuitansi 1 ', id: 'ketkuitansi1', width: 300 }, { xtype: 'textarea', fieldLabel: 'Keterangan Kuitansi 2 ', id: 'ketkuitansi2', width: 300 }, { xtype: 'combo', width: 125, height: 50, allowBlank: false, store: ds_status, fieldLabel: 'Status ', id: 'idstatus', triggerAction: 'all', editable: false, valueField: 'idstatus', displayField: 'nmstatus', forceSelection: true, submitValue: true, hiddenName: 'h_status', listeners: {}, typeAhead: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:true }], buttons: [{ id:'btn_simpan', iconCls: 'silk-save', text: 'Simpan', handler: function() { if(id_module!=''){ ubah_grid('form_bp_general'); }else{ simpan_grid('form_bp_general'); } } }, { text: 'Kembali', handler: function() { win.close(); } } ],listeners:{ afterrender: module_afterrender } }); function module_afterrender(){ if(id_module!=""){ form_bp_general.getForm().load({ url: BASE_URL + 'pendaftaran/c_biayapmb/grid', params:{ id_module:id_module }, success: function(form, action){ //Ext.getCmp('idpilihprodi').disable(); //Ext.getCmp('kdstsemester').disable(); }, failure: function(form, action){ Ext.MessageBox.alert('Failure', 'Fail to get data'); }, waitMsg:'Loading..' }); } } var win = new Ext.Window({ title: 'Biaya PMB', modal: true, items: [form_bp_general] }).show(); function simpan_grid(namaForm) { var form_nya = Ext.getCmp(namaForm); form_nya.getForm().submit({ url: BASE_URL + 'pendaftaran/c_biayapmb/save', method: 'POST', params:{ nominaly:Ext.getCmp('nominal').getValue() }, success: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Berhasil"); ds.load(); form_bp_general.getForm().reset(); Ext.getCmp('form_bp_general').enable(); Ext.getCmp('btn_simpan').enable(); win.close(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Gagal"); } }); } function ubah_grid(namaForm) { var msgplus=''; var form_nya = Ext.getCmp(namaForm); Ext.MessageBox.show({ title: "Konfirmasi", width: 350, msg: msgplus +"
Anda Yakin Untuk Mengubah Data ini?
", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { form_nya.getForm().submit({ url: BASE_URL + 'pendaftaran/c_biayapmb/update', params:{ nominaly:Ext.getCmp('nominal').getValue() }, method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Berhasil"); ds.load(); form_bp_general.getForm().reset(); Ext.getCmp('form_bp_general').enable(); Ext.getCmp('btn_simpan').enable(); win.close(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Gagal"); } }); } } }); } }