function feederMahasiswaDouble() { var ds_grid = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'feeder/feedermhsdbl_controller/get_mahasiswa_double', method: 'POST' }), root: 'data', totalProperty: 'results', autoLoad: true, fields: [ { name: 'nama', mapping: 'nama'}, { name: 'tpt_lahir', mapping: 'tpt_lahir'}, { name: 'tgl_lahir', mapping: 'tgl_lahir'}] }); var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column defaults: { sortable: true // columns are not sortable by default }, columns: [new Ext.grid.RowNumberer(), { header: 'Nama', width: 150, dataIndex: 'nama', sortable: true },{ header: 'Tempat Lahir', width: 300, dataIndex: 'tpt_lahir', sortable: true },{ header: 'Tanggal Lahir', width: 300, dataIndex: 'tgl_lahir', sortable: true },{ header: headerGerid('Detail'), width: 160, dataIndex: 'nama', renderer: fnkeyShowDetail }] }); var vw = new Ext.grid.GridView({ emptyText: '< No Data To Display >' }); var sm_nya = new Ext.grid.CheckboxSelectionModel({ singleSelect:true, listeners: { // rowselect: select_action, // rowdeselect: deselect_action } }); var cari_data = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'local', width: 200 })]; var paging = new Ext.PagingToolbar({ pageSize: 50, store: ds_grid, displayInfo: true, displayMsg: 'Data Mahasiswa Double Dari {0} - {1} of {2}', emptyMsg: 'Data tidak tersedia.' }); var grid_nya = new Ext.grid.EditorGridPanel({ store: ds_grid, frame: true, loadMask: true, height: 530, plugins: cari_data, id: 'grid_det', buttonAlign: 'left', defaults: {anchor: '-10'}, forceFit: true, tbar: [{ text: 'Import Data Mahasiswa dari Feeder', id: 'btn_import_from_feeder', iconCls: 'silk-save', handler: function() { import_from_feeder(); } } /*,'-',{ text: 'Tampilkan data mahasiswa double', id: 'btn_show_mahasiswa', iconCls: 'silk-report', handler: function() { ds_grid.reload(); } }*/ ,'-',{ text: 'Hapus Data Temporary', id: 'btn_add', iconCls: 'silk-arrow-refresh', handler: function() { truncate_mahasiswa_feeder_temp(); } },'->'], sm: sm_nya, vw: vw, autoScroll: true, cm: cm, listeners: { cellclick: showDoubleData}, }); var form_bp_general = new Ext.form.FormPanel({ id: 'form_bp_general_id', title: 'Pengelolaan Data Mahasiswa Double', region: 'center', //autoScroll: true, buttonAlign: 'left', bodyStyle: 'padding: 5px', border: false, disabled: true, waitMsg: 'Waiting...', maskDisabled: false, monitorValid: true, items: [{ layout: 'form', border: false, items: [grid_nya] }] }); SET_PAGE_CONTENT(form_bp_general); function fnkeyShowDetail(value){ Ext.QuickTips.init(); return '
Detail
'; } function showDoubleData(grid, rowIndex, columnIndex, event) { var t = event.getTarget(); if(t.className == 'keyMasterDetail'){ var obj = ds_grid.getAt(rowIndex); var nama = obj.get("nama"); var tpt_lahir = obj.get("tpt_lahir"); var tgl_lahir = obj.get("tgl_lahir"); var ds_double_data = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'feeder/feedermhsdbl_controller/get_double', method: 'POST' }), baseParams: { nama : nama, tpt_lahir : tpt_lahir, tgl_lahir : tgl_lahir, }, root: 'data', totalProperty: 'results', autoLoad: true, fields: [ { name: 'fk__jns_daftar', mapping: 'fk__jns_daftar', }, { name: 'fk__sms', mapping: 'fk__sms', }, { name: 'fk__sp', mapping: 'fk__sp', }, { name: 'id_jns_daftar', mapping: 'id_jns_daftar', }, { name: 'id_mhs', mapping: 'id_mhs', }, { name: 'id_pd', mapping: 'id_pd', }, { name: 'id_reg_pd', mapping: 'id_reg_pd', }, { name: 'id_sms', mapping: 'id_sms', }, { name: 'id_sp', mapping: 'id_sp', }, { name: 'nama', mapping: 'nama', }, { name: 'nipd', mapping: 'nipd', }, { name: 'nm_pd', mapping: 'nm_pd', }, { name: 'prodi', mapping: 'prodi', }, { name: 'tgl_lahir', mapping: 'tgl_lahir', }, { name: 'tgl_masuk_sp', mapping: 'tgl_masuk_sp', }, { name: 'tpt_lahir', mapping: 'tpt_lahir', }, { name: 'fk__jns_keluar', mapping: 'fk__jns_keluar', }] }); var grid_double = new Ext.grid.GridPanel({ id: 'grid_double', store: ds_double_data, autoScroll: true, frame: true, height:220, loadMask: true, tbar: ['->'], columnLines: true, columns: [new Ext.grid.RowNumberer(), { xtype: 'actioncolumn', width: 50, header: headerGerid('Hapus'), align:'center', items: [{ icon : 'resources/img/icons/fam/delete.gif', tooltip: 'Hapus Data', handler: function(grid, rowIndex) { var konfirmasi = confirm('apakah anda yakin ingin menghapus data ini?'); if(konfirmasi){ waitmsghapus = Ext.MessageBox.wait('menghapus data mahasiswa...', 'Info'); var rec = ds_double_data.getAt(rowIndex); var id_pd = rec.get('id_pd'); var id_reg_pd = rec.get('id_reg_pd'); var nama = rec.get('nama'); //import the data Ext.Ajax.request({ url: BASE_URL + 'feeder/feedermhsdbl_controller/delete_mahasiswa', method: 'POST', timeout: 1000000, params: { id_pd: id_pd, id_reg_pd: id_reg_pd, nama: nama, }, success: function(response) { waitmsghapus.hide(); var obj = Ext.util.JSON.decode(response.responseText); if(obj.success){ Ext.Msg.alert("Informasi", obj.message); ds_grid.reload(); wDouble.close(); }else{ Ext.Msg.alert("Informasi", obj.message); } } }); } } }] },{ header: headerGerid('NIM'), width: 110, dataIndex: 'nipd', sortable: true, },{ header: headerGerid('Nama'), width: 170, dataIndex: 'nama', sortable: true, },{ header: headerGerid('Tempat Lahir'), width: 110, dataIndex: 'tpt_lahir', sortable: true, align:'left', },{ header: headerGerid('Tanggal Lahir'), width: 100, dataIndex: 'tgl_lahir', sortable: true, align:'left', },{ header: headerGerid('Jenis Daftar'), width: 150, dataIndex: 'fk__jns_daftar', sortable: true, },{ header: headerGerid('Status Mahasiswa'), width: 150, dataIndex: 'fk__jns_keluar', sortable: true, },{ header: headerGerid('Fakultas'), width: 150, dataIndex: 'fk__sms', sortable: true, }], }); var double_form = new Ext.form.FormPanel({ xtype:'form', id: 'frm.double', buttonAlign: 'left', labelWidth: 165, labelAlign: 'right', monitorValid: true, height: 250, width: 760, layout: { type: 'form', pack: 'center', align: 'center' }, frame: true, items: [grid_double] }); var wDouble = new Ext.Window({ modal: true, closable:true, items: [double_form] }); wDouble.show(); } } function import_from_feeder() { Ext.Msg.minWidth = 360; waitmsgimport = Ext.MessageBox.wait('
Harap tunggu...
Diperlukan waktu beberapa menit
untuk mengimport seluruh data mahasiswa.
', 'Info'); //get total mahasiswa Ext.Ajax.request({ url: BASE_URL + 'feeder/feedermhsdbl_controller/get_total_mahasiswa', method: 'POST', success: function(response) { var obj = Ext.util.JSON.decode(response.responseText); if(obj.success){ var total_data = obj.total_data; var mhs_perpage = 500; var total_page = Math.ceil(parseInt(total_data) / mhs_perpage); console.log('total = '+total_page); for(var curpage = 1; curpage <= total_page; curpage++){ //import the data Ext.Ajax.request({ url: BASE_URL + 'feeder/feedermhsdbl_controller/import_mahasiswa_from_feeder', method: 'POST', timeout: 1000000, params: { curpage: curpage, mhs_perpage: mhs_perpage, }, success: function(response_import) { if(response_import.responseText == total_page){ waitmsgimport.hide(); Ext.Msg.minWidth = 360; Ext.Msg.alert("Informasi", "Data mahasiswa berhasil di import."); ds_grid.reload(); } } }); } }else{ waitmsgimport.hide(); Ext.Msg.minWidth = 360; Ext.Msg.alert("Informasi", obj.message); } } }); } function truncate_mahasiswa_feeder_temp() { waitmsgclear = Ext.MessageBox.wait('menghapus data temporary...', 'Info'); Ext.Ajax.request({ url: BASE_URL + 'feeder/feedermhsdbl_controller/truncate_mahasiswa_feeder_temp', method: 'POST', success: function(response) { waitmsgclear.hide(); var obj = Ext.util.JSON.decode(response.responseText); Ext.Msg.alert("Informasi", obj.message); ds_grid.reload(); } }); } }