function tracer_study(){ function status(val) { if (val == "Belum") { return ''; } else if (val == "Terkirim") { return ''; } return val; } var ds_prodireg = store_prodi(); var ds_years = store_tahun(); var ds_ts = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'tracerstudy/tracerstudy_controller/get_mhs', method: 'POST' }), params: { start: 0, limit: 5 }, /*params: [ {key:'kdprodi', id:'cb.prodi-kur'} ,{key:'thnmasuk', id:'cb.thmasuk-kur'} ],*/ root: 'data', totalProperty: 'results', autoLoad: false, fields: [{ name: "idmhs", mapping: "idmhs" },{ name: "nim", mapping: "nim" },{ name: "nmmhs", mapping: "nmmhs" },{ name: "nmstaktifmhs", mapping: "nmstaktifmhs" },{ name: "thnkeluar", mapping: "thnkeluar" },{ name: "email", mapping: "email" },{ name: "nohpmhs", mapping: "nohpmhs" }] }); var sm_nya = new Ext.grid.CheckboxSelectionModel({ //checked: true, listeners: { // rowselect: select_action, // rowdeselect: deselect_action } });// Grid View var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column defaults: { sortable: true // columns are not sortable by default }, columns: [ sm_nya, new Ext.grid.RowNumberer(), { header: RH.h3('NIM'), width: 100, dataIndex: 'nim', align: 'left', sortable: true }, { header: RH.h3('Nama'), width: 200, dataIndex: 'nmmhs', sortable: true }, { header: RH.h3('Status Aktivitas Mahasiswa'), width: 200, dataIndex: 'nmstaktifmhs', sortable: true }, { header: RH.h3('Tahun Lulus'), width: 120, dataIndex: 'thnkeluar', sortable: true }, { header: RH.h3('Email'), width: 200, dataIndex: 'email', sortable: true }, { header: RH.h3('Telepon'), width: 120, dataIndex: 'nohpmhs', sortable: true }] }); var cari_data = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'local', width: 200 })]; var gv_kur = new Ext.grid.GridView({emptyText: '< Belum ada Data >'}); var DelMsg = new Ext.Toolbar({ items:[ { text: 'Delete', id: 'btn_delete', iconCls: 'silk-delete', handler: function(){ var select = grid_nya.getSelectionModel().getSelections(); if(select.length > 0){ Ext.MessageBox.confirm('Message', 'Yakin Menghapus Pesan Ini?', del); }else{ Ext.MessageBox.alert('Message', 'Pilih Pesan Yang Dihapus'); } } }] }); var grid_nya = new Ext.grid.EditorGridPanel({ //PAKE EditorGridPanel ds: ds_ts, cm: cm, sm: sm_nya, view: gv_kur, plugins: cari_data, //width: 1140, height: 450, clicksToEdit: 1, //for cell editing (single click =1, dblclick=2) forceFit: true, //autoHeight: true, layout:'anchor', //autoSizeColumns: true, //autoExpandColumn: 'nmmkind', autoScroll:true, //enableColumnResize: true, columnLines: true, loadMask: true, tbar: [ { text: 'Send Email', id: 'btn_edit', iconCls: 'silk-edit', handler: function(){ var select = grid_nya.getSelectionModel().getSelections(); for(var i=0; i< select.length; i++){ var rec = select[i]; console.log(rec); if(rec){ var jml_email = rec.data['email']+'; '; } } if(select.length > 0){ tracer_study_form(grid_nya,ds_ts); } else { Ext.MessageBox.alert('Message', 'Data Belum Di Pilih!'); } } },'-',{ text: 'Setting Admin', id: 'btn_admin', iconCls: 'silk-add', handler: function(){ showSettingAdmin(); } },'->' ], bbar: ['->',{ xtype: 'label', text: 'Total Mahasiswa:', style: 'margin-left:10px;margin-right:10px;font-weight:bold' },{ xtype: 'numericfield', id: 'totalmhs', width: 100, readOnly: true, value: 0, style: 'font-weight:bold;' }], listeners: { //cellclick: onCellKurClick } }); var form_bp_general = new Ext.form.FormPanel({ id: 'form_bp_general_id', region: 'center', autoScroll: true, buttonAlign: 'left', bodyStyle: 'padding: 5px', border: false, //disabled: true, waitMsg: 'Waiting...', maskDisabled: false, monitorValid: true, items: [{ layout: 'form', border: false, items: [{ xtype: 'fieldset', flex: 1, region:'north', layout:'form', autoHeight:true, items: [{ xtype: 'container', layout: 'hbox', border: false, items:[{ layout:'form', labelWidth:90, labelAlign:'right', border: false, items: [ RH.ActionCombo({ id: 'cb.prodi-kur', label: 'Program Studi', width: 300, data: ds_prodireg, key: 'kdprodi', display: 'nmprodi', fnSelect: function(){ reloadGrid(); } }) ] },{ layout:'form', labelWidth:190, labelAlign:'right', border: false, items: [ RH.ActionCombo({ id: 'cb.thmasuk-kur', label: 'Tahun Masuk/Angkatan', width: 100, data: ds_years, key: 'tahun', display: 'tahun', fnSelect: function(){ reloadGrid(); } }) ] }] }] }, grid_nya] }] }); var o_m_menu = new Ext.Panel({ bodyStyle: 'padding: 5px', title: 'Tracer Study', defaults: { anchor: '-10' }, border: true, margins: '0 0 5 0', plain: true, layout: 'border', items: [form_bp_general] }); /* function btn_menu_add(){ f_hub_kami_inbox_form('',ds_ts); } */ get_content(o_m_menu); function showSettingAdmin(){ // -- FORM PANEL (DISPLAY) SETTING ADMIN var fpSettingAdmin = new Ext.form.FormPanel({ id: 'fp.setadm', name: 'fp.setadm', layout: 'form', forceFit: true, maskDisabled: false, monitorValid: true, autoScroll: true, margin: '0 0 10', frame: true, reader: new Ext.data.JsonReader ({ root: 'data', totalProperty: 'results', id: 'id', fields: [ { name: "emailadmin", mapping: "emailadmin" },{ name: "passadmin", mapping: "passadmin" } ] }), items: [ { xtype: 'textfield', vtype:'email', id: 'emailadmin', fieldLabel: 'Email (G-Mail)', width: 250, allowBlank: false, name: "emailadmin" }, { xtype: 'textfield', inputType: 'password', id: 'passadmin', fieldLabel: 'Password Email', width: 250, allowBlank: false, name: "passadmin" }, ], buttons: [ { id:'btn_simpan', iconCls: 'silk-save', text: 'Simpan', handler: function() { simpan('fp.setadm'); } }, { text: 'Tutup', handler: function() { wSetAdm.close(); } } ], listeners:{ afterrender: module_afterrender } }); function module_afterrender(){ fpSettingAdmin.getForm().load({ url : BASE_URL + 'website/c_hub_kami_info/settingadmin', success: function(form, action){ }, failure: function(form, action){ Ext.MessageBox.alert('Failure', 'Fail to get data'); }, waitMsg:'Loading..' }); } function simpan(namaForm) { var form_nya = Ext.getCmp(namaForm); form_nya.getForm().submit({ url: BASE_URL + 'website/c_hub_kami_info/update_settingadmin', method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Berhasil"); wSetAdm.close(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Gagal"); } }); } var wSetAdm = new Ext.Window({ title: 'Setting Email Admin', modal: true, layout: 'fit', width:400, height:150, items: [fpSettingAdmin] }).show(); } function reloadGrid(){ var prodi = RH.getCompValue('cb.prodi-kur', true); var thmasuk = RH.getCompValue('cb.thmasuk-kur', true); if (prodi && thmasuk) { ds_ts.reload({ params: { kdprodi: RH.getCompValue('cb.prodi-kur', true), thnmasuk: RH.getCompValue('cb.thmasuk-kur', true) }, scope : this, callback: function(records, operation, success) { var jmlmhs = 0; ds_ts.each(function (rec) { jmlmhs += 1; }); Ext.getCmp('totalmhs').setValue(jmlmhs); } }); } } }