function pJadwalPerkuliahan(){ var pageTitle = 'Jadwal Kuliah & Ujian'; var pageIcon = 'silk-calendar'; var idcb_prodi = 'cb.prodi'; var idcb_stsemester = 'cb.stsemester'; var pnDosId = 'fp.detil-dosen'; var pnMhsId = 'fp.detil-mhs'; var pnJdwkulId = 'fp.detil-jdwkul'; var pnJdwujiId = 'fp.detil-jdwuji'; var pnMatkulHeight = 220; var pnDosHeight = 170; var pnMhsHeight = 326; var pnMhsTitle = 'Daftar Mahasiswa'; var DosenStat = 'Dosen Pengajar'; var IdDetObj = { dosen : pnDosId, mahasiswa : pnMhsId, jdwkul : pnJdwkulId, jdwuji : pnJdwujiId }; /** COMON STORES */ var ds_prodireg = store_prodireg(); var ds_stsmt = store_stsmt(); /** GRID PANEL MATKUL */ var gp_matkul = cMatkul(idcb_prodi, idcb_stsemester, IdDetObj, DosenStat); var fpMain = new Ext.Panel({ title: pageTitle, iconCls: pageIcon, buttonAlign: 'left', //bodyStyle: 'padding: 5px', border: true, layout:'border', labelWidth: 150, waitMsg: 'Waiting...', maskDisabled: false, monitorValid: true, autoScroll:true, frame: true, items: [{ layout: 'form', region:'north', height:40, //autoHeight:true, items:[ headerProdiSmt({ idcb_prodi : idcb_prodi, cb_prodi_width: 300, idcb_stsmt : idcb_stsemester, cb_stsmt_width : 150, space : 80, fnReload : function(){reloadGridMatkul();}, extracomp: false }), ] },{ layout: 'form', region:'center', autoScroll:true, items: [ { xtype: 'panel', layout:'fit', title:'Mata Kuliah', id:'fp.master', height:pnMatkulHeight, frame:true, items: [gp_matkul], }, RH.vSpacer(5), { xtype: 'panel', layout:'fit', hidden:false, height:pnDosHeight, frame:true, title:DosenStat, id: pnDosId, //items: [gp_dosen], }, RH.vSpacer(5), { xtype: 'panel', layout:'fit', height:200, frame:true, title:'Jadwal Kuliah (Waktu & Ruangan)', id: pnJdwkulId, },{ xtype:'fieldset', hidden:false, items:[ { xtype:'textfield', fieldLabel: 'Mata Kuliah', id:'info.nmmatkul', width: 350, disabled:true, }, { xtype:'hidden', id:'info.kdmatkul' } ] }] },{ layout: 'form', region:'east', width:'50%', margins:'0 0 0 10', split:true, autoScroll:true, items: [{ xtype: 'panel', layout:'fit', hidden:false, height:pnMhsHeight, frame:true, title: pnMhsTitle, id: pnMhsId, }, RH.vSpacer(5), { xtype: 'panel', layout:'fit', height:200, frame:true, title:'Jadwal Ujian (Waktu & Ruangan)', id: pnJdwujiId, },{ xtype:'fieldset', hidden:false, items:[ { xtype:'textfield', fieldLabel: DosenStat, id:'info.nmdos', width: 350, disabled:true, }, { xtype:'hidden', id:'info.nidu' }, { xtype:'hidden', id:'hidden.idkelas' } ] }] }] }); 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(); clearInfoMatkulDos(); //reload master-grid gp_matkul.store.reload({ params: { kdprodi: RH.getCompValue(idcb_prodi, true), kdstsemester: RH.getCompValue(idcb_stsemester, true) } }); } function clearInfoMatkulDos(){ RH.setCompValue('info.kdmatkul',''); RH.setCompValue('info.nmmatkul',''); RH.setCompValue('info.nidu',''); RH.setCompValue('info.nmdos',''); } /** MASTER: MATKUL from struprog ======================== */ function cMatkul(idcb_prodi, idcb_stsemester, IdDetObj, DosenStat){ var pageSize = 5; var nmmatkulWidth = 330; 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 + 'matkuldos_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: 'Jml.Dosen', width: 90, 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']; var nmmk = record.data['nmmkind']; removeMatkulDetails(); if (t.className == 'keyMasterDetail') { RH.setCompValue('info.kdmatkul',kdmk); RH.setCompValue('info.nmmatkul',nmmk); var gridPanelDet = cDosenMatkul(kdprodi, kdstsemester, kdmk, IdDetObj, DosenStat); RH.loadDetail(IdDetObj.dosen, gridPanelDet); } } function removeMatkulDetails(){ RH.removeDetail(IdDetObj.dosen); RH.removeDetail(IdDetObj.mahasiswa); RH.removeDetail(IdDetObj.jdwkul); RH.removeDetail(IdDetObj.jdwuji); } } /** DETIL#1: DOSEN ===================================== */ function cDosenMatkul(kdprodi, kdstsemester, kdmk, IdDetObj, DosenStat){ //var nidu = ''; //param for detail to jadwal var fields_dosmk = RH.storeFields('kdprodi', 'kdstsemester', 'kdmk', 'nidu', 'nidudisp', 'nmdosen', 'niduasist', 'nmdosasist', 'idkelas','nmkelas','nmklsmhs','jmlmhs'); //from struprogdet join dosen /** GRID STORE: DOSEN MATKUL */ var ds_dosmk = RH.JsonStore({ url : BASE_URL + 'matkuldos_controller/get_dosmk', fields : fields_dosmk, limit: 3, params: [ {key:'kdprodi', value: kdprodi} ,{key:'kdstsemester', value: kdstsemester} ,{key:'kdmk', value: kdmk} ,{key:'jdosen', value: DosenStat} ], 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
(Koordinator)
', width:90, dataIndex: 'nidudisp', renderer: RH.keyToDetil, sortable: true }, { header: 'Nama Dosen (Koordinator)', width: 170, dataIndex: 'nmdosen', sortable: true, }, { header: 'NIDU
(Asisten)
', width:90, dataIndex: 'niduasist', sortable: true }, { header: 'Nama Dosen (Asisten)', width: 170, dataIndex: 'nmdosasist', sortable: true, }, { header: 'Kelas Perkuliahan', width: 100, dataIndex: 'nmkelas', }, { header: 'Kelas Mahasiswa', width: 100, dataIndex: 'nmklsmhs', }, { header: 'Jml.Mahasiswa', width: 100, 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({ id:'gp_dosmk', 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 nmdosen = record.data['nmdosen']; var idkelas = record.data['idkelas']; var jmlmhs = record.data['jmlmhs']; removeDosenDetails(); if (t.className == 'keyMasterDetail') { RH.setCompValue('info.nidu',nidu); RH.setCompValue('info.nmdos',nmdosen); var gridPanelDet1 = cDaftarMahasiswa(kdprodi, kdstsemester, kdmk, nidu, idkelas); var gridPanelDet2 = cJadwalKuliah(kdprodi, kdstsemester, kdmk, nidu, idkelas, jmlmhs); var gridPanelDet3 = cJadwalUjian(kdprodi, kdstsemester, kdmk, nidu, idkelas, jmlmhs); RH.loadDetail(IdDetObj.mahasiswa, gridPanelDet1); RH.loadDetail(IdDetObj.jdwkul, gridPanelDet2); RH.loadDetail(IdDetObj.jdwuji, gridPanelDet3); } } function removeDosenDetails(){ RH.removeDetail(IdDetObj.mahasiswa); RH.removeDetail(IdDetObj.jdwkul); RH.removeDetail(IdDetObj.jdwuji); } } /** DETIL#2a: MAHASISWA from Nilai ===================================== */ function cDaftarMahasiswa(kdprodi, kdstsemester, kdmk, nidu, idkelas){ var pageSize = 10; var gpheight = 200; /** =============THE GRID PROPERTIES ================================= */ var fields_mhsmk = RH.storeFields('kdprodi', 'kdstsemester', 'kdmk', 'nidu', 'nim', 'nmmhs', 'kdjnskelamin','thnmasuk'); var ds_mhsmk = RH.JsonStore({ url : BASE_URL + 'absen_controller/get_absenmhs', fields : fields_mhsmk, limit: pageSize, params: [ {key:'kdprodi', value: kdprodi} ,{key:'kdstsemester', value: kdstsemester} ,{key:'kdmk', value: kdmk} ,{key:'nidu', value: nidu} ,{key:'idkelas', value: idkelas} ], enableSearch: false, }); var sb_mhsmk = RH.searchComp({ id: 'sb_mhsmk', fields : ['nim:NIM','nmmhs:Nama Mahasiswa', 'kdjnskelamin:Jenis Kelamin'], selected : 'nmmhs', store : ds_mhsmk, textWidth : 200 }); var cm_mhsmk = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header: 'NPM', width:130, dataIndex: 'nim', sortable: true }, { header: 'Nama Mahasiswa', width: 250, dataIndex: 'nmmhs',sortable: true, }, { header: '(L/P)', width: 35, dataIndex: 'kdjnskelamin', align:'center' }, { header: 'Thn.Masuk', width: 100, dataIndex: 'thnmasuk', sortable: true, align:'center' } ] ); /** GRID PANEL */ var gp_mhsmk = RH.EditorGridPanel_T1({ ds: ds_mhsmk, cm: cm_mhsmk, singleSelect: true, clicksToEdit: 1, searchComp: sb_mhsmk, allowAdd: false, pageSize: pageSize, cellclick: '', customButton: { xtype:'textfield', id:'hidden.idnilai', hidden:true }, }); return gp_mhsmk; } /** DETIL#: JADWAL KULIAH ===================================== */ function cJadwalKuliah(kdprodi, kdstsemester, kdmk, nidu, idkelas, jmlmhs){ var ds_hari = store_hari(); var ds_ruangan = store_ruangan(); var ds_tipekelas = store_tipekelas(); var ds_klsparalel = store_klsparalel(); var ds_grid = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'jadwal_controller/get_jamkul', method: 'POST' }), baseParams: { idjk:'' }, root: 'data', totalProperty: 'results', autoLoad: true, fields: [{ name: "idjam", mapping: "idjam" }, { name: "kdjam", mapping: "kdjam" }, { name: "darijam", mapping: "darijam" }, { name: "sampaijam", mapping: "sampaijam" }, { name: "pilih", mapping: "pilih", type: 'bool' }] }); var fields_jdwkul = RH.storeFields('idjk','kdprodi', 'kdstsemester', 'kdmk', 'nidu', 'idhari', 'nmhari','idjam', 'mulai','selesai', 'jmlmhs','idruangan', 'kdruangan', 'nmruangan','kapasitas','selisih','idtipekelas'); //from jadwalkuliah join ruangan /** GRID STORE: JADWAL KULIAH */ var pageSize = 3; var ds_jdwkul = RH.JsonStore({ url : BASE_URL + 'jadwal_controller/get_jadwalkuliah', fields : fields_jdwkul, limit: pageSize, params: [ {key:'kdprodi', value: kdprodi} ,{key:'kdstsemester', value: kdstsemester} ,{key:'kdmk', value: kdmk} ,{key:'nidu', value: nidu} ,{key:'idkelas', value: idkelas} ,{key:'jmlmhs', value: jmlmhs} ], enableSearch: false, }); /** GRID COLUMN MODEL */ var cm_jdwkul = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header: 'Hari', width:60, dataIndex: 'nmhari', sortable: true }, { header: 'Mulai', width: 60, dataIndex: 'mulai', align:'center' }, { header: 'Selesai', width: 60, dataIndex: 'selesai', align:'center' }, { header: 'Jml.Mahasiswa', width: 95, dataIndex: 'jmlmhs', align:'right' }, { header: 'Ruangan', width:60, dataIndex: 'nmruangan', }, { header: 'Kapasitas', width:60, dataIndex: 'kapasitas', align:'right' }, { header: 'Selisih', width:60, dataIndex: 'selisih', align:'right' }, RH.EditColumn() , RH.DeleteColumn() ] ); var allowadd =(idkelas==null) ? false:true; /** GRID PANEL */ var gp_jdwkul = RH.GridPanel_T1({ id: 'gp_jdwkul', ds: ds_jdwkul, cm: cm_jdwkul, singleSelect: true, searchComp: ['->',{ xtype:'button', text: 'Salin Jadwal Kuliah Dari Semester Sebelumnya', id:'copyjadwalkul', iconCls: 'silk-page-copy', margins:'0 0 0 0', handler:function(){ if (gp_jdwkul.getStore().getCount() > 0) { Ext.MessageBox.alert("Informasi", "Jadwal Kuliah Sudah Ada, Hapus Terlebih Dahulu"); } else { fnCopyJadwalKul(kdprodi, kdstsemester, kdmk, idkelas); } } }], allowAdd: allowadd, fnAdd: fnAddEntry, pageSize: pageSize, cellclick: onCellJdwkulClick });return gp_jdwkul; function onCellJdwkulClick(grid, rowIndex, columnIndex, e) { var record = grid.getStore().getAt(rowIndex); RH.EditClick(e, function(){fnEditEntry(grid, record)}); RH.DeleteClick(e, function(){fnDeleteJdwkul(grid, record)}); } function fnDeleteJdwkul(grid, record){ var url = BASE_URL + 'jadwal_controller/delete_jadwalkuliah'; var params = new Object({ idjk : record.data['idjk'] }); RH.deleteGridRecord(url, params, grid ); } /** ACTION JADWAL-UJIAN */ function fnAddEntry(){ var grid = gp_jdwkul; fnGetEntry(grid, null); } function fnEditEntry(grid, record){ fnGetEntry(grid, record); } /** FORM ENTRY JADWAL-KULIAH */ function fnGetEntry(grid, record){ var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column defaults: { sortable: true // columns are not sortable by default }, columns: [ { xtype: 'checkcolumn', header: '
Pilih
', width: 40, dataIndex: 'pilih', sortable: true }, { header: '
Jam
Ke-
', width: 40, dataIndex: 'kdjam', sortable: true, align: 'center' }, { header: '
Dari Jam
', width: 70, dataIndex: 'darijam', editor: new Ext.form.TextField({ //allowBlank: false, id: 'darijam', enableKeyEvents: true, listeners: { change: function(){ //absolutesp(); // Function call on event change } } }), sortable: true }, { header: '
Sampai Jam
', width: 80, dataIndex: 'sampaijam', editor: new Ext.form.TextField({ //allowBlank: false, id: 'sampaijam', enableKeyEvents: true, listeners: { change: function(){ //absolutesp(); // Function call on event change } } }), sortable: true } ] }); var grid_nya = new Ext.grid.EditorGridPanel({ store: ds_grid, frame: false, autoScroll: true, height: 385, autoWidth: true, id: 'gridjamkuliah', buttonAlign: 'left', defaults: { anchor: '-10' }, forceFit: true, columnLines: true, loadMask: true, cm: cm, clicksToEdit: 1, listeners: { rowdblclick: function rowdblClick(grid, rowIdx) { } } }); var fAddJdwkul = new Ext.form.FormPanel({ xtype:'form', id: 'frm.addJdwkul', buttonAlign: 'left', labelWidth: 120, labelAlign: 'right', bodyStyle: 'padding:3px 3px 3px 3px', // atas, kanan, bawah, kiri monitorValid: true, height: 500, width: 700, layout: 'column', frame: false, defaultType:'textfield', items: [{ columnWidth: .55, xtype: 'panel', border: false, bodyStyle: 'padding:0px 0px 0px 0px', items: [{ layout: 'form', border: false, items: [{ xtype: 'fieldset', title: 'Waktu', layout: 'form', id:'fswaktu', height: 450, items: [{ xtype: 'combo', id: 'cb.frm.hari', fieldLabel: 'Hari', width: 150, store: ds_hari, valueField: 'kode', displayField: 'nama', triggerAction: 'all', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', allowBlank: false, editable: false, },{ xtype:'container', layout:'hbox', fieldLabel: 'Jam', items:[grid_nya] }] }] }] }, { columnWidth: .45, xtype: 'panel', border: false, bodyStyle: 'padding:0px 0px 0px 0px', items: [{ layout: 'form', border: false, items: [{ xtype: 'fieldset', title: 'Ruangan', layout: 'form', id:'fstempat', height: 450, items: [{ xtype: 'combo', id: 'cb.frm.ruangan', fieldLabel: 'Ruangan', width: 150, store: ds_ruangan, valueField: 'idruangan', displayField: 'nmruangan', forceSelection: true, submitValue: true, mode: 'local', triggerAction: 'all', emptyText:'Pilih...', editable: false, allowBlank: false, listeners:{ scope: this, select: cb_ruangan_selected } }, { id: 'tf.frm.tiperuangan', xtype:'textfield', fieldLabel: 'Tipe Ruangan', width: 80, disabled: true, align:'right' }, { xtype: 'combo', id: 'cb.frm.tipekelas', fieldLabel: 'Tipe Kelas', width: 150, store: ds_tipekelas, valueField: 'idtipekelas', displayField: 'nmtipekelas', forceSelection: true, submitValue: true, mode: 'local', triggerAction: 'all', emptyText:'Pilih...', editable: false, allowBlank: false, listeners:{ } }, { id: 'nf.frm.jmlmhs', xtype:'numberfield', fieldLabel: 'Jumlah Mahasiswa', value:jmlmhs, width: 80, disabled: true, align:'right' }, { id: 'nf.frm.kapasitas', xtype:'numberfield', fieldLabel: 'Kapasitas', width: 80, disabled: true, align:'right' }, { id: 'nf.frm.selisih', xtype:'numberfield', width: 80, disabled: true, align:'right' }, { xtype:'label', id:'lb.infokapasitas', margins: '0 0 0 0', text:'', style: 'color: black;font-size:12px;', } /* RH.ActionCombo({ id: 'cb.frm.klsparalel', label: 'Kelas Paralel', width: 80, data: ds_klsparalel, key: 'klsparalel', display: 'klsparalel', cannotEmpty:true, fnSelect: cb_klsparalel_selected }), { xtype: 'combo', id: 'cb.frm.ruangan', fieldLabel: 'Ruangan', width: 150, store: ds_ruangan, valueField: 'idruangan', displayField: 'nmruangan', forceSelection: true, submitValue: true, mode: 'local', triggerAction: 'all', emptyText:'Pilih...', editable: false, allowBlank: false, listeners:{ scope: this, select: cb_ruangan_selected } },*/] }] }] }], buttons: [{ text: 'Simpan', iconCls:'silk-save', id:'btn-simpan-kuliah', handler: function() { if (record) { fnUpdateJdwkul('frm.addJdwkul',record.get('idjk')); } else { var waitmsg = Ext.MessageBox.wait('Checking...', 'Info'); Ext.Ajax.request({ url: BASE_URL + 'jadwal_controller/cek_harijadwalkul', method: 'POST', params: { kdprodi : kdprodi, kdstsemester: kdstsemester, kdmk : kdmk, nidu : nidu, idkelas : idkelas, idhari : Ext.getCmp('cb.frm.hari').getValue() }, success: function(response) { waitmsg.hide(); Hari = response.responseText; comboHari = Ext.getCmp('cb.frm.hari').getRawValue(); if (Hari=='1') { Ext.MessageBox.alert('Informasi', 'Jadwal Kuliah untuk hari ' + comboHari +' Sudah ada'); } else { fnSaveJdwkul('frm.addJdwkul'); } } }); } } }, { text: 'Kembali', iconCls:'silk-arrow-undo', handler: function() { wAddJdwkul.close(); } }] }); var wAddJdwkul = new Ext.Window({ title: 'Jadwal Kuliah', modal: true, closable:false, items: [fAddJdwkul] }).show(); /* function cb_klsparalel_selected(combo, records){ var klsparalel = records.data['klsparalel']; Ext.Ajax.request({ url: BASE_URL + 'jadwal_controller/get_jmlmhs', method: 'POST', params :{ kdstsemester: kdstsemester, kdprodi : kdprodi, kdmk : kdmk, nidu : nidu, idkelas : idkelas, klsparalel : klsparalel }, scope: this, async:false, waitMsg: "sedang proses...", success: function(result){ var jsonData = Ext.decode(result.responseText); //bisa utk Ext3 dan Ext4 var jmlmhs = jsonData.jmlmhs; RH.setCompValue('nf.frm.jmlmhs', jmlmhs); var kapasitas = RH.getCompValue('nf.frm.kapasitas'); if(kapasitas!=null && kapasitas !=''){ setSelisihAndInfo(kapasitas, jmlmhs); } } }); } */ if (record) { //JIKA UPDATE var nmtiperuangan = RH.getRecordFieldValue(ds_ruangan, 'nmtiperuangan', 'idruangan', record.get("idruangan")); var kapasitas = RH.getRecordFieldValue(ds_ruangan, 'kapasitas', 'idruangan', record.get("idruangan")); RH.setCompValue('cb.frm.hari', record.data['idhari']); ds_grid.removeAll(); ds_grid.reload({ params: { idjk: record.data['idjk'], } }); RH.setCompValue('cb.frm.ruangan', record.data['idruangan']); RH.setCompValue('cb.frm.tipekelas', record.data['idtipekelas']); RH.setCompValue('tf.frm.tiperuangan', nmtiperuangan); RH.setCompValue('nf.frm.jmlmhs', record.get("jmlmhs")); RH.setCompValue('nf.frm.kapasitas', kapasitas); setSelisihAndInfo(kapasitas, RH.getCompValue('nf.frm.jmlmhs')); } else { ds_grid.removeAll(); ds_grid.reload({ params: { idjk: null, } }); } function cb_ruangan_selected(combo, records){ var tiperuangan = records.data['nmtiperuangan']; var kapasitas = records.data['kapasitas']; var jmlmhs = RH.getCompValue('nf.frm.jmlmhs'); RH.setCompValue('tf.frm.tiperuangan', tiperuangan); RH.setCompValue('nf.frm.kapasitas', kapasitas); setSelisihAndInfo(kapasitas, jmlmhs); } function setSelisihAndInfo(kapasitas, jmlmhs){ var selisih = kapasitas - jmlmhs; var info = ''; if(kapasitas > jmlmhs) { info = 'Kapasitas Ruangan Masih Cukup'; Ext.getCmp('btn-simpan-kuliah').enable(); } if(kapasitas == jmlmhs) { info = 'Ruangan Sudah Penuh'; Ext.getCmp('btn-simpan-kuliah').enable(); } if(kapasitas < jmlmhs) { info = 'Kapasitas Ruangan Tidak Cukup!'; Ext.getCmp('btn-simpan-kuliah').disable();} RH.setCompValue('nf.frm.selisih', selisih); Ext.getCmp('lb.infokapasitas').setText(info); } function fnSaveJdwkul(namaForm){ var waktu = get_waktu(); var sParams = new Object({ idkelas : idkelas, idtipekelas : RH.getCompValue('cb.frm.tipekelas'), kdstsemester: kdstsemester, kdprodi : kdprodi, mat_kdprodi : kdprodi, kdmk : kdmk, nidu : nidu, idhari : RH.getCompValue('cb.frm.hari'), idruangan : RH.getCompValue('cb.frm.ruangan'), waktu : waktu }); var form_nya = Ext.getCmp(namaForm); form_nya.getForm().submit({ url: BASE_URL + 'jadwal_controller/insert_jadwalkuliah', method: 'POST', params: sParams, waitMsg: 'Menyimpan Data...', success: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Berhasil"); wAddJdwkul.close(); ds_jdwkul.reload(); }, failure: function() { Ext.MessageBox.alert("Informasi", "SImpan Data Gagal"); } }); } function fnUpdateJdwkul(namaForm, idjk){ var waktu = get_waktu(); var sParams = new Object({ idjk : idjk, idtipekelas : RH.getCompValue('cb.frm.tipekelas'), idhari : RH.getCompValue('cb.frm.hari'), idruangan : RH.getCompValue('cb.frm.ruangan'), waktu : waktu }); var form_nya = Ext.getCmp(namaForm); form_nya.getForm().submit({ url: BASE_URL + 'jadwal_controller/update_jadwalkuliah', method: 'POST', params: sParams, waitMsg: 'Mengupdate Data...', success: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Berhasil"); wAddJdwkul.close(); ds_jdwkul.reload(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Gagal"); } }); } function get_waktu() { var par=''; var a= 1; var c = ';'; grid_nya.getStore().each(function(rec){ // ambil seluruh grid prodi var rowData = rec.data; if (a == grid_nya.getStore().getCount()) { c = '' } var j = (rowData['pilih']) ? 1 : 0; par += rowData['idjam'] + 'x' + rowData['darijam'] + 'x' + rowData['sampaijam'] + 'x' + j + 'x' + // pilih c; a= a+1; }); return par; } } //COPY JADWAL KULIAH function fnCopyJadwalKul(kdprodi, kdstsemester, kdmk, idkelas){ var ds_listjadwal = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'jadwal_controller/get_jadwalkulcopy', method: 'POST' }), baseParams: { kdprodi:kdprodi, kdstsemester:kdstsemester, kdmk:kdmk, idkelas:idkelas }, totalProperty: 'results', autoLoad : true, root: 'data', fields: [ { name: "idjk"} , { name: "kdstsemester"} , { name: "nmthnakademik"} , { name: "idhari"} , { name: "nmhari"} , { name: "darijam"} , { name: "sampaijam" } , { name: "idruangan" } , { name: "nmruangan" } ], listeners: { load: function(store, records, options) { } } }); var cm_listjadwal = new Ext.grid.ColumnModel([ { xtype: 'actioncolumn', width: 50, header: '
Pilih
', align:'center', items: [{ getClass: function(v, meta, record) { meta.attr = "style='cursor:pointer;'"; }, icon : 'resources/img/icons/fam/accept.png', tooltip: 'Pilih Jadwal Kuliah', handler: function(grid, rowIndex) { var data = ds_listjadwal.getAt(rowIndex); var waitcopyjadwalkul = Ext.MessageBox.wait('Menyalin Data Jadwal Kuliah...', 'Informasi'); Ext.Ajax.request({ url: BASE_URL + 'jadwal_controller/copy_jadwalkul', params: { idjklama: data.get('idjk'), kdprodi: kdprodi, kdmk: kdmk, idkelas: idkelas, kdstsemesterlama: data.get('kdstsemester'), kdstsemesterbaru: kdstsemester, nidubaru: nidu, }, success: function() { waitcopyjadwalkul.hide(); Ext.MessageBox.alert("Informasi", "Salin Data Berhasil"); wlistjadwal.close(); ds_jdwkul.reload(); }, failure: function() { waitcopyjadwalkul.hide(); Ext.MessageBox.alert("Informasi", "Salin Data Gagal"); } }); } }] }, { header: 'Tahun Akademik - Semester', width: 150, dataIndex: 'nmthnakademik', sortable: true }, { header: 'Hari', width: 80, dataIndex: 'nmhari', sortable: true }, { header: 'Mulai', width: 70, dataIndex: 'darijam', sortable: true, }, { header: 'Selesai', width: 80, dataIndex: 'sampaijam', sortable: true }, { header: 'Ruangan', width: 100, dataIndex: 'nmruangan', sortable: true }] ); var cari_listjadwal = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'local', width: 200 })]; var gp_listjadwal = new Ext.grid.GridPanel({ id: 'gp.listjadwal', ds: ds_listjadwal, cm: cm_listjadwal, plugins: cari_listjadwal, sm: new Ext.grid.RowSelectionModel({ singleSelect: true}), view: new Ext.grid.GridView({ emptyText: '< Belum ada Data >'}), forceFit: true, height: 160, //width: 720, border: true, tbar: ['->'], //bbar: [], autoScroll: true, autoSizeColumns: true, enableColumnResize: true, enableColumnHide: false, enableColumnMove: false, enableHdaccess: false, columnLines: true, loadMask: true, layout: 'anchor', }); var wlistjadwal = new Ext.Window({ title: 'Daftar Jadwal Kuliah Semester Sebelumnya', modal: true, resizable: false, layout: 'fit', width:550, height:220, items: [gp_listjadwal] }).show(); } } /** DETIL#: JADWAL Ujian ===================================== */ function cJadwalUjian(kdprodi, kdstsemester, kdmk, nidu, idkelas, jmlmhs){ var ds_hari = store_hari(); var ds_ruangan = store_ruangan(); var ds_jujian = store_jujian(); var ds_klsparalel = store_klsparalel(); var ds_grid = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'jadwal_controller/get_jamuj', method: 'POST' }), baseParams: { idju:'' }, root: 'data', totalProperty: 'results', autoLoad: true, fields: [{ name: "idjam", mapping: "idjam" }, { name: "kdjam", mapping: "kdjam" }, { name: "darijam", mapping: "darijam" }, { name: "sampaijam", mapping: "sampaijam" }, { name: "pilih", mapping: "pilih", type: 'bool' }] }); var fields_jdwuji = RH.storeFields('idju','kdprodi', 'kdstsemester', 'kdmk', 'nidu','tglujian','idjnsujian','nmjnsujian', 'mulai','selesai', 'jmlmhs','idruangan', 'kdruangan', 'nmruangan','kapasitas','selisih','susulan'); /** GRID STORE: JADWAL UJIAN */ var pageSize = 3; var ds_jdwuji = RH.JsonStore({ url : BASE_URL + 'jadwal_controller/get_jadwalujian', fields : fields_jdwuji, limit: pageSize, params: [ {key:'kdprodi', value: kdprodi} ,{key:'kdstsemester', value: kdstsemester} ,{key:'kdmk', value: kdmk} ,{key:'nidu', value: nidu} ,{key:'idkelas', value: idkelas} ,{key:'jmlmhs', value: jmlmhs} ], enableSearch: false, }); /** GRID COLUMN MODEL */ var cm_jdwuji = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header: 'Hari', width:60, dataIndex: 'nmhari', hidden:true, sortable: true }, { header: 'Jenis Ujian', width: 90, dataIndex: 'nmjnsujian'//'nmjnsujian', }, { header: 'Tanggal', width:80, dataIndex: 'tglujian',sortable: true, //renderer: RH.convertToDate }, { header: 'Mulai', width: 60, dataIndex: 'mulai', align:'center' }, { header: 'Selesai', width: 60, dataIndex: 'selesai', align:'center' }, { header: 'Kelas Paralel', width: 60, hidden:true, dataIndex: 'klsparalel', align:'center' }, { header: 'Jml.Mahasiswa', width: 95, dataIndex: 'jmlmhs', align:'right' }, { header: 'Ruangan', width:70, dataIndex: 'nmruangan', }, { header: 'Kapasitas', width:65, dataIndex: 'kapasitas', align:'right' }, { header: 'Selisih', width:50, dataIndex: 'selisih', align:'right' }, { header: 'Susulan', width:60, dataIndex: 'susulan', align:'center', renderer: function(value){ return (value=='1') ? "Ya":"Tidak"; } }, RH.EditColumn() , RH.DeleteColumn() ] ); /** GRID PANEL */ var gp_jdwuji = RH.GridPanel_T1({ ds: ds_jdwuji, cm: cm_jdwuji, singleSelect: true, searchComp: { xtype:'tbfill'}, allowAdd: true, fnAdd: fnAddEntry, pageSize: pageSize, cellclick: onCellJdwujiClick });return gp_jdwuji; function onCellJdwujiClick(grid, rowIndex, columnIndex, e) { var record = grid.getStore().getAt(rowIndex); RH.EditClick(e, function(){fnEditEntry(grid, record)}); RH.DeleteClick(e, function(){fnDeleteJdwuji(grid, record)}); } function fnDeleteJdwuji(grid, record){ var url = BASE_URL + 'jadwal_controller/delete_jadwalujian'; var params = new Object({ idju : record.data['idju'] }); RH.deleteGridRecord(url, params, grid ); } /** ACTION JADWAL-UJIAN */ function fnAddEntry(){ var grid = gp_jdwuji; fnGetEntry(grid, null); } function fnEditEntry(grid, record){ fnGetEntry(grid, record); } /** FORM ENTRY JADWAL-UJIAN */ function fnGetEntry(grid, record){ var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column defaults: { sortable: true // columns are not sortable by default }, columns: [ { xtype: 'checkcolumn', header: '
Pilih
', width: 40, dataIndex: 'pilih', sortable: true }, { header: '
Jam
Ke-
', width: 40, dataIndex: 'kdjam', sortable: true, align: 'center' }, { header: '
Dari Jam
', width: 70, dataIndex: 'darijam', editor: new Ext.form.TextField({ //allowBlank: false, id: 'darijam', enableKeyEvents: true, listeners: { change: function(){ //absolutesp(); // Function call on event change } } }), sortable: true }, { header: '
Sampai Jam
', width: 80, dataIndex: 'sampaijam', editor: new Ext.form.TextField({ //allowBlank: false, id: 'sampaijam', enableKeyEvents: true, listeners: { change: function(){ //absolutesp(); // Function call on event change } } }), sortable: true } ] }); var grid_nya = new Ext.grid.EditorGridPanel({ store: ds_grid, frame: false, autoScroll: true, height: 385, autoWidth: true, id: 'gridjamkuliah', buttonAlign: 'left', defaults: { anchor: '-10' }, forceFit: true, columnLines: true, loadMask: true, cm: cm, clicksToEdit: 1, listeners: { rowdblclick: function rowdblClick(grid, rowIdx) { } } }); var fAddJdwuj = new Ext.form.FormPanel({ xtype:'form', id: 'frm.addJdwuj', buttonAlign: 'left', labelWidth: 120, labelAlign: 'right', bodyStyle: 'padding:3px 3px 3px 3px', // atas, kanan, bawah, kiri monitorValid: true, height: 500, width: 700, layout: 'column', frame: false, defaultType:'textfield', items: [{ columnWidth: .55, xtype: 'panel', border: false, bodyStyle: 'padding:0px 0px 0px 0px', items: [{ layout: 'form', border: false, items: [{ xtype: 'fieldset', title: 'Waktu', layout: 'form', id:'fswaktu', height: 450, items: [{ xtype: 'compositefield', fieldLabel: 'Tanggal Ujian', items: [{ xtype: 'datefield', id: 'df.frm.tgl', fieldLabel: 'Tanggal Ujian', value: new Date(), width: 100 }, { xtype:'checkbox', boxLabel: 'Susulan', name: 'cbxsusulan', id: 'cbxsusulan', listeners: { check : function(cb, value) { } } }] },{ xtype:'container', layout:'hbox', fieldLabel: 'Jam', items:[grid_nya] }] }] }] }, { columnWidth: .45, xtype: 'panel', border: false, bodyStyle: 'padding:0px 0px 0px 0px', items: [{ layout: 'form', border: false, items: [{ xtype: 'fieldset', title: 'Ruangan', layout: 'form', id:'fstempat', height: 450, items: [ { xtype: 'combo', id: 'cb.frm.jujian', fieldLabel: 'Jenis Ujian', width: 150, store: ds_jujian, valueField: 'idjnsujian', displayField: 'nmjnsujian', forceSelection: true, submitValue: true, mode: 'local', triggerAction: 'all', emptyText:'Pilih...', editable: false, allowBlank: false, listeners:{ } }, RH.ActionCombo({ id: 'cb.frm.ruangan', label: 'Ruangan', width: 150, data: ds_ruangan, key: 'idruangan', display: 'nmruangan', cannotEmpty:true, fnSelect: cb_ruangan_selected }), { id: 'tf.frm.tiperuangan', xtype:'textfield', fieldLabel: 'Tipe Ruangan', width: 80, disabled: true, align:'right' }, { id: 'nf.frm.jmlmhs', xtype:'numberfield', fieldLabel: 'Jumlah Mahasiswa', value:jmlmhs, width: 80, disabled: true, align:'right' }, { id: 'nf.frm.kapasitas', xtype:'numberfield', fieldLabel: 'Kapasitas', width: 80, disabled: true, align:'right' }, { id: 'nf.frm.selisih', xtype:'numberfield', width: 80, disabled: true, align:'right' }, { xtype:'label', id:'lb.infokapasitas', margins: '0 0 0 0', text:'', style: 'color: black;font-size:12px;', } /* RH.ActionCombo({ id: 'cb.frm.klsparalel', label: 'Kelas Paralel', width: 80, data: ds_klsparalel, key: 'klsparalel', display: 'klsparalel', cannotEmpty:true, fnSelect: cb_klsparalel_selected }), { xtype: 'combo', id: 'cb.frm.ruangan', fieldLabel: 'Ruangan', width: 150, store: ds_ruangan, valueField: 'idruangan', displayField: 'nmruangan', forceSelection: true, submitValue: true, mode: 'local', triggerAction: 'all', emptyText:'Pilih...', editable: false, allowBlank: false, listeners:{ scope: this, select: cb_ruangan_selected } },*/] }] }] }], buttons: [{ text: 'Simpan', iconCls:'silk-save', id:'btn-simpan-ujian', handler: function() { if (record) { fnUpdateJdwUj('frm.addJdwuj',record.get('idju')); } else { var idjnsujian = Ext.getCmp('cb.frm.jujian').getValue(); var nmjnsujian = Ext.getCmp('cb.frm.jujian').getRawValue(); var tglujian = Ext.getCmp('df.frm.tgl').getValue(); var susulan = (RH.getCompValue('cbxsusulan')==true) ? '1':'0'; var nmsusulan = (RH.getCompValue('cbxsusulan')==true) ? ' Susulan ':' '; var waitmsg = Ext.MessageBox.wait('Checking...', 'Info'); Ext.Ajax.request({ url: BASE_URL + 'jadwal_controller/cek_tgljadwaluj', method: 'POST', params: { kdprodi : kdprodi, kdstsemester: kdstsemester, kdmk : kdmk, nidu : nidu, idjnsujian : idjnsujian, susulan : susulan, tglujian : tglujian, idkelas : idkelas }, success: function(response) { waitmsg.hide(); var r = Ext.decode(response.responseText); if (r.jum=='1') { Ext.MessageBox.alert('Informasi', 'Jadwal Ujian untuk tanggal ' + r.disptgl + ' dan Jenis Ujian ' + nmjnsujian + nmsusulan + 'Sudah ada'); } else { fnSaveJdwuj('frm.addJdwuj'); } } }); } } }, { text: 'Kembali', iconCls:'silk-arrow-undo', handler: function() { wAddJdwuj.close(); } }] }); var wAddJdwuj = new Ext.Window({ title: 'Jadwal Ujian', modal: true, closable:false, items: [fAddJdwuj] }).show(); /* function cb_klsparalel_selected(combo, records){ var klsparalel = records.data['klsparalel']; Ext.Ajax.request({ url: BASE_URL + 'jadwal_controller/get_jmlmhs', method: 'POST', params :{ kdstsemester: kdstsemester, kdprodi : kdprodi, kdmk : kdmk, nidu : nidu, idkelas : idkelas, klsparalel : klsparalel }, scope: this, async:false, waitMsg: "sedang proses...", success: function(result){ var jsonData = Ext.decode(result.responseText); //bisa utk Ext3 dan Ext4 var jmlmhs = jsonData.jmlmhs; RH.setCompValue('nf.frm.jmlmhs', jmlmhs); var kapasitas = RH.getCompValue('nf.frm.kapasitas'); if(kapasitas!=null && kapasitas !=''){ setSelisihAndInfo(kapasitas, jmlmhs); } } }); } */ if (record) { //JIKA UPDATE var nmtiperuangan = RH.getRecordFieldValue(ds_ruangan, 'nmtiperuangan', 'idruangan', record.get("idruangan")); var kapasitas = RH.getRecordFieldValue(ds_ruangan, 'kapasitas', 'idruangan', record.get("idruangan")); RH.setCompValue('df.frm.tgl', record.data['tglujian']); ds_grid.removeAll(); ds_grid.reload({ params: { idju: record.data['idju'], } }); RH.setCompValue('cb.frm.jujian', record.data['idjnsujian']); RH.setCompValue('cbxsusulan', (record.data['susulan']=='1') ? true:false); RH.setCompValue('cb.frm.ruangan', record.data['idruangan']); RH.setCompValue('tf.frm.tiperuangan', nmtiperuangan); RH.setCompValue('nf.frm.jmlmhs', record.get("jmlmhs")); RH.setCompValue('nf.frm.kapasitas', kapasitas); setSelisihAndInfo(kapasitas, RH.getCompValue('nf.frm.jmlmhs')); } else { ds_grid.removeAll(); ds_grid.reload({ params: { idju: null, } }); } function cb_ruangan_selected(combo, records){ var tiperuangan = records.data['nmtiperuangan']; var kapasitas = records.data['kapasitas']; var jmlmhs = RH.getCompValue('nf.frm.jmlmhs'); RH.setCompValue('tf.frm.tiperuangan', tiperuangan); RH.setCompValue('nf.frm.kapasitas', kapasitas); setSelisihAndInfo(kapasitas, jmlmhs); } function setSelisihAndInfo(kapasitas, jmlmhs){ var selisih = kapasitas - jmlmhs; var info = ''; if(kapasitas > jmlmhs) { info = 'Kapasitas Ruangan Masih Cukup'; Ext.getCmp('btn-simpan-ujian').enable(); } if(kapasitas == jmlmhs) { info = 'Ruangan Sudah Penuh'; Ext.getCmp('btn-simpan-ujian').enable(); } if(kapasitas < jmlmhs) { info = 'Kapasitas Ruangan Tidak Cukup!'; Ext.getCmp('btn-simpan-ujian').disable();} RH.setCompValue('nf.frm.selisih', selisih); Ext.getCmp('lb.infokapasitas').setText(info); } function fnSaveJdwuj(namaForm){ var waktu = get_waktu(); var sParams = new Object({ idjnsujian : RH.getCompValue('cb.frm.jujian'), susulan : (RH.getCompValue('cbxsusulan')==true) ? '1':'0', kdstsemester: kdstsemester, kdprodi : kdprodi, mat_kdprodi : kdprodi, kdmk : kdmk, nidu : nidu, tglujian : RH.getCompValue('df.frm.tgl'), idruangan : RH.getCompValue('cb.frm.ruangan'), idkelas : idkelas, waktu : waktu }); var form_nya = Ext.getCmp(namaForm); form_nya.getForm().submit({ url: BASE_URL + 'jadwal_controller/insert_jadwalujian', method: 'POST', params: sParams, waitMsg: 'Menyimpan Data...', success: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Berhasil"); wAddJdwuj.close(); ds_jdwuji.reload(); }, failure: function() { Ext.MessageBox.alert("Informasi", "SImpan Data Gagal"); } }); } function fnUpdateJdwUj(namaForm,idju){ var waktu = get_waktu(); var sParams = new Object({ idju : idju, idjnsujian : RH.getCompValue('cb.frm.jujian'), susulan : (RH.getCompValue('cbxsusulan')==true) ? '1':'0', tglujian : RH.getCompValue('df.frm.tgl'), idruangan : RH.getCompValue('cb.frm.ruangan'), waktu : waktu }); var form_nya = Ext.getCmp(namaForm); form_nya.getForm().submit({ url: BASE_URL + 'jadwal_controller/update_jadwalujian', method: 'POST', params: sParams, waitMsg: 'Mengupdate Data...', success: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Berhasil"); wAddJdwuj.close(); ds_jdwuji.reload(); }, failure: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Gagal"); } }); } function get_waktu() { var par=''; var a= 1; var c = ';'; grid_nya.getStore().each(function(rec){ // ambil seluruh grid prodi var rowData = rec.data; if (a == grid_nya.getStore().getCount()) { c = '' } var j = (rowData['pilih']) ? 1 : 0; par += rowData['idjam'] + 'x' + rowData['darijam'] + 'x' + rowData['sampaijam'] + 'x' + j + 'x' + // pilih c; a= a+1; }); return par; } } } }