function feederDosenMahasiswakelas(){ var ds_prodireg = store_prodireg(); var ds_stsmt = store_stsmt(); var ds_kelaskuliah_feeder = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'feeder/feederkelasperkuliahan_controller/get_kelaskuliah_feeder', method: 'POST' }), root: 'data', fields: [ {name: 'id_kls', mapping: 'id_kls'}, {name: 'id_sms', mapping: 'id_sms'}, {name: 'fk__id_sms', mapping: 'fk__id_sms'}, {name: 'id_smt', mapping: 'id_smt'}, {name: 'fk__id_smt', mapping: 'fk__id_smt'}, {name: 'id_mk', mapping: 'id_mk'}, {name: 'fk__id_mk', mapping: 'fk__id_mk'}, {name: 'nm_kls', mapping: 'nm_kls'}, {name: 'sks_mk', mapping: 'sks_mk'}, {name: 'sks_tm', mapping: 'sks_tm'}, {name: 'sks_prak', mapping: 'sks_prak'}, {name: 'sks_prak_lap', mapping: 'sks_prak_lap'}, {name: 'sks_sim', mapping: 'sks_sim'}, {name: 'bahasan_case', mapping: 'bahasan_case'}, {name: 'tgl_mulai_koas', mapping: 'tgl_mulai_koas'}, {name: 'tgl_selesai_koas', mapping: 'tgl_selesai_koas'}, {name: 'id_mou', mapping: 'id_mou'}, {name: 'a_selenggara_pditt', mapping: 'a_selenggara_pditt'}, {name: 'kuota_pditt', mapping: 'kuota_pditt'}, {name: 'a_pengguna_pditt', mapping: 'a_pengguna_pditt'}, {name: 'id_kls_pditt', mapping: 'id_kls_pditt'}, ] }); var ds_dosen = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'feeder/feederkelasperkuliahan_controller/get_dosen_kelaskuliah', method: 'POST' }), //autoLoad: true, root: 'data', fields: [ {name: 'nidu', mapping: 'nidu'}, {name: 'idjnsdosen', mapping: 'idjnsdosen'}, {name: 'nidn', mapping: 'nidn'}, {name: 'nmdostpgelar', mapping: 'nmdostpgelar'}, {name: 'nmdosdgngelar', mapping: 'nmdosdgngelar'}, {name: 'nmjnsdosen', mapping: 'nmjnsdosen'}, {name: 'rencana_pt', mapping: 'rencana_pt'}, {name: 'real_pt', mapping: 'real_pt'}, ] }); var ds_dosen_select = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'feeder/feederkelasperkuliahan_controller/get_dosen_store', method: 'POST' }), autoLoad: true, root: 'data', fields: [ {name: 'iddsn', mapping: 'iddsn'}, {name: 'kdprodi', mapping: 'kdprodi'}, {name: 'nidu', mapping: 'nidu'}, {name: 'nup', mapping: 'nup'}, {name: 'nidn', mapping: 'nidn'}, {name: 'nmdostpgelar', mapping: 'nmdostpgelar'}, {name: 'nmdosdgngelar', mapping: 'nmdosdgngelar'}, {name: 'nidnnama', mapping: 'nidnnama'}, ] }); var ds_peserta_kelas = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'feeder/feederkelasperkuliahan_controller/get_peserta_kelaskuliah', method: 'POST' }), //autoLoad: true, root: 'data', fields: [ {name: 'nim', mapping: 'nim'}, {name: 'nmmhs', mapping: 'nmmhs'}] }); //get array dosen var arr_dosen = []; Ext.Ajax.request({ url: BASE_URL + 'feeder/feederkelasperkuliahan_controller/get_dosen', params: {get : true}, success: function(response){ arr_dosen = Ext.util.JSON.decode(response.responseText); } }); var grid_kelaskuliah = new Ext.grid.GridPanel({ id: 'grid_kelaskuliah', title: 'Kelas Perkuliahan', store: ds_kelaskuliah_feeder, autoScroll: true, frame: true, view: new Ext.grid.GridView({emptyText: '< Belum ada Data >'}), loadMask: true, height: 460, columnLines: true, layout: 'form', columnWidth: 0.46, listeners: { cellclick: onclick_kelaskuliah}, columns: [new Ext.grid.RowNumberer(), { header: setHeaderGrid('Nama Kelas'), width: 120, dataIndex: 'nm_kls', sortable: true, align:'center', renderer: renderNmKls, },{ header: setHeaderGrid('Nama Mata Kuliah'), width: 270, dataIndex: 'fk__id_mk', sortable: true, align:'left', }], }); var grid_dosen = new Ext.grid.EditorGridPanel({ id: 'grid_dosen', title: 'Dosen Pengajar', store: ds_dosen, 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: 170, style:'margin-bottom:10px;', columnLines: true, tbar: [{ xtype: 'button', id: 'btn_export_to_feeder', margins:'0 0 0 15', iconCls: 'silk-save', text: ' Export To Feeder', disabled: true, handler: function() { export_to_feeder(); } }], columns: [new Ext.grid.RowNumberer(), { xtype: 'actioncolumn', width: 60, header: headerGerid('Hapus'), align:'center', items: [{ icon : 'resources/img/icons/fam/delete.gif', tooltip: 'Hapus', getClass: function(v, meta, record) {meta.attr = "style='cursor:pointer;'";}, handler: function(grid, rowIndex) { ds_dosen.removeAt(rowIndex); count_dosen = ds_dosen.getCount(); if(count_dosen > 0){ Ext.getCmp('btn_export_to_feeder').enable(); }else{ Ext.getCmp('btn_export_to_feeder').disable(); } } }] },{ header: setHeaderGrid('Dosen'), width: 220, dataIndex: 'nidu', sortable: true, align:'left', renderer: renderDosen, editor: RH.getComboEditor('nidu', false, ds_dosen_select, 'nidu', 'nidnnama', function(combo, selection){}) },{ header: setHeaderGrid('Rencana
Pertemuan'), width: 80, dataIndex: 'rencana_pt', sortable: true, align:'right', editor: RH.getNumEditor('rencana_pt', 'INTEGER', 0, 50, false, function(){}), renderer: renderPertemuan, },{ header: setHeaderGrid('Realisasi
Pertemuan'), width: 80, dataIndex: 'real_pt', sortable: true, align:'right', editor: RH.getNumEditor('real_pt', 'INTEGER', 0, 50, false, function(){}), renderer: renderPertemuan, },{ header: setHeaderGrid('Jenis
Dosen'), width: 90, dataIndex: 'nmjnsdosen', sortable: true, align:'left', }], }); var grid_peserta_kelas = new Ext.grid.GridPanel({ id: 'grid_peserta_kelas', title: 'Peserta kelas', store: ds_peserta_kelas, autoScroll: true, frame: true, view: new Ext.grid.GridView({emptyText: '< Belum ada Data >'}), loadMask: true, height: 280, columnLines: true, columns: [new Ext.grid.RowNumberer(), { header: setHeaderGrid('NIM'), width: 170, dataIndex: 'nim', sortable: true, align:'left', },{ header: setHeaderGrid('Nama'), width: 250, dataIndex: 'nmmhs', sortable: true, align:'left', }], }); var form_bp_general = new Ext.form.FormPanel({ id: 'form_export_feeder_kelaskuliah', title: 'Export Dosen Pengajar & Peserta Kelas', xtype: 'panel', frame: true, width: 900, Height: 1000, autoScroll: true, layout: {type: 'form', pack: 'center', align: 'center'}, 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(); } } }] }] }, { layout: 'column', frame: true, height:480, items:[ grid_kelaskuliah ,{ id: 'colom_grid_right', layout: 'form', columnWidth: 0.53, style:'margin-left:10px', items: [grid_dosen,grid_peserta_kelas] }], },{ xtype:'textfield', id:'hide.id_kls', hidden:true, },{ xtype:'textfield', id:'hide.nm_kls', hidden:true, },{ xtype:'textfield', id:'hide.id_mk', hidden:true, } ] }); SET_PAGE_CONTENT(form_bp_general); function reload_kelaskuliah(){ var prodi = Ext.getCmp('cb.prodi').getValue(); var stsemester = Ext.getCmp('cb.stsemester').getValue(); if(prodi && stsemester){ ds_kelaskuliah_feeder.setBaseParam('kdprodi',prodi); ds_kelaskuliah_feeder.setBaseParam('kdstsemester',stsemester); ds_kelaskuliah_feeder.load(); } } function onclick_kelaskuliah(grid, rowIndex, columnIndex, event) { var prodi = Ext.getCmp('cb.prodi').getValue(); var stsemester = Ext.getCmp('cb.stsemester').getValue(); var obj = ds_kelaskuliah_feeder.getAt(rowIndex); var id_kls = obj.get("id_kls"); var nm_kls = obj.get("nm_kls"); var id_mk = obj.get("id_mk"); Ext.getCmp("hide.id_kls").setValue(id_kls); Ext.getCmp("hide.nm_kls").setValue(nm_kls); Ext.getCmp("hide.id_mk").setValue(id_mk); ds_dosen.setBaseParam('prodi', prodi); ds_dosen.setBaseParam('stsemester', stsemester); ds_dosen.setBaseParam('id_kls', id_kls); ds_dosen.setBaseParam('nm_kls', nm_kls); ds_dosen.setBaseParam('id_mk', id_mk); ds_dosen.load({ scope : this, callback: function(records, operation, success) { count_dosen = ds_dosen.getCount(); if(count_dosen > 0){ Ext.getCmp('btn_export_to_feeder').enable(); }else{ Ext.getCmp('btn_export_to_feeder').disable(); } } }); ds_peserta_kelas.setBaseParam('prodi', prodi); ds_peserta_kelas.setBaseParam('stsemester', stsemester); ds_peserta_kelas.setBaseParam('id_kls', id_kls); ds_peserta_kelas.setBaseParam('nm_kls', nm_kls); ds_peserta_kelas.setBaseParam('id_mk', id_mk); ds_peserta_kelas.load(); } function export_to_feeder(){ var prodi = Ext.getCmp('cb.prodi').getValue(); var stsemester = Ext.getCmp('cb.stsemester').getValue(); var id_kls = Ext.getCmp("hide.id_kls").getValue(); var nm_kls = Ext.getCmp("hide.nm_kls").getValue(); var id_mk = Ext.getCmp("hide.id_mk").getValue(); if (grid_dosen.getStore().getCount() == 0 || !prodi || !stsemester){ Ext.MessageBox.alert("Informasi", "Data Tidak Boleh Kosong"); }else{ var waitmsg = Ext.MessageBox.wait('Mengekspor...', 'Info'); //get data dosen var griddosen = []; grid_dosen.getStore().each(function(rec){ var rowData = rec.data; griddosen.push(rowData); }); var dosen_data = JSON.stringify(griddosen); //get data peserta kelas var gridpeserta = []; grid_peserta_kelas.getStore().each(function(rec){ var rowData = rec.data; gridpeserta.push(rowData); }); var peserta_data = JSON.stringify(gridpeserta); Ext.Ajax.request({ url: BASE_URL + 'feeder/feederkelasperkuliahan_controller/insert_dosen_peserta_kelas', params: { prodi : prodi, stsemester : stsemester, id_kls : id_kls, nm_kls : nm_kls, id_mk : id_mk, dosen_data : dosen_data, peserta_data : peserta_data, }, timeout: 1000000, success: function(response){ waitmsg.hide(); obj = Ext.util.JSON.decode(response.responseText); if(obj.success){ Ext.MessageBox.alert('Informasi', 'Berhasil mengekspor Dosen & Peserta 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); } } }); } } function renderDosen(value) { var det_dosen = arr_dosen[value]; if(det_dosen[0].length > 0){ //if have nidn, show it return '('+ det_dosen[0] +') '+ det_dosen[1]; }else{ // else show red font return '( - ) '+det_dosen[1]+''; } } function renderNmKls(value){ return ''+value+''; } function renderPertemuan(value){ return ''+value+''; } function setHeaderGrid(text, align){ var hAlign = 'center'; if(align =='c') hAlign = 'center'; if(align =='l') hAlign = 'left'; if(align =='r') hAlign = 'right'; return "

"+text+"

"; } }