function pKurikulum(){
/** COMMON STORES */
var ds_prodireg = store_prodireg();
var ds_years = store_tahun();
/** STORE for GRID COLUMN EDITOR type COMBO */
var dcUrl = BASE_URL + 'data_controller/';
var obj2Fields = new Object([
{ name: 'kode' }, { name: 'nama' }
]);
var obj4Fields = new Object([
{ name: 'id' }, { name: 'kode' }, { name: 'nama' }, { name: 'deskripsi' }
]);
var ds_jkurikulum = RH.getCommonJsonStore(obj2Fields, dcUrl + 'get_jkurikulum');
var ds_jmatkul = RH.getCommonJsonStore(obj2Fields, dcUrl + 'get_jmatkul');
var ds_stmatkul = RH.getCommonJsonStore(obj2Fields, dcUrl + 'get_stmatkul');
var ds_semester = RH.getCommonJsonStore(obj4Fields, dcUrl + 'get_semester');
var arr_nilaimin = [['4', 'A'],['3', 'B'],['2', 'C'],['1', 'D'],['0', 'E'],['0', 'T']];
var ds_nilaimin = new Ext.data.ArrayStore({
fields: ['angkanilai', 'hurufnilai'],
data : arr_nilaimin
});
var storesObj = {jkurikulum:ds_jkurikulum, jmatkul:ds_jmatkul};
/** MAIN GRID STORE: DS_KURIKULUM */
var fields_kur = RH.storeFields('idkurikulum','kdprodi','thnmasuk','kdmk','nmmkind','idsemester',
'jmlsks','skstatapmuka','skspraktikum','sksprakteklap',
'jnskurikulum','jnsmk','stmk','nilaihurufmin','bobotnilaimin');
var pageSize = 15;
var ds_kur = RH.JsonStore({
url : BASE_URL + 'kurikulum_controller/get_kurikulum',
fields : fields_kur,
limit: pageSize,
params: [
{key:'kdprodi', id:'cb.prodi-kur'}
,{key:'thnmasuk', id:'cb.thmasuk-kur'}
],
enableSearch: true,
});
ds_kur.on('beforeload', function(){ RH.removeDetail('fp.detilkur') });
//SEARCH COMPONENT
var sb_kur = RH.searchComp({
id: 'sb_kur',
fields : ['kdmk:Kode Mata Kuliah','nmmkind:Nama Mata Kuliah (Ind)'],
selected : 'nmmkind',
store : ds_kur,
textWidth : 250
});
/**
THE GRID COLUMN =====================================
*/
/** RENDERER for GRID COLUMN */
function render_jkurikulum(value) {
//RH.getRecordFieldValue(store, field, key, value)
var val = RH.getRecordFieldValue(ds_jkurikulum, 'nama', 'kode', value);
return RH.qtipEdit(val,'12px');
}
function render_jmatkul(value) {
var val = RH.getRecordFieldValue(ds_jmatkul, 'nama', 'kode', value);
return RH.qtipEdit(val,'12px');
}
function render_stmatkul(value) {
var val = RH.getRecordFieldValue(ds_stmatkul, 'nama', 'kode', value);
return RH.qtipEdit(val,'12px');
}
function render_semester(value) {
var val = RH.getRecordFieldValue(ds_semester, 'nama', 'kode', value);
return RH.qtipEdit(val,'12px');
}
function render_numEdit(value) {
return RH.qtipEdit(value,'12px');
}
function render_nilaimin(value) {
//RH.getRecordFieldValue(store, field, key, value)
return RH.qtipEdit(value,'12px');
}
/** FUNCTION for GRID COLUMN EDITOR */
var fnSelect = function(combo, record){
//The ID of THE combo must equals the field (key) to be updated
var field = combo.getId();
var value = '';
if(record.data['kode'])
value = record.data['kode'];
if(record.data['id'])
value = record.data['id'];
//Update Kurikulum set the field with the value
updateKurikulum(field, value);
};
var fnChange = function(numfield, newValue, oldValue){
//The ID of THE textField or NumberField must equals the field (key) to be updated
var field = this.getId();
var value = Ext.getCmp(field).getValue();//(newValue)? newValue : oldValue;
//Update Kurikulum set the field with the value
updateKurikulum(field, value);
};
var fnSelect2 = function(combo, record){
//The ID of THE combo must equals the field (key) to be updated
var field1 = 'nilaihurufmin';
var value1 = record.data['hurufnilai'];
var field2 = 'bobotnilaimin';
var value2 = record.data['angkanilai'];
updateKurikulum2(field1, value1, field2, value2);
};
/** GRID COLUMN MODEL */
var cm_kur = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(), //for rows numbering
{
header: RH.h3('Kode','c'), width:70,
dataIndex: 'kdmk',
renderer: RH.keyToDetil,
sortable: true
}, {
header: RH.h3('Nama Mata Kuliah (Ind)'), width: 250,
dataIndex: 'nmmkind',
sortable: true,
}, {
header: RH.h3('Semester'), width: 66,
dataIndex: 'idsemester', align:'right',
renderer: render_semester,
editor: RH.getComboEditor('idsemester', false, ds_semester, 'kode', 'nama', fnSelect),
}, {
header: RH.h3('Jumlah
SKS'), width: 70,
dataIndex: 'jmlsks', align:'right',
renderer: render_numEdit,
editor: RH.getNumEditor('jmlsks', 'INTEGER', 0, 10, false, fnChange),
}, {
header: RH.h3('Tatap
Muka'), width: 70,
dataIndex: 'skstatapmuka', align:'right',
renderer: render_numEdit,
editor: RH.getNumEditor('skstatapmuka', 'INTEGER', 0, 10, false, fnChange),
}, {
header: RH.h3('Praktikum'), width: 70,
dataIndex: 'skspraktikum', align:'right',
renderer: render_numEdit,
editor: RH.getNumEditor('skspraktikum', 'INTEGER', 0, 10, false, fnChange),
}, {
header: RH.h3('Praktek
Lapangan'), width: 70,
dataIndex: 'sksprakteklap', align:'right',
renderer: render_numEdit,
editor: RH.getNumEditor('sksprakteklap', 'INTEGER', 0, 10, false, fnChange),
}, {
header: RH.h3('Jenis
Kurikulum'), width: 90,
dataIndex: 'jnskurikulum',
renderer: render_jkurikulum,
editor: RH.getComboEditor('jnskurikulum', false, ds_jkurikulum, 'kode', 'nama', fnSelect),
}, {
header: RH.h3('Jenis
Mata Kuliah'), width: 110,
dataIndex: 'jnsmk',
renderer: render_jmatkul,
editor: RH.getComboEditor('jnsmk', false, ds_jmatkul, 'kode', 'nama', fnSelect),
}, {
header: RH.h3('Status
Mata Kuliah'), width: 100,
dataIndex: 'stmk',
renderer: render_stmatkul,
editor: RH.getComboEditor('stmk', false, ds_stmatkul, 'kode', 'nama', fnSelect),
}, {
header: RH.h3('Nilai Minimal'), width: 100,
dataIndex: 'nilaihurufmin', align:'center',
renderer: render_nilaimin,
editor: RH.getComboEditor('nilaihurufmin', false, ds_nilaimin, 'angkanilai', 'hurufnilai', fnSelect2),
},
RH.DeleteColumn()
]
);
// Selection Model
var sm_kur = new Ext.grid.RowSelectionModel({ singleSelect: true });
// Grid View
var gv_kur = new Ext.grid.GridView({emptyText: '< Belum ada Data >'});
/** GRID PANEL */
var gp_kur = new Ext.grid.EditorGridPanel({ //PAKE EditorGridPanel
ds: ds_kur,
cm: cm_kur,
sm: sm_kur,
view: gv_kur,
clicksToEdit: 1, //for cell editing (single click =1, dblclick=2)
forceFit: true, //autoHeight: true,
layout:'anchor', //autoSizeColumns: true,
//autoExpandColumn: 'nmmkind',
autoScroll:true, //enableColumnResize: true,
columnLines: true,
loadMask: true,
tbar:[sb_kur],
bbar: new Ext.PagingToolbar({
store: ds_kur,
displayInfo: true,
pageSize: pageSize,
mode: 'local',
displayMsg: 'Data {0} - {1} dari {2}',
emptyMsg: "Belum ada data"
}),
listeners: {
cellclick: onCellKurClick
}
});
var fp_kur = new Ext.Panel({
xtype: 'panel',
title: 'Kurikulum', iconCls:'silk-book',
buttonAlign: 'left',
bodyStyle: 'padding: 5px',
border: false,
layout: 'border',
waitMsg: 'Waiting...',
maskDisabled: false,
monitorValid: true,
autoScroll:true,
frame: true,
items: [{
xtype: 'fieldset', flex: 1, region:'north', layout:'form', autoHeight:true,
items: [{
xtype: 'container', layout: 'hbox',
items:[{
layout:'form', labelWidth:90, labelAlign:'right',
items: [
RH.ActionCombo({
id: 'cb.prodi-kur', label: 'Program Studi', width: 300,
data: ds_prodireg, key: 'kdprodi', display: 'lnmprodi',
fnSelect: function(){ reloadGridKur(); }
})
]
},{
layout:'form', labelWidth:190, labelAlign:'right',
items: [
RH.ActionCombo({
id: 'cb.thmasuk-kur', label: 'Tahun Masuk/Angkatan', width: 100,
data: ds_years, key: 'kode', display: 'nama',
fnSelect: function(){ reloadGridKur(); }
})
]
},{
xtype: 'textfield', id: 'hidden.kdmkkur', hidden:true,
},{
xtype: 'textfield', id: 'hidden.idkur', hidden:true,
}]
}]
},{
region: 'center', layout:'form', autoScroll:true,
items:[{
xtype: 'panel', layout:'fit', height:400,
title:'Mata Kuliah', id:'fp.master', frame:true,
items: [gp_kur],
tbar: [{
text: 'Tambah', id: 'tb.add-stru', iconCls: 'silk-add',
handler: function() { fnAddKurikulum(); }
},{
text: 'Hapus Semua', id: 'tb.del-stru', iconCls: 'silk-delete',
handler: function() { fnDeleteKurikulumByProdiSmt(); }
},{
text: 'Salin Kurikulum dari Tahun Masuk/Angkatan Sebelumnya', id: 'tb.copy-stru', iconCls: 'silk-page-copy',
handler: function() { fnCopyKurikulum(); }
},{
text:'Cetak', iconCls: 'silk-printer',
handler: function() {
if(!RH.getCompValue('cb.prodi-kur') || !RH.getCompValue('cb.thmasuk-kur')){
RH.warning('Program Studi Dan Tahun Masuk/Angkatan Belum Dipilih!');
return;
}
RH.ShowReport(BASE_URL + 'rpt/rpt_kurikulum/get_kurikulum/'+RH.getCompValue('cb.prodi-kur') + '/' +RH.getCompValue('cb.thmasuk-kur'));
}
},{
text: '---- Matkul Tugas Akhir untuk Semester Ganjil Sedang di kerjakan', id: 'tb-warn-tru'
}]
},
RH.vSpacer(5),
{
xtype: 'panel', layout:'fit',height:200, frame:true,
title:'Syarat Mata Kuliah', id:'fp.detilkur',
//items: [gp_struprogdet],
}],
}]
});
/**
FUNCTIONS
*/
function onCellKurClick(grid, rowIndex, columnIndex, e) {
var t = e.getTarget();
var record = grid.getStore().getAt(rowIndex); // Get the Record
var idkurikulum = record.data['idkurikulum'];
var kdprodi = record.data['kdprodi'];
var thnmasuk = record.data['thnmasuk'];
var kdmk = record.data['kdmk'];
var idkur = record.data['idkurikulum'];
RH.removeDetail('fp.detilkur');
RH.setCompValue('hidden.kdmkkur', kdmk);
RH.setCompValue('hidden.idkur', idkur);
if (t.className == 'imgDelete') {
fnDeleteKurikulum(grid, record);
return true;
}
if (t.className == 'keyMasterDetail') {
var gridPanelDetKur = cKurikulumDet(idkurikulum, kdprodi, thnmasuk, storesObj);
RH.loadDetail('fp.detilkur',gridPanelDetKur);
return true;
}
return true;
}
function reloadGridKur(){
RH.removeDetail('fp.detilkur');
ds_kur.reload({
params: {
kdprodi: RH.getCompValue('cb.prodi-kur', true),
thnmasuk: RH.getCompValue('cb.thmasuk-kur', true)
}
});
}
function fnAddKurikulum(){
/*for DEBUG: RH.warning(RH.searchObj.params[0].name); return;*/
RH.removeDetail('fp.detilkur');
var grid = gp_kur;
var kdprodi = RH.getCompValue('cb.prodi-kur', true);
var thnmasuk = RH.getCompValue('cb.thmasuk-kur', true);
if(kdprodi == '') { RH.warning('Program Studi harus diisi'); return; };
if(thnmasuk == '') { RH.warning('Tahun Masuk/Angkatan harus diisi'); return; };
wLookupMatkul(kdprodi, thnmasuk, grid);
}
function fnCopyKurikulum(){
RH.removeDetail('fp.detilkur');
var grid = gp_kur;
var kdprodi = RH.getCompValue('cb.prodi-kur', true);
var thnmasuk = RH.getCompValue('cb.thmasuk-kur', true);
if(kdprodi == '') { RH.warning('Program Studi harus diisi'); return; };
if(thnmasuk == '') { RH.warning('Tahun Masuk/Angkatan harus diisi'); return; };
if(ds_kur.getCount() > 0){
RH.warning('Data sudah ada. Hapus terlebih dahulu');
return;
}
var combo_prodi = Ext.getCmp('cb.prodi-kur');
var combo_tahun = Ext.getCmp('cb.thmasuk-kur');
wFormCopyKurikulumnya(combo_prodi, combo_tahun, grid)
}
function fnEditKurikulum(grid, record){
//DO HERE.........
//EDIT NUMERICS ON THE GRID
}
function fnDeleteKurikulum(grid, record){
RH.removeDetail('fp.detilkur');
var url = BASE_URL + 'kurikulum_controller/delete_kurikulum';
var params = new Object({
kdprodi : record.data['kdprodi'],
thnmasuk : record.data['thnmasuk'],
kdmk : record.data['kdmk'],
});
RH.deleteGridRecord(url, params, grid );
}
function fnDeleteKurikulumByProdiSmt(){
RH.removeDetail('fp.detilkur');
if(ds_kur.getCount() < 1){
RH.warning('Data belum ada');
return;
}
var url = BASE_URL + 'kurikulum_controller/delete_kurikulum_prodismt';
var params = new Object({
kdprodi : RH.getCompValue('cb.prodi-kur',true),
thnmasuk : RH.getCompValue('cb.thmasuk-kur',true),
});
var msgKonfirm = 'Hapus semua data Kurikulum untuk prodi dan tahun angkatan ini?';
RH.deleteAllRecords(url, params, gp_kur, msgKonfirm )
}
function updateKurikulum(field, value){
RH.removeDetail('fp.detilkur');
Ext.Ajax.request({
url: BASE_URL + 'kurikulum_controller/update1field_kurikulum',
params: {
kdprodi : RH.getCompValue('cb.prodi-kur',true),
thnmasuk : RH.getCompValue('cb.thmasuk-kur',true),
kdmk : RH.getCompValue('hidden.kdmkkur',true),
idkurikulum : RH.getCompValue('hidden.idkur',true),
field : field,
value : value,
},
success: function() {
// Ext.Msg.alert("Informasi", "Ubah Data Berhasil");
ds_kur.reload();
},
failure: function() {
// Ext.Msg.alert("Informasi", "Ubah Data Gagal");
}
});
}
function updateKurikulum2(field1, value1, field2, value2){
Ext.Ajax.request({
url: BASE_URL + 'kurikulum_controller/update2field_kurikulum',
params: {
kdprodi : RH.getCompValue('cb.prodi-kur',true),
thnmasuk : RH.getCompValue('cb.thmasuk-kur',true),
kdmk : RH.getCompValue('hidden.kdmkkur',true),
idkurikulum : RH.getCompValue('hidden.idkur',true),
field1 : field1,
value1 : value1,
field2 : field2,
value2 : value2,
},
success: function() {
ds_kur.reload();
},
failure: function() {
//Ext.Msg.alert("Info", "Ubah Data Gagal");
}
});
}
SET_PAGE_CONTENT(fp_kur);
}
/**
LOOKUP MATAKULIAH FOR ADD KURIKULUM
*/
function wLookupMatkul(kdprodi, thnmasuk, masterGrid){
/**
DATA SOURCE
*/
var fieldsLookup = RH.storeFields('kdprodi','kdmk','nmmkind','nmmkeng','nmmkalias','kdkelmk');
var ds_lookup = RH.JsonStore({
url : BASE_URL + 'matkul_controller/get_matkulByProdi',
fields : fieldsLookup,
limit : 18,
params: [{key:'kdprodi', value: kdprodi}],
enableSearch: true,
});
//SEARCH COMPONENT
var sb_lookup = RH.searchComp({
id: 'sb_lookup',
fields : ['kdmk:Kode Mata Kuliah','nmmkind:Nama Mata Kuliah (Ind)','nmmkeng:Nama Mata Kuliah (Eng)'],
selected : 'kdmk',
store : ds_lookup,
textWidth : 200
});
/**
GRID LOOKUP MATA KULIAH
*/
/* // COLUMN MODEL
var cm_lookup = new Ext.grid.ColumnModel([
{
header: 'kdprodi', dataIndex: 'kdprodi',hidden: true
}, {
header: 'Kode Mata Kuliah',width: 100,
dataIndex: 'kdmk', sortable: true
}, {
header: 'Nama Mata Kuliah (Indonesia)', width: 300,
dataIndex: 'nmmkind', sortable: true
}, {
header: 'Nama Mata Kuliah (English)', width: 300,
dataIndex: 'nmmkeng', sortable: true
}]
);
// Selection Model
var sm_lookup = new Ext.grid.RowSelectionModel({
singleSelect: true
});
// Grid View
var gv_lookup = new Ext.grid.GridView({
emptyText: '< Belum ada Data >'
});
var gp_lookup = new Ext.grid.GridPanel({
ds: ds_lookup,
cm: cm_lookup,
sm: sm_lookup,
view: gv_lookup,
forceFit: true,
layout:'anchor',
autoSizeColumns: true, //autoExpandColumn: 'nmmkind',
autoScroll:true,
enableColumnResize: true,
enableColumnHide: false,
enableColumnMove: false,
columnLines: true,
loadMask: true,
tbar:[sb_lookup],
bbar: new Ext.PagingToolbar({
store: ds_lookup,
displayInfo: true, pageSize: 18, mode: 'local',
displayMsg: 'Data {0} - {1} dari {2}',
emptyMsg: "Belum ada data"
}),
listeners: {
rowdblclick: onRowDblClick
}
}); */
//Checkbox pada Grid
var cbGrid = new Ext.grid.CheckboxSelectionModel();
// COLUMN MODEL
var cm_lookup = new Ext.grid.ColumnModel({
columns: [
cbGrid, new Ext.grid.RowNumberer(),
{
header: 'kdprodi', dataIndex: 'kdprodi',hidden: true
}, {
header: 'Kode Mata Kuliah',width: 100,
dataIndex: 'kdmk', sortable: true
}, {
header: 'Nama Mata Kuliah (Indonesia)', width: 300,
dataIndex: 'nmmkind', sortable: true
}, {
header: 'Nama Mata Kuliah (English)', width: 300,
dataIndex: 'nmmkeng', sortable: true
}]
});
// Selection Model
var sm_lookup = new Ext.grid.RowSelectionModel({ singleSelect: true });
// Grid View
var gv_lookup = new Ext.grid.GridView({ emptyText: '< Belum ada Data >' });
//BUTTON TAMBAH
var tbMhs = new Ext.Toolbar({
items:[{
text: 'Add',
iconCls: 'silk-add',
handler: function(){
var select = gp_lookup.getSelectionModel().getSelections();
if(select.length > 0){
Ext.MessageBox.confirm('Message', 'Anda Yakin Menambah Data?', add);
}else{
Ext.MessageBox.alert('Message', 'Data Belum Di Pilih!');
}
}
}]
});
//GridPanel
var gp_lookup = new Ext.grid.GridPanel({
ds: ds_lookup,
cm: cm_lookup,
sm: cbGrid, //sm_lookup,
view: gv_lookup,
forceFit: true,
layout:'anchor',
autoSizeColumns: true, //autoExpandColumn: 'nmmkind',
autoScroll:true,
enableColumnResize: true,
enableColumnHide: false,
enableColumnMove: false,
columnLines: true,
loadMask: true,
tbar:[tbMhs, sb_lookup],
bbar: new Ext.PagingToolbar({
store: ds_lookup,
displayInfo: true, pageSize: 200, mode: 'local',
displayMsg: 'Data {0} - {1} dari {2}',
emptyMsg: "Belum ada data"
}),
listeners: {
rowdblclick: onRowDblClick
}
});
function add(btn, grid, rowIdx){
console.log(btn);
if(btn == 'yes'){
var m = gp_lookup.getSelectionModel().getSelections();
//var store = ds_lookup;
var store = gp_lookup.getStore();
var record = store.getAt(rowIdx);
for(var i=0; i< m.length; i++){
var rec = m[i];
console.log(rec);
if(rec){
var kdmk = rec.data['kdmk'];
//INSERT NEW DOSENWALIDET RECORD (Mahasiswa)
Ext.Ajax.request({
url: BASE_URL +'kurikulum_controller/insert_kurikulum',
method: 'POST',
params: {
kdprodi : kdprodi,
thnmasuk : thnmasuk,
kdmk : kdmk
},
waitMsg: 'Tunggu, sedang proses menyimpan...',
success: function() {
masterGrid.getStore().reload();
Ext.Msg.alert("Info", "Tambah Data Berhasil");
//ds_lookup.reload();
wLookup.close();
},
failure: function(result){
Ext.Msg.alert("Info", "Tambah Data Gagal");
}
});
}
/* //Ext.MessageBox.alert('Message', 'Tambah Data Berhasil..');
RH.setCompValue('tf.total', RH.sumRecVal(ds_tpumum, 'total'));
ds_tpumum.reload(); */
}
}
}
/**
WIN LOOKUP MATA KULIAH
*/
var wLookup = new Ext.Window({
id: 'w.look-matkul',
title: 'Mata Kuliah',
modal: true,
layout: 'fit',
width:720, height:400,
items: [gp_lookup]
}).show();
/**
FUNCTIONS
*/
function onRowDblClick(grid, rowIdx) {
var store = ds_lookup;
var rec = store.getAt(rowIdx);
var kdmk = rec.data['kdmk'];
//INSERT NEW KURIKULUM RECORD (MATA KULIAH)
Ext.Ajax.request({
url: BASE_URL +'kurikulum_controller/insert_kurikulum',
method: 'POST',
params: {
kdprodi : kdprodi,
thnmasuk : thnmasuk,
kdmk : kdmk
},
waitMsg: 'Tunggu, sedang proses menyimpan...',
success: function() {
Ext.Msg.alert("Info", "Simpan Data Berhasil");
masterGrid.getStore().reload();
wLookup.close();
},
failure: function(result){
Ext.Msg.alert("Info", "Simpan Data Gagal");
}
});
}
}
/**
FORM COPY KURIKULUM
*/
function wFormCopyKurikulumnya(combo_prodi, combo_tahun, masterGrid){
//the store must same (shared store)
var ds_prodireg = combo_prodi.getStore();
var ds_years = combo_tahun.getStore();
var kdprodi = combo_prodi.getValue();
var thmasuk = combo_tahun.getValue();
var copy_form = new Ext.form.FormPanel({
xtype:'form',
id: 'frm.copy',
buttonAlign: 'left',
labelWidth: 180, labelAlign: 'right',
bodyStyle: 'padding:10px 3px 3px 5px', // atas, kanan, bawah, kiri
monitorValid: true,
height: 160, width: 500,
layout: 'form',
frame: false,
defaultType:'combo',
items: [{
id: 'cb.prodi-copy', fieldLabel: 'Program Studi',
store: ds_prodireg, triggerAction: 'all',
valueField: 'kdprodi', displayField: 'lnmprodi',
forceSelection: true, submitValue: true, mode: 'local',
allowBlank: false, editable: false,
width: 300,
},{
id: 'cb.thbaru-copy', fieldLabel: 'Tahun Masuk/Angkatan (Baru)',
store: ds_years, triggerAction: 'all', allowBlank: false,
valueField: 'kode', displayField: 'nama',
forceSelection: true, submitValue: true, mode: 'local',
width: 150,
},{
id: 'cb.thlama-copy', fieldLabel: 'Tahun Masuk/Angkatan (Lama)',
store: ds_years, triggerAction: 'all', editable: true,
valueField: 'kode', displayField: 'nama',
forceSelection: true, submitValue: true, mode: 'local',
emptyText:'Pilih...', width:150,
}],
buttons: [{
text: 'Simpan', iconCls:'silk-save',
handler: function() {
fnSaveCopy();
}
}, {
text: 'Kembali', iconCls:'',
handler: function() {
wCopyKurikulum.close();
}
}]
});
/**SET THE FORM */
setForm();
var wCopyKurikulum = new Ext.Window({
title: 'Salin Kurikulum dari Tahun Masuk/Angkatan Sebelumnya',
modal: true, closable:false,
items: [copy_form]
}).show();
/**
FUNCTIONS
*/
function setForm(){
Ext.getCmp('cb.prodi-copy').disable();
Ext.getCmp('cb.thbaru-copy').disable();
RH.setCompValue('cb.prodi-copy', kdprodi);
RH.setCompValue('cb.thbaru-copy', thmasuk);
}
/**
SAVE COPY FUNCTIONS
*/
function fnSaveCopy(){
var thlama = RH.getCompValue('cb.thlama-copy',true);
if(thlama == '') { RH.warning('Tahun Masuk/Angkatan (Lama) harus diisi'); return; };
var idForm = 'frm.copy';
var sUrl = BASE_URL +'kurikulum_controller/copy_kurikulum';
var sParams = new Object({
kdprodi : RH.getCompValue('cb.prodi-copy'),
thbaru : RH.getCompValue('cb.thbaru-copy'),
thlama : thlama
});
var grid = masterGrid;
var msgWait = 'Tunggu, sedang proses menyimpan...';
var msgSuccess = 'Salin data berhasil';
var msgFail = 'Salin data gagal';
var msgInvalid = 'Data belum valid (data primer belum terisi)!';
//call form grid submit function (common function by RH)
RH.submitGridForm(idForm, sUrl, sParams, grid, wCopyKurikulum,
msgWait, msgSuccess, msgFail, msgInvalid);
}
}