function pStruprog(){
/** COMMON STORES */
var ds_prodireg = store_prodireg();
var ds_stsmt = store_stsmt();
/** 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 ds_semester = new Ext.data.JsonStore({ //from database
proxy: new Ext.data.HttpProxy({
url: BASE_URL + 'data_controller/get_semester_ganjilgenap',
method: 'POST'
}),
autoLoad: true,
root: 'data',
fields: [
{ name: "kode", mapping: "kode" }
, { name: "nama", mapping: "nama" }
]
});
var ds_idkelas = new Ext.data.JsonStore({ //from database
proxy: new Ext.data.HttpProxy({
url: BASE_URL + 'data_controller/get_kelas_combo',
method: 'POST'
}),
autoLoad: true,
root: 'data',
fields: [
{ name: "id", mapping: "id" }
, { name: "nama", mapping: "nama" }
]
});
/** GRID STORE: ds_struprog */
var fields_struprog = RH.storeFields('kdprodi','kdstsemester','kdmk','nmmkind','idsemester',
'jmlsks','skstatapmuka','skspraktikum','sksprakteklap','jnskurikulum','jnsmk','stmk',
'jmldos');
var pageSize = 10;
var ds_struprog = RH.JsonStore({
url : BASE_URL + 'struprog_controller/get_struprog',
fields : fields_struprog,
limit : pageSize,
params: [
{key:'kdprodi', id: 'cb.prodi-stru'}
,{key:'kdstsemester', id: 'cb.smt-stru'}
],
enableSearch: true,
});
ds_struprog.on('beforeload', function(){ RH.removeDetail('fp.detil') });
//SEARCH COMPONENT
var sb_struprog = RH.searchComp({
id : 'sb_struprog',
fields : ['kdmk:Kode Mata Kuliah','nmmkind:Nama Mata Kuliah'],
selected : 'kdmk',
store : ds_struprog,
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(value,'12px');
}
function render_numEdit(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
/* Ext.Msg.show({
title: 'Konfirmasi',
msg: 'Update Data Ini?',
buttons: Ext.Msg.YESNO,
icon: Ext.MessageBox.QUESTION,
fn: function (response) {
if ('yes' !== response) {
ds_struprog.reload();
return;
} */
updateStruprog(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
/* Ext.Msg.show({
title: 'Konfirmasi',
msg: 'Update Data Ini?',
buttons: Ext.Msg.YESNO,
icon: Ext.MessageBox.QUESTION,
fn: function (response) {
if ('yes' !== response) {
ds_struprog.reload();
return;
} */
updateStruprog(field, value);
/* }
}); */
};
/** GRID COLUMN MODEL */
var cm_struprog = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(), //for rows numbering
{
header: RH.h3('Kode','c'), width:100,
dataIndex: 'kdmk',
renderer: RH.keyToDetil,
sortable: true
}, {
header: RH.h3('Nama Mata Kuliah (Ind)'), width: 300,
dataIndex: 'nmmkind',
sortable: true,
}, {
header: RH.h3('Semester'), width: 65,
dataIndex: 'idsemester',
renderer: render_semester,
editor: RH.getComboEditor('idsemester', false, ds_semester, 'kode', 'nama', fnSelect),hidden:false
}, {
header: RH.h3('Jumlah
SKS'), width: 70,
dataIndex: 'jmlsks', align:'right',
renderer: render_numEdit,
editor: RH.getNumEditor('jmlsks', 'INTEGER', 0, 10, false, fnChange),hidden:false
}, {
header: RH.h3('TatapMuka'), width: 70,
dataIndex: 'skstatapmuka', align:'right',
renderer: render_numEdit,
editor: RH.getNumEditor('skstatapmuka', 'INTEGER', 0, 10, false, fnChange),hidden:true
}, {
header: RH.h3('Praktikum'), width: 70,
dataIndex: 'skspraktikum', align:'right',
renderer: render_numEdit,
editor: RH.getNumEditor('skspraktikum', 'INTEGER', 0, 10, false, fnChange),hidden:true
}, {
header: RH.h3('Praktek
Lapangan'), //RH.center('Praktek
Lapangan'),
width: 70, //cls: 'multiline',
dataIndex: 'sksprakteklap', align:'right',
renderer: render_numEdit,
editor: RH.getNumEditor('sksprakteklap', 'INTEGER', 0, 10, false, fnChange),hidden:true
}, {
header: RH.h3('Jenis
Kurikulum'), //'Jenis Kurikulum',
dataIndex: 'jnskurikulum', width: 90,
renderer: render_jkurikulum,
editor: RH.getComboEditor('jnskurikulum', false, ds_jkurikulum, 'kode', 'nama', fnSelect),hidden:true
}, {
header: RH.h3('Jenis
Mata Kuliah'), width: 110,
dataIndex: 'jnsmk',
renderer: render_jmatkul,
editor: RH.getComboEditor('jnsmk', false, ds_jmatkul, 'kode', 'nama', fnSelect),hidden:true
}, {
header: RH.h3('Status
Mata Kuliah'), width: 100,
dataIndex: 'stmk',
renderer: render_stmatkul,
editor: RH.getComboEditor('stmk', false, ds_stmatkul, 'kode', 'nama', fnSelect),hidden:true
}, {
header: RH.h3('Jumlah Dosen'), width: 100,
dataIndex: 'jmldos',
},
RH.DeleteColumn()
]
);
// Selection Model
var sm_struprog = new Ext.grid.RowSelectionModel({ singleSelect: true });
// Grid View
var gv_struprog = new Ext.grid.GridView({emptyText: '< Belum ada Data >'});
/** GRID PANEL */
var gp_struprog = new Ext.grid.EditorGridPanel({ //PAKE EditorGridPanel
ds: ds_struprog,
cm: cm_struprog,
sm: sm_struprog,
view: gv_struprog,
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_struprog],
bbar: new Ext.PagingToolbar({
store: ds_struprog,
displayInfo: true,
pageSize: pageSize,
mode: 'local',
displayMsg: 'Data {0} - {1} dari {2}',
emptyMsg: "Belum ada data"
}),
listeners: {
cellclick: onCellStruClick
}
});
var fp_struprog = new Ext.Panel({
xtype: 'panel',
title: 'Struktur Program', 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-stru', label: 'Program Studi', width: 300,
data: ds_prodireg, key: 'kdprodi', display: 'lnmprodi',
fnSelect: function(){ reloadGridStruprog(); }
})
]
},{
layout:'form', labelWidth:190, labelAlign:'right',
items: [
RH.ActionCombo({
id: 'cb.smt-stru', label: 'Tahun Akademik - Semester', width: 160,
data: ds_stsmt, key: 'kdstsemester', display: 'nmsmt',
fnSelect: function(){ reloadGridStruprog(); }
})
]
},{
xtype: 'textfield', id: 'hidden.kdmk', 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_struprog],
tbar: [{
text: 'Tambah', id: 'tb.add-stru', iconCls: 'silk-add',
handler: function() { fnAddStruprog(); }
},{
text: 'Hapus Semua', id: 'tb.del-stru', iconCls: 'silk-delete',
handler: function() { fnDeleteByProdiSmtStruprog(); }
},{
text: 'Salin Struktur Program dari Tahun Akademik - Semester Sebelumnya', id: 'tb.copy-stru', iconCls: 'silk-page-copy',
handler: function() { fnCopyStruprog(); }
}]
},
RH.vSpacer(5),
{
xtype: 'panel', layout:'fit',height:250, frame:true,
title:'Dosen Pengajar', id:'fp.detil',
//items: [gp_struprogdet],
}],
}]
});
/**
FUNCTIONS
*/
function onCellStruClick(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 storesObj = {kelas:ds_idkelas};
RH.removeDetail('fp.detil');
RH.setCompValue('hidden.kdmk', kdmk);
if (t.className == 'imgDelete') {
fnDeleteStruprog(grid, record);
return true;
}
if (t.className == 'keyMasterDetail') {
var gridPanelDet = cStruprogDet(kdprodi, kdstsemester, kdmk, storesObj);
RH.loadDetail('fp.detil',gridPanelDet);
return true;
}
return true; //back to ClickToEdit=1
}
function reloadGridStruprog(){
//remove detail
RH.removeDetail('fp.detil');
//reload master-grid
ds_struprog.reload({
params: {
kdprodi: RH.getCompValue('cb.prodi-stru', true),
kdstsemester: RH.getCompValue('cb.smt-stru', true)
}
});
ds_idkelas.reload({
params: {
kdprodi: RH.getCompValue('cb.prodi-stru', true)
}
});
ds_semester.reload({
params: {
jsemester: RH.getCompValue('cb.smt-stru', true).substr(-1)
}
});
}
function fnAddStruprog(){
//remove detail
RH.removeDetail('fp.detil');
var grid = gp_struprog;
var kdprodi = RH.getCompValue('cb.prodi-stru', true);
var kdstsemester = RH.getCompValue('cb.smt-stru', true);
if(kdprodi == '') { RH.warning('Program Studi harus diisi'); return; };
if(kdstsemester == '') { RH.warning('Tahun Akademik - Semester harus diisi'); return; };
wLookupMatkulStru(kdprodi, kdstsemester, grid);
}
function fnCopyStruprog(){
//remove detail
RH.removeDetail('fp.detil');
var grid = gp_struprog;
var kdprodi = RH.getCompValue('cb.prodi-stru', true);
var kdstsemester = RH.getCompValue('cb.smt-stru', true);
if(kdprodi == '') { RH.warning('Program Studi harus diisi'); return; };
if(kdstsemester == '') { RH.warning('Tahun Akademik - Semester harus diisi'); return; };
if(ds_struprog.getCount() > 0){
RH.warning('Data sudah ada. Hapus terlebih dahulu');
return;
}
var combo_prodi = Ext.getCmp('cb.prodi-stru');
var combo_stsmt = Ext.getCmp('cb.smt-stru');
wFormCopyStruprog(combo_prodi, combo_stsmt, grid);
//wFormCopyStruprog(kdprodi, kdstsemester, grid)
}
function fnDeleteByProdiSmtStruprog(){
//remove detail
RH.removeDetail('fp.detil');
if(ds_struprog.getCount() < 1){
RH.warning('Data belum ada');
return;
}
var url = BASE_URL + 'struprog_controller/deleteByProdiSmt_struprog';
var params = new Object({
kdprodi : RH.getCompValue('cb.prodi-stru',true),
kdstsemester : RH.getCompValue('cb.smt-stru',true),
});
var msgKonfirm = 'Hapus semua data Struktur Program untuk prodi dan semester ini?';
RH.deleteAllRecords(url, params, gp_struprog, msgKonfirm )
}
function fnDeleteStruprog(grid, record){
//remove detail
RH.removeDetail('fp.detil');
var url = BASE_URL + 'struprog_controller/delete_struprog';
var params = new Object({
kdprodi : record.data['kdprodi'],
kdstsemester : record.data['kdstsemester'],
kdmk : record.data['kdmk'],
});
RH.deleteGridRecord(url, params, grid );
}
function updateStruprog(field, value){
//remove detail
RH.removeDetail('fp.detil');
Ext.Ajax.request({
url: BASE_URL + 'struprog_controller/update1field_struprog',
params: {
kdprodi : RH.getCompValue('cb.prodi-stru',true),
kdstsemester : RH.getCompValue('cb.smt-stru',true),
kdmk : RH.getCompValue('hidden.kdmk',true),
field : field,
value : value,
},
success: function() {
ds_struprog.reload();
},
failure: function() {
Ext.Msg.alert("Info", "Ubah Data Gagal");
}
});
}
SET_PAGE_CONTENT(fp_struprog);
}
/**
LOOKUP MATAKULIAH FOR ADD KURIKULUM
*/
function wLookupMatkulStru(kdprodi, kdstsemester, masterGrid){
/**DATA SOURCE */
var fieldsLookup = RH.storeFields('kdprodi','kdmk','nmmkind','nmmkeng','nmmkalias','kdkelmk','idsemester','semestertingkat','jmlsks');
//var fieldsLookup = RH.storeFields('kdprodi','kdmk','nmmkind','nmmkeng','nmmkalias','kdkelmk');
var ds_lookup = RH.JsonStore({
url : BASE_URL + 'struprog_controller/get_matkulfromkurikulum',
//url : BASE_URL + 'matkul_controller/get_matkulByProdi',
fields : fieldsLookup,
limit : 20,
params: [
{key:'kdprodi', value: kdprodi},
{key:'kdstsemester', value: kdstsemester}
],
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)','semestertingkat:Semester / Tingkat'],
//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
}, {
header: 'Jumlah
SKS', width: 60, align: 'center',
dataIndex: 'jmlsks', sortable: true
}, {
header: 'Semester
/ Tingkat', width: 60, align: 'center',
dataIndex: 'semestertingkat', 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: 20, 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'];
var idsemester = rec.data['idsemester'];
var jmlsks = rec.data['jmlsks'];
//INSERT NEW DOSENWALIDET RECORD (Mahasiswa)
Ext.Ajax.request({
url: BASE_URL +'struprog_controller/insert_struprog',
method: 'POST',
params: {
kdprodi : kdprodi,
kdstsemester : kdstsemester,
kdmk : kdmk,
idsemester : idsemester,
jmlsks : jmlsks
},
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:900, 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'];
var idsemester = rec.data['idsemester'];
var jmlsks = rec.data['jmlsks'];
//INSERT NEW KURIKULUM RECORD (MATA KULIAH)
Ext.Ajax.request({
url: BASE_URL +'struprog_controller/insert_struprog',
method: 'POST',
params: {
kdprodi : kdprodi,
kdstsemester : kdstsemester,
kdmk : kdmk,
idsemester : idsemester,
jmlsks : jmlsks
},
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 wFormCopyStruprog(combo_prodi, combo_stsmt, masterGrid){
//the store must same (shared store)
var ds_prodireg = combo_prodi.getStore();
var ds_stsmt = combo_stsmt.getStore();
var kdprodi = combo_prodi.getValue();
var kdstsemester = combo_stsmt.getValue();
var copy_form = new Ext.form.FormPanel({
xtype:'form',
id: 'frm.copy',
buttonAlign: 'left',
labelWidth: 215, labelAlign: 'right',
bodyStyle: 'padding:10px 3px 3px 5px', // atas, kanan, bawah, kiri
monitorValid: true,
height: 160, width: 545,
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.smtbaru-copy', fieldLabel: 'Tahun Akademik - Semester (Baru)',
store: ds_stsmt, triggerAction: 'all', allowBlank: false,
valueField: 'kdstsemester', displayField: 'nmsmt',
forceSelection: true, submitValue: true, mode: 'local',
width: 250,
},{
id: 'cb.smtlama-copy', fieldLabel: 'Tahun Akademik - Semester (Lama)',
store: ds_stsmt, triggerAction: 'all',
valueField: 'kdstsemester', displayField: 'nmsmt',
forceSelection: true, submitValue: true, mode: 'local',
emptyText:'Pilih...', width:250,
}],
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 Struktur Program dari Tahun Akademik - Semester Sebelumnya',
modal: true, closable:false,
items: [copy_form]
}).show();
/**
FUNCTIONS
*/
function setForm(){
Ext.getCmp('cb.prodi-copy').disable();
Ext.getCmp('cb.smtbaru-copy').disable();
RH.setCompValue('cb.prodi-copy', kdprodi);
RH.setCompValue('cb.smtbaru-copy', kdstsemester);
}
/**
SAVE COPY FUNCTIONS
*/
function fnSaveCopy(){
var smtlama = RH.getCompValue('cb.smtlama-copy',true);
if(smtlama == '') { RH.warning('Tahun Akademik - Semester (Lama) harus diisi'); return; };
var idForm = 'frm.copy';
var sUrl = BASE_URL +'struprog_controller/copy_struprog';
var sParams = new Object({
kdprodi : RH.getCompValue('cb.prodi-copy'),
smtbaru : RH.getCompValue('cb.smtbaru-copy'),
smtlama : smtlama
});
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);
}
}