function tracer_study_form(grid_nya,ds_ts) { var nmcom = CLIENT; //var nmcom = window.location.hostname; var form_bp_general = new Ext.form.FormPanel({ waitMsgTarget: true, border: false, id: 'form_bp_general', labelAlign: 'left', buttonAlign: 'right', bodyStyle: 'padding:10px 3px 3px 5px', // atas, kanan, bawah, kiri monitorValid: true, height: 350, width: 800, layout: 'form', reader: new Ext.data.JsonReader ({ root: 'data', totalProperty: 'results', id: 'id', fields: [ { name: "idpesan", mapping: "idpesan" },{ name: "email",mapping: "email" },{ name: "pesanmsk",mapping: "pesanmsk" },{ name: "pesanklr",mapping: "pesanklr" },{ name: "status",mapping: "status" },{ name: "subject",mapping: "subject" },{ name: "cc",mapping: "cc" } ] }), items: [ { xtype: 'textfield', fieldLabel: 'Id', labelStyle: 'width:140px', width:200, name: 'idpesan', hidden: true }, { xtype: 'textfield', vtype:'email', fieldLabel: 'Cc', labelStyle: 'width:100px', width:200, name: 'cc', hidden : true }, { xtype: 'textfield', fieldLabel: 'Subject', labelStyle: 'width:100px', width:500, name: 'subject', id: 'id_subjek' }, { xtype: 'textarea', fieldLabel: 'Pesan Masuk', width:680, height:150, id: 'pesanmsk', name: 'pesanmsk', readOnly: true, hidden: true }, { xtype: 'textarea', fieldLabel: 'Tulis Pesan', height:200, anchor:'99%', name: 'pesanklr', id: 'pesanklr', allowBlank: false }, { xtype: 'textfield', fieldLabel: 'Nama Komputer', hidden:true, readOnly:true, id: 'nmcom', name: 'nmcom', value:nmcom }, ], buttons: [{ id:'btn_kirim', text: 'Kirim', iconCls: 'silk-save', /* handler: function() { Ext.getCmp('idbtn_batal').disable(); if(id_module!=''){ ubah_grid('form_bp_general'); }else{ simpan_grid('form_bp_general'); } } */ handler: function(){ send_mail('form_bp_general') } }, { text: 'Batal', id: 'idbtn_batal', handler: function() { win.close(); } } ],listeners:{ // afterrender: module_afterrender } }); function module_afterrender(){ /* if(id_module!=""){ form_bp_general.getForm().load({ url: BASE_URL + 'website/c_hub_kami_inbox/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('pesanklr').setValue('UNLA'); } var win = new Ext.Window({ title: 'Email', modal: true, items: [form_bp_general] }).show(); function simpan_grid(namaForm) { var form_nya = Ext.getCmp(namaForm); //var waitmsg = Ext.MessageBox.wait('Proses mengirim pesan...', 'Info'); form_nya.getForm().submit({ url: BASE_URL + 'website/c_hub_kami_inbox/save', method: 'POST', params:{ }, success: function() { //waitmsg.hide(); Ext.MessageBox.alert("Informasi", "Kirim Email Berhasil"); ds.load(); form_bp_general.getForm().reset(); Ext.getCmp('form_bp_general').enable(); Ext.getCmp('btn_kirim').enable(); win.close(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Kirim Email Gagal"); }, waitMsg:'Loading..' }); } function ubah_grid(namaForm) { var msgplus=''; var form_nya = Ext.getCmp(namaForm); Ext.MessageBox.show({ title: "Konfirmasi", width: 250, msg: msgplus +"
Anda Yakin Mengirim Email Ini?
", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { form_nya.getForm().submit({ url: BASE_URL + 'website/c_hub_kami_inbox/sendmail', params:{ }, method: 'POST', success: function() { form_bp_general.getForm().load({waitMsg:'Loading'}); Ext.MessageBox.alert("Informasi", "Kirim Email Berhasil"); ds.load(); form_bp_general.getForm().reset(); Ext.getCmp('form_bp_general').enable(); Ext.getCmp('btn_kirim').enable(); Ext.getCmp('idbtn_batal').enable(); win.close(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Kirim Email Gagal"); Ext.getCmp('idbtn_batal').enable(); }, waitMsg:'Loading..' }); } } }); } function send_mail(namaForm){ var msgplus = ''; var form_nya = Ext.getCmp(namaForm); Ext.MessageBox.show({ title: "Konfirmasi", width: 250, msg: msgplus +"
Anda Yakin Mengirim Email Ini?
", buttons: Ext.MessageBox.YESNO, fn: function(btn) { var m = grid_nya.getSelectionModel().getSelections(); if (btn == 'yes') { var waitmsgloadsimpanambil = Ext.MessageBox.wait('Sedang Mengirim...', 'Info'); for(var i=0; i< m.length; i++){ var rec = m[i]; console.log(rec); if(rec){ var idmhs = rec.data['idmhs']; var nim = rec.data['nim']; var email = rec.data['email']; Ext.Ajax.request({ url: BASE_URL +'website/c_hub_kami_inbox/sendmail_tracerstudy', method: 'POST', //waitMsg:'Loading..', params: { email : email, subjek : Ext.getCmp('id_subjek').getValue(), pesanklr : Ext.getCmp('pesanklr').getValue(), url : BASE_URL+'web/content/tracerstudy/'+idmhs+'/'+nim, }, success: function() { waitmsgloadsimpanambil.hide(); // form_bp_general.getForm().load({waitMsg:'Loading'}); Ext.Msg.alert("Info", "Email Telah Dikirim"); /*gp_setbiayatahap.getStore().reload({ params: { idsetbiaya : idsetbiayaparam } }); */ win.close(); }, failure: function(result){ Ext.Msg.alert("Info", "Kirim Email Gagal"); waitmsgloadsimpanambil.hide(); } }); } } } } }); } }