function f_jadwalusm_form(id_module,recordstat,ds) { var ds_stmskmhs = store_stmskmhs(); var ds_status = store_status(); var ds_jadwalpmb = store_jadwalpmb(); var ds_jusm = store_jusm(); var form_bp_general = new Ext.form.FormPanel({ border: false, id: 'form_bp_general', defaults: { labelWidth: 100, labelStyle: 'text-align: right;width:100;' }, 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: "idjadwalusm", mapping: "idjadwalusm" }, { name: "kdjadwalusm", mapping: "kdjadwalusm" }, { name: "nmjadwalusm", mapping: "nmjadwalusm" }, { name: "idjadwalpmb", mapping: "idjadwalpmb" }, { name: "nmjadwalpmb", mapping: "nmjadwalpmb" }, { name: "idstmskmhs", mapping: "idstmskmhs" }, { name: "nmstmskmhs", mapping: "nmstmskmhs" }, { name: "idjnsusm", mapping: "idjnsusm" }, { name: "nmjnsusm", mapping: "nmjnsusm" }, { name: "tglusm", mapping: "tglusm" }, { name: "jamusmdari", mapping: "jamusmdari" }, { name: "jamusmsampai", mapping: "jamusmsampai" }, { name: "idstatus", mapping: "idstatus" }, { name: "nmstatus", mapping: "nmstatus" } ] }), items: [{ xtype: 'textfield', fieldLabel: '', width: 200, hidden:true, name: 'idjadwalusm' }, { xtype: 'combo', width: 500, height: 50, allowBlank: false, store: ds_jadwalpmb, fieldLabel: 'Jadwal PMB', id: 'idjadwalpmb', triggerAction: 'all', editable: false, valueField: 'idjadwalpmb', displayField: 'nmjadwalpmb', forceSelection: true, submitValue: true, hiddenName: 'h_nmjadwalpmb', listeners: {}, typeAhead: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:true }, { xtype: 'textfield', fieldLabel: 'Kode ', name: 'kdjadwalusm' },{ xtype: 'textfield', fieldLabel: 'Nama', name: 'nmjadwalusm', width: 500 }, { xtype: 'combo', width: 125, height: 50, allowBlank: false, store: ds_stmskmhs, fieldLabel: 'Status Pendaftar', id: 'idstmskmhs', triggerAction: 'all', editable: false, valueField: 'idstmskmhs', displayField: 'nmstmskmhs', forceSelection: true, submitValue: true, hiddenName: 'h_nmstmskmhs', listeners: {}, typeAhead: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:true }, { xtype: 'combo', width: 125, height: 50, allowBlank: false, store: ds_jusm, fieldLabel: 'Jenis USM', id: 'idjnsusm', triggerAction: 'all', editable: false, valueField: 'idjnsusm', displayField: 'nmjnsusm', forceSelection: true, submitValue: true, hiddenName: 'h_nmjnsusm', listeners: {}, typeAhead: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:true }, { xtype: 'datefield', fieldLabel: 'Tanggal USM', id: 'tglusm', name: 'tglusm' }, { xtype: 'compositefield', items: [ { xtype: 'textfield', fieldLabel: 'Waktu', name:'jamusmdari', id:'jamusmdari', labelAlign: 'right'//, // flex: 1 }, { xtype: 'textfield', fieldLabel: 's.d', name:'jamusmsampai', id:'jamusmsampai', labelAlign: 'right'//, // flex: 1 } ] }, { xtype: 'htmleditor', fieldLabel: 'Deskripsi', border:false, //anchor:'100%', // layout:'fit', width: 500, height:150, //autoWidth:true, name: 'deskripsi' }, { 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() { var idstat = Ext.getCmp('idstatus').getValue(); var idstmskmhs = Ext.getCmp('idstmskmhs').getValue(); var nmstmskmhs = Ext.getCmp('idstmskmhs').getRawValue(); Ext.Ajax.request({ url: BASE_URL + 'pendaftaran/c_jadwalusm/cekaktifusm', method: 'POST', params: { idstmskmhs :idstmskmhs }, success: function(response) { status = response.responseText; if (status=='1' && idstat =='1' && recordstat != '1'){ Ext.MessageBox.alert("Informasi", "Jadwal USM Status Pendaftar " + nmstmskmhs + " Aktif Sudah Ada,Silahkan Tidak Aktifkan Terlebih Dahulu"); } else { 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_jadwalusm/grid', params:{ id_module:id_module }, success: function(form, action){ }, failure: function(form, action){ Ext.MessageBox.alert('Failure', 'Fail to get data'); }, waitMsg:'Loading..' }); } Ext.getCmp('tglusm').setValue(SYS_DATE); } var win = new Ext.Window({ title: 'Jadwal USM', 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_jadwalusm/save', method: 'POST', params:{ // mslider:Ext.getCmp('slideratas').getValue(), // pengguna:USERNAME }, 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(); // Ext.getCmp('btn_hapus').disable(); // Ext.getCmp('btn_ubah').disable(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Gagal"); } }); } function ubah_grid(namaForm) { // var msgplus; // if(kodex!=Ext.getCmp('kode').getValue()){ // msgplus='