function f_inputhasilusm() { var nopmbx, cmbpengujix, catatanx = ''; var ds_prodi = store_prodi(); var ds_klsmhs = store_klsmhs(); var ds_stusm = store_stusm(); var ds_jadwalpmb = store_jadwalpmb(); var ds_penguji = store_penguji(); var ds_combocari = new Ext.data.JsonStore({ fields:['kd','nm'], data:[ {"kd":"nopmb", "nm":"No PMB"}, {"kd":"nama", "nm":"Nama Pendaftar"}, {"kd":"kdjk", "nm":"(L/P)"} ] }); function render_prodi(value) { var fValue = ''; var index = ds_prodi.find('kdprodi', value); if(index != -1)//the record has been found { var record = ds_prodi.getAt(index); fValue = record.data['nmprodi'];// } return fValue; } function render_kelas(value) { var fValue = ''; var index = ds_klsmhs.find('idklsmhs', value); if(index != -1)//the record has been found { var record = ds_klsmhs.getAt(index); fValue = record.data['nmklsmhs'];// } return fValue; } function render_hasil(value) { var fValue = ''; var index = ds_stusm.find('idstusm', value); if(index != -1)//the record has been found { var record = ds_stusm.getAt(index); fValue = record.data['nmstusm'];// } return fValue; } function render_penguji(value) { var fValue = ''; var index = ds_penguji.find('nidu', value); if(index != -1)//the record has been found { var record = ds_penguji.getAt(index); fValue = record.data['nmdosdgngelar'];// } return fValue; } var ds_grid = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'pendaftaran/c_inputhasilusm/grid', method: 'POST' }), params: { start: 0, limit: 5 }, root: 'data', totalProperty: 'results', autoLoad: false, fields: [{ name: "nopmb", mapping: "nopmb" }, { name: "tglpmb", mapping: "tglpmb" }, { name: "nama", mapping: "nama" }, { name: "kdjk", mapping: "kdjk" }, { name: "idstmskmhs", mapping: "idstmskmhs" }, { name: "idklsmhs1", mapping: "idklsmhs1" }, { name: "idklsmhs", mapping: "idklsmhs" }, { name: "kdprodi1", mapping: "kdprodi1" }, { name: "kdprodi", mapping: "kdprodi" }, { name: "idstusm", mapping: "idstusm" }, { name: "penguji", mapping: "penguji" }, { name: "catatanusm", mapping: "catatanusm" }, { name: "catatanpmb", mapping: "catatanpmb" }] }); /*var sm_nya = new Ext.grid.CheckboxSelectionModel({ });*/ var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column defaults: { //sortable: true // columns are not sortable by default }, columns: [new Ext.grid.RowNumberer({width:45}), { header: 'No.PMB', width: 100, dataIndex: 'nopmb', sortable: true }, { header: 'Tgl.Daftar', width: 70, dataIndex: 'tglpmb', sortable: true // , // renderer:function(v){ // var d= new Date(v); // return d.format('d-m-Y'); // } }, { header: 'Nama Pendaftar', width: 150, dataIndex: 'nama', sortable: true }, { header: '(L/P)', width: 40, dataIndex: 'kdjk', sortable: true }, { header: 'Status Pendaftar', width: 110, dataIndex: 'idstmskmhs', sortable: true }, { header: 'Program Studi (Pilihan 1)', width: 300, dataIndex: 'kdprodi1', sortable: true, }, { header: 'Program Studi (Pilihan Diterima)', width: 300, dataIndex: 'kdprodi', sortable: true, renderer: render_prodi, editor: { xtype: 'combo', allowBlank: true, store: ds_prodi, name: 'cmbkdprodi', triggerAction: 'all', id: 'cmbkdprodi', valueField: 'kdprodi', displayField: 'nmprodi', forceSelection: true, submitValue: true, hiddenName: 'h_cmbkdprodi', listeners: { select: function() { Ext.Ajax.request({ url: BASE_URL + 'pendaftaran/c_inputhasilusm/getklsprodi', method: 'POST', params: { prodi: Ext.getCmp("cmbkdprodi").getValue() }, success: function(response) { Ext.getCmp("cmbklsmhs").setValue(response.responseText); } }); } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true } }, { header: 'Kelas (Pilihan 1)', width: 120, dataIndex: 'idklsmhs1', sortable: true, }, { header: 'Kelas (Pilihan Diterima)', width: 150, dataIndex: 'idklsmhs', sortable: true, renderer: render_kelas, editor: { xtype: 'combo', allowBlank: true, store: ds_klsmhs, name: 'cmbklsmhs', triggerAction: 'all', id: 'cmbklsmhs', valueField: 'idklsmhs', displayField: 'nmklsmhs', forceSelection: true, submitValue: true, hiddenName: 'h_cmbklsmhs', listeners: { select: function() { } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true } }, { header: 'Hasil USM', width: 110, dataIndex: 'idstusm', renderer: render_hasil, sortable: true, editor: { xtype: 'combo', allowBlank: true, store: ds_stusm, name: 'cmbidstusm', triggerAction: 'all', id: 'cmbidstusm', valueField: 'idstusm', displayField: 'nmstusm', forceSelection: true, submitValue: true, hiddenName: 'h_cmbidstusm', listeners: { select: function() { } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true } }, { header: 'Catatan Hasil USM', width: 200, dataIndex: 'catatanusm', sortable: true, editor: { xtype: 'textarea', id: 'catatanusm_text', name: 'catatanusm_text', listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { } } } } }, { header: 'Dosen Penguji', width: 200, dataIndex: 'penguji', renderer: render_penguji, sortable: true, editor: { xtype: 'combo', allowBlank: true, store: ds_penguji, name: 'cmbpenguji', triggerAction: 'all', id: 'cmbpenguji', valueField: 'nidu', displayField: 'nmdosdgngelar', forceSelection: true, submitValue: true, hiddenName: 'h_cmbpenguji', listeners: { select: function() { } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true } /* editor: { xtype: 'compositefield', name: 'comp_cmbpenguji', id: 'comp_cmbpenguji', items: [{ xtype: 'textfield', id: 'cmbpenguji', name: 'cmbpenguji', width: 122, height: 22, emptyText: 'Pilih...', listeners: { valid: function() { } } }, { xtype: 'button', text: ' ... ', id: 'btn_cmbpenguji2', width: 22, height: 22, handler: function() { find_x("Data Dosen Penguji", 7); } }] } */ }, { header: 'Catatan Pendaftar', width: 200, dataIndex: 'catatanpmb', sortable: true, editor: { xtype: 'textarea', id: 'catatanpmb_text', name: 'catatanpmb_text', listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { } } } } }] }); var vw = new Ext.grid.GridView({ emptyText: '< No Data To Display >' }); var sm_nya = new Ext.grid.CheckboxSelectionModel({ listeners: { // rowselect: select_action, // rowdeselect: deselect_action } }); var editor = new Ext.ux.grid.RowEditor({ saveText: 'Update', clicksToEdit: 1 }); editor.on({ scope: this, afteredit: function(roweditor, changes, record, rowIndex) { Ext.Ajax.request({ url: BASE_URL + 'pendaftaran/c_inputhasilusm/update', params: { /* nopmb: record.get('nopmb'), idklsmhs1: record.get('idklsmhs1'), kdprodi1: record.get('kdprodi1'), idstusm: record.get('idstusm'), penguji: Ext.getCmp('cmbpenguji').getValue(), catatanusm: record.get('catatanusm') */ nopmb: record.get('nopmb'), idklsmhs1: Ext.getCmp('cmbklsmhs').getValue(), kdprodi1: Ext.getCmp('cmbkdprodi').getValue(), idstusm: Ext.getCmp('cmbidstusm').getValue(), penguji: Ext.getCmp('cmbpenguji').getValue(), catatanusm: Ext.getCmp('catatanusm_text').getValue(), catatanpmb: Ext.getCmp('catatanpmb_text').getValue() }, success: function() { // Ext.MessageBox.alert("Informasi", "Ubah Data Berhasil"); ds_grid.load(); }, failure: function() { // Ext.MessageBox.alert("Informasi", "Ubah Data Gagal"); } }); } }); /* var paging = new Ext.PagingToolbar({ pageSize: 50, store: ds_grid, displayInfo: true, displayMsg: 'Data Input Hasil USM Dari {0} - {1} of {2}', emptyMsg: 'Input Hasil USM Belum Dipilih.' }); */ var grid_nya = new Ext.grid.EditorGridPanel({ store: ds_grid, frame: true, height: 530, plugins: editor, id: 'grid_det', autoWidth:true, columnLines: true, loadMask:true, enableColumnResize: true, buttonAlign: 'left', defaults: { anchor: '-10' }, forceFit: true, tbar: [{ xtype: 'buttongroup', title: 'Pencarian', columns: 4, width: 500, defaults: { scale: 'small' }, items: [{ text: 'Jadwal PMB' }, { xtype: 'combo', store: ds_jadwalpmb, name: 'kdjadwalpmb', id: 'kdjadwalpmb', triggerAction: 'all', editable: false, valueField: 'idjadwalpmb', displayField: 'nmjadwalpmb', forceSelection: true, submitValue: true, hiddenName: 'h_kdjadwalpmb', listeners: { select: function() { } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true, width: 250 }, { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, { text: 'Program Studi (Pilihan 1)' }, { xtype: 'combo', store: ds_prodi, name: 'kdprodi', id: 'kdprodi', triggerAction: 'all', editable: false, valueField: 'kdprodi', displayField: 'nmprodi', forceSelection: true, submitValue: true, hiddenName: 'h_kdprodi', listeners: {}, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true, width: 250 }, { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, { text: 'Cari Berdasarkan' }, { xtype: 'combo', store: ds_combocari, //ds_fieldpmb, name: 'idfield', id: 'idfield', triggerAction: 'all', editable: false, valueField: 'kd', displayField: 'nm', forceSelection: true, submitValue: true, hiddenName: 'h_kolom', listeners: {}, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true, width: 250 }, { xtype: 'textfield', name: 'fieldnya', id: 'fieldnya', width: 250 //, // fieldLabel:'Dodol' }, { xtype: 'button', text: ' Cari ', iconCls: 'silk-find', id: 'btn_data', width: 3, handler: function() { if (!Ext.getCmp('kdjadwalpmb').getValue()){ Ext.MessageBox.alert("Informasi", "Pilih Jadwal PMB"); return; } ds_grid.setBaseParam('idjadwalpmb', Ext.getCmp('kdjadwalpmb').getValue()); ds_grid.setBaseParam('kdprodi1', Ext.getCmp('kdprodi').getValue()); ds_grid.setBaseParam('idnya', Ext.getCmp('idfield').getValue()); ds_grid.setBaseParam('fieldnya', Ext.getCmp('fieldnya').getValue()); ds_grid.load(); } }, { xtype: 'button', id: 'btn_excel', iconCls: 'silk-save', text: ' Export To Excel', handler: function() { if (!Ext.getCmp('kdjadwalpmb').getValue()){ Ext.MessageBox.alert("Informasi", "Pilih Jadwal PMB"); return; } exportdata(); } }, { xtype: 'button', id: 'btn_blanko', iconCls: 'silk-printer', text: ' Cetak Blanko Wawancara', handler: function() { if (!Ext.getCmp('kdjadwalpmb').getValue()){ Ext.MessageBox.alert("Informasi", "Pilih Jadwal PMB"); return; } blankoWawancara(); } }] },{ xtype: 'buttongroup', title: 'Update Data', columns: 2, width: 500, defaults: { scale: 'small' }, items: [{ text: 'Hasil USM Semua :' }, { xtype: 'combo', allowBlank: true, store: ds_stusm, name: 'cmbidstusmall', triggerAction: 'all', id: 'cmbidstusmall', valueField: 'idstusm', displayField: 'nmstusm', forceSelection: true, submitValue: true, hiddenName: 'h_cmbidstusm', listeners: { select: function(cb, record) { } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true },{ text: 'Catatan Pendaftar Semua :' },{ xtype: 'textarea', id: 'catatanpmb_all', name: 'catatanpmb_all', width: 325, height: 43, listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { } } } }, { text: '' },{ xtype: 'button', text: ' Update Semua', iconCls: 'silk-save', id: 'btn_update', width: 3, handler: function() { var vidstusm = Ext.getCmp('cmbidstusmall').getValue(); var vcatatanpmb = Ext.getCmp('catatanpmb_all').getValue(); if(ds_grid.getCount()>0){ updateall(vidstusm, vcatatanpmb); } else { Ext.MessageBox.alert("Informasi", "Data Kosong"); } } }] }], sm: sm_nya, vw: vw, autoScroll: true, cm: cm, //bbar: paging, listeners: { rowclick: function rowclick(grid, rowIdx) { var rec = ds_grid.getAt(rowIdx); nopmbx = rec.data["nopmb"]; catatanx = rec.data["catatanusm"] // alert(nopmbx); } } }); var form_bp_general = new Ext.form.FormPanel({ id: 'form_bp_general_id', title: 'Input Hasil USM', 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: [grid_nya] }] }); function btn_menu_add() { f_pmb_form('', ds_grid); } function exportdata(){ var idjadwalpmb = (Ext.getCmp('kdjadwalpmb').getValue()) ? Ext.getCmp('kdjadwalpmb').getValue():'-'; var kdprodi1 = (Ext.getCmp('kdprodi').getValue()) ? Ext.getCmp('kdprodi').getValue():'-'; var idfield = Ext.getCmp('idfield').getValue(); var fieldnya = Ext.getCmp('fieldnya').getValue(); window.location = BASE_URL + 'pendaftaran/c_inputhasilusm/export_excel/'+ idjadwalpmb+'/'+kdprodi1+'/'+idfield+'/'+fieldnya; } function blankoWawancara(){ var idjadwalpmbnya = RH.getCompValue('kdjadwalpmb'); var kdprodinya = Ext.getCmp('kdprodi').getValue(); RH.ShowReport(BASE_URL + 'print/pcetakblankowawancara/get_blanko_wawancara/'+idjadwalpmbnya+'/'+kdprodinya); //window.location = BASE_URL + 'print/pcetakblankowawancara/get_blankowwncr'; } function updateall(idstusm, catatanpmb) { Ext.MessageBox.show({ title: "Konfirmasi", msg: "Update Data?", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { Ext.Ajax.request({ url: BASE_URL + 'pendaftaran/c_inputhasilusm/updateall', params: { idstusm: idstusm, catatanpmb: catatanpmb, kdjadwalpmb: Ext.getCmp('kdjadwalpmb').getValue(), kdprodi1: Ext.getCmp('kdprodi').getValue(), }, success: function() { ds_grid.load(); Ext.MessageBox.alert("Informasi", "Ubah Data Berhasil"); }, failure: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Gagal"); } }); } } }); } get_content(form_bp_general); }