function feederKelasPerkuliahan(){ var ds_prodireg = store_prodireg(); var ds_stsmt = store_stsmt(); var arr_wajib = [['A', 'Wajib'], ['B', 'Pilihan']]; var ds_wajib = new Ext.data.ArrayStore({ fields: ['val', 'text'], data : arr_wajib }); var ds_struprogdet = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'feeder/feederkelasperkuliahan_controller/get_struprogdet', method: 'POST' }), //autoLoad: true, root: 'data', fields: [ {name: 'idstruprogdet', mapping: 'idstruprogdet'}, {name: 'kdprodi', mapping: 'kdprodi'}, {name: 'kdstsemester', mapping: 'kdstsemester'}, {name: 'kdmk', mapping: 'kdmk'}, {name: 'idkelas', mapping: 'idkelas'}, {name: 'kdjenjangstudi', mapping: 'kdjenjangstudi'}, {name: 'silabus', mapping: 'silabus'}, {name: 'satuanacarakuliah', mapping: 'satuanacarakuliah'}, {name: 'bahanajar', mapping: 'bahanajar'}, {name: 'diktat', mapping: 'diktat'}, {name: 'idsemester', mapping: 'idsemester'}, {name: 'jmlsks', mapping: 'jmlsks'}, {name: 'skstatapmuka', mapping: 'skstatapmuka'}, {name: 'skspraktikum', mapping: 'skspraktikum'}, {name: 'sksprakteklap', mapping: 'sksprakteklap'}, {name: 'skssim', mapping: 'skssim'}, {name: 'jnskurikulum', mapping: 'jnskurikulum'}, {name: 'jnsmk', mapping: 'jnsmk'}, {name: 'stmk', mapping: 'stmk'}, {name: 'nmmkind', mapping: 'nmmkind'}, {name: 'nmkelas', mapping: 'nmkelas'}, {name: 'idkelas', mapping: 'idkelas'}, ] }); var grid_kelaskuliah = new Ext.grid.EditorGridPanel({ id: 'grid_kelaskuliah', title: 'Kelas Perkuliahan', store: ds_struprogdet, autoScroll: true, frame: true, clicksToEdit: 1, //for cell editing (single click =1, dblclick=2) view: new Ext.grid.GridView({emptyText: '< Belum ada Data >'}), loadMask: true, height: 480, columnLines: true, tbar:[{ text: 'Export To Feeder', id: 'id_eks_feeder', iconCls: 'silk-book', handler: function() { export_kelaskuliah_to_feeder(); } }], listeners:{ afteredit:function(){ } }, columns: [new Ext.grid.RowNumberer(), { header: setHeaderGrid('Kode Mata Kuliah'), width: 100, dataIndex: 'kdmk', sortable: true, align:'left', },{ header: setHeaderGrid('Nama Mata Kuliah'), width: 200, dataIndex: 'nmmkind', sortable: true, align:'left', },{ header: setHeaderGrid('ID Kelas'), width: 70, dataIndex: 'idkelas', sortable: true, align:'left', },{ header: setHeaderGrid('Nama Kelas'), width: 100, dataIndex: 'nmkelas', sortable: true, align:'left', },{ header: setHeaderGrid('Jumlah SKS'), width: 100, dataIndex: 'jmlsks', sortable: true, align:'left', editor: RH.getNumEditor('jmlsks', 'INTEGER', 0, 50, false, function(){}), xtype: 'numbercolumn', format:'0,000', },{ header: setHeaderGrid('SKS Tatap Muka'), width: 100, dataIndex: 'skstatapmuka', sortable: true, align:'left', editor: RH.getNumEditor('skstatapmuka', 'INTEGER', 0, 50, false, function(){}), xtype: 'numbercolumn', format:'0,000', },{ header: setHeaderGrid('SKS Praktikum'), width: 100, dataIndex: 'skspraktikum', sortable: true, align:'left', editor: RH.getNumEditor('skspraktikum', 'INTEGER', 0, 50, false, function(){}), xtype: 'numbercolumn', format:'0,000', },{ header: setHeaderGrid('SKS Praktek Lap.'), width: 100, dataIndex: 'sksprakteklap', sortable: true, align:'left', editor: RH.getNumEditor('sksprakteklap', 'INTEGER', 0, 50, false, function(){}), xtype: 'numbercolumn', format:'0,000', },{ header: setHeaderGrid('SKS Simulasi'), width: 100, dataIndex: 'skssim', sortable: true, align:'left', editor: RH.getNumEditor('skssim', 'INTEGER', 0, 50, false, function(){}), xtype: 'numbercolumn', format:'0,000', }], }); var form_bp_general = new Ext.form.FormPanel({ id: 'form_export_feeder_kelaskuliah', title: 'Export Kelas Perkuliahan', xtype: 'panel', frame: true, width: 900, Height: 1000, /* layout: { type: 'form', pack: 'center', align: 'center' },*/ layout:'anchor', autoScroll: true, items: [ { xtype: 'fieldset', layout: 'form', autoHeight: true, boxMaxHeight:330, labelWidth: 100, labelAlign: 'right', items: [{ xtype: 'compositefield', fieldLabel: 'Program Studi ', items: [{ id: 'cb.prodi', xtype: 'combo', store: ds_prodireg, triggerAction: 'all', valueField: 'kdprodi', displayField: 'lnmprodi', forceSelection: true, submitValue: true, mode: 'local', allowBlank: false, editable: false, width: 300, listeners:{ select:function(){ reload_kelaskuliah(); } } },{ xtype: 'label', text: 'Tahun Akademik - Semester : ', margins: '3 5 0 15', //top right bottom left },{ id: 'cb.stsemester', xtype: 'combo', store: ds_stsmt, triggerAction: 'all', valueField: 'kdstsemester', displayField: 'nmsmt', forceSelection: true, submitValue: true, mode: 'local', allowBlank: false, editable: false, width: 160, listeners:{ select:function(){ reload_kelaskuliah(); } } }] }] }, grid_kelaskuliah] }); SET_PAGE_CONTENT(form_bp_general); function setHeaderGrid(text, align){ var hAlign = 'center'; if(align =='c') hAlign = 'center'; if(align =='l') hAlign = 'left'; if(align =='r') hAlign = 'right'; return "

