function pMatkulDosMhs1(idmenu){ var pageTitle = ''; var pageIcon = ''; var hideJadwal = true; var hideNilai = true; var idcb_prodi = 'cb.prodi'; var idcb_stsemester = 'cb.stsemester'; var panelDosenId = 'fp.detil-dosen'; var panelMhsId = 'fp.detil-mhs'; var panelJdwkulId = 'fp.detil-jdwkul'; var panelJdwujiId = 'fp.detil-jdwuji'; var IdDetObj = { dosen : panelDosenId, mahasiswa : panelMhsId, jdwkul : panelJdwkulId, jdwuji : panelJdwujiId }; if(idmenu == MENU.jadwal){ pageTitle = 'Jadwal Kuliah & Ujian'; pageIcon = 'silk-calendar'; hideJadwal = false; } if(idmenu == MENU.nilai){ pageTitle = 'Nilai Mahasiswa'; pageIcon = 'silk-report'; hideNilai = false; } //var kdmk = ''; /** COMON STORES */ var ds_prodireg = store_prodireg(); var ds_stsmt = store_stsmt(); /** GRID PANEL MATKUL */ var gp_matkul = pMatkulHeader(idmenu, idcb_prodi, idcb_stsemester, IdDetObj); var fpMain = new Ext.form.FormPanel({ title: pageTitle, iconCls: pageIcon, buttonAlign: 'left', bodyStyle: 'padding: 5px', border: true, layout:'column', waitMsg: 'Waiting...', maskDisabled: false, monitorValid: true, autoScroll:true, frame: true, items: [{ layout: 'form', columnWidth: 0.50, //COL 1 items: [{ xtype: 'fieldset', flex: 1, labelWidth:120, labelAlign:'right', items: [{ xtype: 'combo', id: idcb_prodi, fieldLabel: 'Program Studi', width: 300, editable: false, store: ds_prodireg, triggerAction: 'all', valueField: 'kdprodi', displayField: 'lnmprodi', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', listeners:{ scope: this, 'select': function(){ reloadGridMatkul(); } } },{ xtype: 'combo', id: idcb_stsemester, fieldLabel: 'Semester', store: ds_stsmt, triggerAction: 'all', valueField: 'kdstsemester', displayField: 'nmsmt', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', editable: false, listeners:{ scope: this, 'select': function(){ reloadGridMatkul(); } } }] }, { xtype: 'panel', layout:'fit', title:'Mata Kuliah', id:'fp.master', items: [gp_matkul], }, RH.vSpacer(10), { xtype: 'panel', layout:'fit', hidden:false, margin:'10 0 0 0', title:'Dosen', id: panelDosenId, //items: [gp_dosen], }, RH.vSpacer(10), { xtype: 'panel', layout:'fit', hidden:hideJadwal, margin:'10 0 0 0', title:'Jadwal Kuliah (Waktu & Ruangan)', id: panelJdwkulId, }, RH.vSpacer(10), { xtype: 'panel', layout:'fit', hidden:hideJadwal, margin:'10 0 0 0', title:'Jadwal Ujian (Waktu & Ruangan)', id: panelJdwujiId, }] },{ columnWidth: 0.01, //SPACER items: [{ xtype: 'label', text:'.'}] },{ layout: 'form', columnWidth: 0.49, //COL 3 MAHASISWA items: [{ xtype: 'panel', layout:'fit', hidden:false, margin:'10 0 10 0', title:'Daftar Mahasiswa', id: panelMhsId, },] }] }); SET_PAGE_CONTENT(fpMain); /** FUNCTIONS */ function removeAllDetails(){ RH.removeDetail(IdDetObj.dosen); RH.removeDetail(IdDetObj.mahasiswa); RH.removeDetail(IdDetObj.jdwkul); RH.removeDetail(IdDetObj.jdwuji); } function reloadGridMatkul(){ //remove details removeAllDetails(); //reload master-grid gp_matkul.store.reload({ params: { kdprodi: RH.getCompValue(idcb_prodi, true), kdstsemester: RH.getCompValue(idcb_stsemester, true) } }); } }; function pMatkulDosMhs2(idmenu){ var pageTitle = ''; var pageIcon = ''; var idcb_prodi = 'cb.prodi'; var idcb_stsemester = 'cb.stsemester'; var panelDosenId = 'fp.detdos'; var pAbsenDosId = 'fp.detabsdos'; var pAbsenMhsId = 'fp.detabsmhs'; var IdDetObj = { dosen : panelDosenId, absendos : pAbsenDosId, absenmhs : pAbsenMhsId, }; if(idmenu == MENU.absen){ pageTitle = 'Kehadiran Mahasiswa & Dosen '; pageIcon = 'silk-calendar'; } //var kdmk = ''; /** COMON STORES */ var ds_prodireg = store_prodireg(); var ds_stsmt = store_stsmt(); /** GRID PANEL MATKUL */ var gp_matkul = pMatkulHeader(idmenu, idcb_prodi, idcb_stsemester, IdDetObj); var fpMain = new Ext.form.FormPanel({ title: pageTitle, iconCls: pageIcon, buttonAlign: 'left', bodyStyle: 'padding: 5px', border: true, layout:'form', waitMsg: 'Waiting...', maskDisabled: false, monitorValid: true, autoScroll:true, frame: true, items: [{ xtype: 'fieldset', flex: 1, layout:'column', items:[{ layout: 'form', columnWidth: 0.50, labelWidth:120, labelAlign:'right', items: [{ xtype: 'combo', id: idcb_prodi, fieldLabel: 'Program Studi', width: 300, editable: false, store: ds_prodireg, triggerAction: 'all', valueField: 'kdprodi', displayField: 'lnmprodi', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', listeners:{ scope: this, 'select': function(){ reloadGridMatkul(); } } }] },{ layout: 'form', columnWidth: 0.50, labelWidth:120, labelAlign:'right', items: [{ xtype: 'combo', id: idcb_stsemester, fieldLabel: 'Semester', store: ds_stsmt, triggerAction: 'all', valueField: 'kdstsemester', displayField: 'nmsmt', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', editable: false, listeners:{ scope: this, 'select': function(){ reloadGridMatkul(); } } }] }] }, { layout:'column', items:[{ xtype: 'panel', layout:'fit', columnWidth: 0.490, title:'Mata Kuliah', id:'fp.master', frame: true, height:220, items: [gp_matkul], },{ columnWidth: 0.005, //SPACER items: [{ xtype: 'label', text:'.'}] },{ xtype: 'panel', layout:'fit', columnWidth: 0.505, title:'Dosen', id: panelDosenId, frame: true, height:220, //items: [gp_dosen], }] }, RH.vSpacer(10), { xtype: 'panel', layout:'fit', margin:'10 0 10 0', title:'Daftar Kehadiran Dosen', id: pAbsenDosId, frame: true, height:200, }, RH.vSpacer(5), { xtype: 'panel', layout:'fit', margin:'10 0 10 0', title:'Daftar Kehadiran Mahasiswa', id: pAbsenMhsId, frame: true, height:400, } ] }); SET_PAGE_CONTENT(fpMain); /** FUNCTIONS */ function removeAllDetails(){ RH.removeDetail(IdDetObj.dosen); if(idmenu == MENU.absen){ RH.removeDetail(IdDetObj.absendos); RH.removeDetail(IdDetObj.absenmhs); } } function reloadGridMatkul(){ //remove details removeAllDetails(); //reload master-grid gp_matkul.store.reload({ params: { kdprodi: RH.getCompValue(idcb_prodi, true), kdstsemester: RH.getCompValue(idcb_stsemester, true) } }); } }; /** HEADER: MATKUL from struprog ======================== */ function pMatkulHeader(idmenu, idcb_prodi, idcb_stsemester, IdDetObj){ var pageSize = 10; var nmmatkulWidth = 330; if(idmenu == MENU.jadwal){ pageSize = 5; } if(idmenu == MENU.nilai){ pageSize = 10; } if(idmenu == MENU.absen){ pageSize = 5; nmmatkulWidth = 300; } var fields_matkul = RH.storeFields('kdprodi', 'kdstsemester', 'kdmk', 'nmmkind', 'jmldos'); //from struprog join matakuliah /** GRID STORE: MTAKULIAH */ var ds_matkul = RH.JsonStore({ url : BASE_URL + 'matkuldosmhs_controller/get_matkulProdiSmt', fields : fields_matkul, limit: pageSize, params: [ {key:'kdprodi', id: idcb_prodi} ,{key:'kdstsemester', id: idcb_stsemester} ], enableSearch: true, }); ds_matkul.on('beforeload', function(){ removeMatkulDetails() }); //SEARCH COMPONENT var sb_matkul = RH.searchComp({ id : 'sb_matkul', fields : ['kdmk:Kode Mata Kuliah','nmmkind:Nama Mata Kuliah'], selected : 'kdmk', store : ds_matkul, textWidth : 250 }); /** GRID COLUMN MODEL */ var cm_matkul = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), //for rows numbering { header: 'Kode', width:80, dataIndex: 'kdmk', renderer: RH.keyToDetil, sortable: true }, { header: 'Nama Mata Kuliah ', width: nmmatkulWidth, dataIndex: 'nmmkind', sortable: true, }, { header: 'Jumlah Dosen', width: 80, dataIndex: 'jmldos', align:'right' }] ); // Selection Model var sm_matkul = new Ext.grid.RowSelectionModel({ singleSelect: true }); // Grid View var gv_matkul = new Ext.grid.GridView({emptyText: '< Belum ada Data >'}); /** GRID PANEL */ var gp_matkul = new Ext.grid.GridPanel({ ds: ds_matkul, cm: cm_matkul, sm: sm_matkul, view: gv_matkul, forceFit: true, height:200, autoHeight: (idmenu != MENU.absen), layout:'anchor', //autoSizeColumns: true, //autoExpandColumn: 'nmmkind', autoScroll:true, //enableColumnResize: true, columnLines: true, loadMask: true, tbar:[sb_matkul], bbar: new Ext.PagingToolbar({ store: ds_matkul, displayInfo: true, pageSize: pageSize, mode: 'local', displayMsg: 'Data {0} - {1} dari {2}', emptyMsg: "Belum ada data" }), listeners: { cellclick: onCellMatkulClick } }); return gp_matkul; function onCellMatkulClick(grid, rowIndex, columnIndex, e) { var t = e.getTarget(); var record = grid.getStore().getAt(rowIndex); // Get the Record var kdprodi = record.data['kdprodi']; var kdstsemester = record.data['kdstsemester']; var kdmk = record.data['kdmk']; removeMatkulDetails(); if (t.className == 'keyMasterDetail') { var gridPanelDet = pDosenMatkul(idmenu, kdprodi, kdstsemester, kdmk, IdDetObj); RH.loadDetail(IdDetObj.dosen, gridPanelDet); } } function removeMatkulDetails(){ RH.removeDetail(IdDetObj.dosen); if(idmenu == MENU.jadwal){ RH.removeDetail(IdDetObj.mahasiswa); RH.removeDetail(IdDetObj.jdwkul); RH.removeDetail(IdDetObj.jdwuji); } if(idmenu == MENU.nilai){ RH.removeDetail(IdDetObj.mahasiswa); } } } /** DETIL#1: DOSEN ===================================== */ function pDosenMatkul(idmenu, kdprodi, kdstsemester, kdmk, IdDetObj){ //var nidu = ''; //param for detail to jadwal var fields_dosmk = RH.storeFields('kdprodi', 'kdstsemester', 'kdmk', 'nidu', 'nmdosen', 'idklsmhs','nmklsmhs','jmlmhs'); //from struprogdet join dosen /** GRID STORE: DOSEN MATKUL */ var ds_dosmk = RH.JsonStore({ url : BASE_URL + 'matkuldosmhs_controller/get_dosmk', fields : fields_dosmk, limit: 3, params: [ {key:'kdprodi', value: kdprodi} ,{key:'kdstsemester', value: kdstsemester} ,{key:'kdmk', value: kdmk} ], enableSearch: false, }); ds_dosmk.on('beforeload', function(){ removeDosenDetails() }); /** GRID COLUMN MODEL */ var cm_dosmk = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), //for rows numbering { header: 'NIDU', width:70, dataIndex: 'nidu', renderer: RH.keyToDetil, sortable: true }, { header: 'Nama Dosen ', width: 240, dataIndex: 'nmdosen', sortable: true, }, { header: 'Kelas Mahasiswa', width: 100, dataIndex: 'nmklsmhs', }, { header: 'Jml Mahasiswa', width: 80, dataIndex: 'jmlmhs', align:'right' }] ); // Selection Model var sm_dosmk = new Ext.grid.RowSelectionModel({ singleSelect: true }); // Grid View var gv_dosmk = new Ext.grid.GridView({emptyText: '< Belum ada Data >'}); /** GRID PANEL */ var gp_dosmk = new Ext.grid.GridPanel({ ds: ds_dosmk, cm: cm_dosmk, sm: sm_dosmk, view: gv_dosmk, forceFit: true, height: 200, autoHeight: (idmenu != MENU.absen),//true, layout:'anchor', autoScroll:true, columnLines: true, loadMask: true, //tbar:[RH.searchBar()], bbar: new Ext.PagingToolbar({ store: ds_dosmk, displayInfo: true, mode: 'local', pageSize: 3, displayMsg: 'Data {0} - {1} dari {2}', emptyMsg: "Belum ada data" }), listeners: { cellclick: onCellDosmkClick } }); return gp_dosmk; function onCellDosmkClick(grid, rowIndex, columnIndex, e) { var t = e.getTarget(); var record = grid.getStore().getAt(rowIndex); // Get the Record var nidu = record.data['nidu']; var idklsmhs = record.data['idklsmhs']; var jmlmhs = record.data['jmlmhs']; removeDosenDetails(); if (t.className == 'keyMasterDetail') { if(idmenu == MENU.jadwal){ var gridPanelDet1 = pMahasiswaMatkul(idmenu, kdprodi, kdstsemester, kdmk, nidu, idklsmhs); var gridPanelDet2 = pJadwalKuliah(kdprodi, kdstsemester, kdmk, nidu, jmlmhs); var gridPanelDet3 = pJadwalUjian(kdprodi, kdstsemester, kdmk, nidu, jmlmhs); RH.loadDetail(IdDetObj.mahasiswa, gridPanelDet1); RH.loadDetail(IdDetObj.jdwkul, gridPanelDet2); RH.loadDetail(IdDetObj.jdwuji, gridPanelDet3); } if(idmenu == MENU.nilai){ var gridPanelDet = pMahasiswaMatkul(idmenu, kdprodi, kdstsemester, kdmk, nidu, idklsmhs); RH.loadDetail(IdDetObj.mahasiswa, gridPanelDet); } if(idmenu == MENU.absen){ var panelDet = pAbsenDosen(kdprodi, kdstsemester, kdmk, nidu); var gridPanelDet = pAbsenMahasiswa(kdprodi, kdstsemester, kdmk, nidu); RH.loadDetail(IdDetObj.absendos, panelDet); RH.loadDetail(IdDetObj.absenmhs, gridPanelDet); } } } function removeDosenDetails(){ if(idmenu == MENU.jadwal){ RH.removeDetail(IdDetObj.mahasiswa); RH.removeDetail(IdDetObj.jdwkul); RH.removeDetail(IdDetObj.jdwuji); } if(idmenu == MENU.nilai){ RH.removeDetail(IdDetObj.mahasiswa); } if(idmenu == MENU.absen){ RH.removeDetail(IdDetObj.absendos); RH.removeDetail(IdDetObj.absenmhs); } } } /** DETIL#2a: MAHASISWA from Nilai ===================================== */ function pMahasiswaMatkul(idmenu, kdprodi, kdstsemester, kdmk, nidu, idklsmhs){ var isMenuJadwal = (idmenu==MENU.jadwal)? true : false; var isMenuNilai = (idmenu==MENU.nilai)? true : false; var pageSize = 10; var gpheight = 200; if(idmenu == MENU.jadwal){ pageSize = 20; gpheight = 540; } if(idmenu == MENU.nilai){ pageSize = 20; gpheight = 540 } /** FOR COMBO EDITOR (NILAI HURUF)==================================*/ var fields_setnilai = RH.storeFields('kdprodi','kdstsemester','nilaihuruf','bobotnilai'); var ds_setnilai = RH.JsonStore({ url : BASE_URL + 'nilai_controller/get_bonilaiByProdiSmt', fields : fields_setnilai, params: [ {key:'kdprodi', value: kdprodi} ,{key:'kdstsemester', value: kdstsemester} ], enableSearch: false, }); var fnSelect = function(combo, record){ var nilaihuruf = record.data['nilaihuruf']; var bobotnilai = record.data['bobotnilai']; //Update nilai updateNilai(nilaihuruf, bobotnilai); }; function render_nilaihuruf(value) { var val = RH.getRecordFieldValue(ds_setnilai, 'nilaihuruf', 'nilaihuruf', value); return RH.qtipEdit(val,'12px'); } /** =============THE GRID PROPERTIES ================================= */ var fields_mhsmk = RH.storeFields('idnilai','kdprodi', 'kdstsemester', 'kdmk', 'nidu', 'nim', 'nmmhs', 'kdjnskelamin','thnmasuk', 'kdstawalmhs','nmstawalmhs', 'idklsmhs','nmklsmhs', 'nilaihuruf','bobotnilai'); var ds_mhsmk = RH.JsonStore({ url : BASE_URL + 'matkuldosmhs_controller/get_mahasiswamk', fields : fields_mhsmk, limit: pageSize, params: [ {key:'kdprodi', value: kdprodi} ,{key:'kdstsemester', value: kdstsemester} ,{key:'kdmk', value: kdmk} ,{key:'nidu', value: nidu} ,{key:'idklsmhs', value: idklsmhs} ], enableSearch: false, }); var cm_mhsmk = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header:'idnilai', dataIndex:'idnilai', hidden:true }, { header: 'NPM', width:100, dataIndex: 'nim', sortable: true }, { header: 'Nama Mahasiswa', width: 150, dataIndex: 'nmmhs',sortable: true, }, { header: '(L/P)', width: 50, dataIndex: 'kdjnskelamin', }, { header: 'Tahun Masuk', width: 70, dataIndex: 'thnmasuk', sortable: true, hidden: !isMenuJadwal }, { header: 'Status Daftar', width: 75, dataIndex: 'nmstawalmhs', hidden: !isMenuJadwal }, { header: 'Kelas Mahasiswa', width:80, dataIndex: 'nmklsmhs', hidden: !isMenuJadwal }, { header: 'Nilai Huruf', width:80, dataIndex: 'nilaihuruf', renderer: render_nilaihuruf, editor: RH.getComboEditor('nilaihuruf', false, ds_setnilai, 'nilaihuruf', 'nilaihuruf', fnSelect), hidden: !isMenuNilai }, { header: 'Bobot Nilai', width:80, dataIndex: 'bobotnilai', xtype:'numbercolumn', hidden: !isMenuNilai }] ); // Selection Model var sm_mhsmk = new Ext.grid.RowSelectionModel({ singleSelect: true }); // Grid View var gv_mhsmk = new Ext.grid.GridView({emptyText: '< Belum ada Data >'}); /** GRID PANEL */ var gp_mhsmk = new Ext.grid.EditorGridPanel({ ds: ds_mhsmk, cm: cm_mhsmk, sm: sm_mhsmk, view: gv_mhsmk, clicksToEdit: 1, //for cell editing (single click =1, dblclick=2) forceFit: true, height: gpheight, //autoHeight: true, layout:'anchor', autoScroll:true, columnLines: true, loadMask: true, tbar:[{ xtype:'textfield', id:'hidden.idnilai', hidden:true }], bbar: new Ext.PagingToolbar({ store: ds_mhsmk, displayInfo: true, mode: 'local', pageSize: pageSize, displayMsg: 'Data {0} - {1} dari {2}', emptyMsg: "Belum ada data" }), listeners: { cellclick: onCellClick } }); return gp_mhsmk; function onCellClick(grid, rowIndex, columnIndex, e) { var record = grid.getStore().getAt(rowIndex); // Get the Record var idnilai = record.data['idnilai']; RH.setCompValue('hidden.idnilai', idnilai); } function updateNilai(nilaihuruf, bobotnilai){ Ext.Ajax.request({ url: BASE_URL + 'nilai_controller/update_nilai', params: { idnilai : RH.getCompValue('hidden.idnilai'), nilaihuruf : nilaihuruf, bobotnilai : bobotnilai }, success: function() { ds_mhsmk.reload(); }, failure: function() { Ext.Msg.alert("Info", "Ubah Data Gagal"); } }); } } /** DETIL#2b: JADWAL KULIAH ===================================== pJadwal.js */ /** DETIL#2c: JADWAL Ujian ===================================== pJadwal.js */