"+text+"

"; } function reload_kelaskuliah(){ var prodi = Ext.getCmp('cb.prodi').getValue(); var stsemester = Ext.getCmp('cb.stsemester').getValue(); if(prodi && stsemester){ ds_struprogdet.setBaseParam('kdprodi',prodi); ds_struprogdet.setBaseParam('kdstsemester',stsemester); ds_struprogdet.load(); } } function export_kelaskuliah_to_feeder(){ var prodi = Ext.getCmp("cb.prodi").getValue(); var stsemester = Ext.getCmp("cb.stsemester").getValue(); if (grid_kelaskuliah.getStore().getCount() == 0 || !prodi || !stsemester){ Ext.MessageBox.alert("Informasi", "Data Tidak Boleh Kosong"); }else{ var waitmsg = Ext.MessageBox.wait('Mengekspor...', 'Info'); var griddata = []; grid_kelaskuliah.getStore().each(function(rec){ var rowData = rec.data; griddata.push(rowData); }); var gridjson = JSON.stringify(griddata); Ext.Ajax.request({ url: BASE_URL + 'feeder/feederkelasperkuliahan_controller/insert_kelas_kuliah', params: { prodi : prodi, stsemester : stsemester, griddata : gridjson, }, timeout: 1000000, success: function(response){ waitmsg.hide(); obj = Ext.util.JSON.decode(response.responseText); if(obj.success){ Ext.MessageBox.alert('Informasi', 'Berhasil mengekspor kelas kuliah'); }else{ var err_msg = "Terjadi kesalahan
"; for(var i = 0; i < obj.errors.length; i++) { err_msg += (i+1) + ". " + obj.errors[i] + '
'; } Ext.MessageBox.alert('Informasi', err_msg); } } }); } } }