function opac() { var ds_stpublish = store_stpublish(); var file = ""; var kdjurnal = ""; p = new Ext.Panel({ border: true, frame: true, style: 'margin-left: 50px;margin-bottom: 30px', width: 120, height: 135, html: '

IMAGE

' }); //VARIABEL DATA STORE// var ds_ejurnal = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'e_library/c_opac/grid_list_opac', method: 'POST' }), root: 'data', totalProperty: 'results', id: 'photoid', remoteSort: true, autoLoad: true, waitMsg: 'Mengunduh..', baseParams: { }, fields: [{ name: "KDBUKU", mapping: "KDBUKU" }, { name: "KDREFBUKU", mapping: "KDREFBUKU" }, { name: "KDKOLEKSI", mapping: "KDKOLEKSI" }, { name: "NMKOLEKSI", mapping: "NMKOLEKSI" }, { name: "JUDUL", mapping: "JUDUL" }, { name: "KDPENGARANG", mapping: "KDPENGARANG" }, { name: "NMPENGARANG", mapping: "NMPENGARANG" }, { name: "KDPENERBIT", mapping: "KDPENERBIT" }, { name: "PENERBIT", mapping: "PENERBIT" }, { name: "KDJNSBUKU", mapping: "KDJNSBUKU" }, { name: "NMJNSBUKU", mapping: "NMJNSBUKU" }, { name: "KDRAK", mapping: "KDRAK" }, { name: "IDKLASIFIKASI", mapping: "IDKLASIFIKASI" }, { name: "KDKLASIFIKASI", mapping: "KDKLASIFIKASI" }, { name: "PROGRAM", mapping: "PROGRAM" }, { name: "ASALNEGARA", mapping: "ASALNEGARA" }, { name: "TAHUNTERBIT", mapping: "TAHUNTERBIT" }, { name: "ISBN", mapping: "ISBN" }, { name: "PENTERJEMAH", mapping: "PENTERJEMAH" }, { name: "EDITOR", mapping: "EDITOR" }, { name: "JMLCD", mapping: "JMLCD" }, { name: "EDISI", mapping: "EDISI" }, { name: "HARGA", mapping: "HARGA" }, { name: "TAHUNPENGADAAN", mapping: "TAHUNPENGADAAN" }, { name: "STOK", mapping: "STOK" }, { name: "GAMBAR", mapping: "GAMBAR" }, { name: "ILUSTRATOR", mapping: "ILUSTRATOR" }] }); //LISTENER STATUS PUBLISH var fnSelectStPublish = function(combo, record){ var idstpublish = record.data['idstpublish']; updateStPublish(idstpublish); }; //VARIABEL KOLOM// 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: RH.h3('Kode Buku'), width: 100, dataIndex: 'KDBUKU', sortable: true }, { header: RH.h3('ISBN'), width: 100, dataIndex: 'ISBN', sortable: true }, { header: RH.h3('Jenis Buku'), width: 100, dataIndex: 'NMJNSBUKU', sortable: true }, { header: RH.h3('Judul'), width: 150, dataIndex: 'JUDUL', sortable: true }, { header: RH.h3('Pengarang'), width: 150, dataIndex: 'NMPENGARANG', sortable: true }, { header: RH.h3('Penerbit'), width: 150, dataIndex: 'PENERBIT', sortable: true }, { header: RH.h3('Stok'), width: 80, align: 'center', dataIndex: 'STOK', sortable: true }] }); var vw = new Ext.grid.GridView({ emptyText: '< Buku Belum Dipilih >' }); 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: 10, store: ds_ejurnal, displayInfo: true, displayMsg: 'Data Buku Dari {0} - {1} of {2}', emptyMsg: 'Buku Belum Dipilih.' }); //VARIABEL GRID// var grid_nya = new Ext.grid.EditorGridPanel({ store: ds_ejurnal, frame: true, //height: 500, autoScroll: true, autoHeight: true, autoWidth: true, //plugins: cari_data, id: 'grid_det_product', buttonAlign: 'left', defaults: { anchor: '-10' }, forceFit: true, tbar: [{ xtype: 'buttongroup', title: 'Pencarian', columns: 5, width: 1000, defaults: { scale: 'small' }, items: [ //SEARCH JENIS BUKU// { xtype:'checkbox', boxLabel: '', name: 'cbjbuku', id: 'cbjbuku', listeners: { change: function () { if (Ext.getCmp('cbjbuku').getValue()==false) { Ext.getCmp('kdjbuku').setValue(""); Ext.getCmp('jbuku').setValue(""); } } } }, { text: 'Jenis Buku' }, { xtype: 'textfield', name: 'jbuku', id: 'jbuku', readOnly:true, width: 250 }, { xtype: 'button', iconCls: 'silk-find', id: 'btn_data_jbuku', width: 5, handler: function() { find_x("Data Jenis Buku", 16); } }, { xtype: 'textfield', name: 'kdjbuku', id: 'kdjbuku', hidden:true, readOnly:true }, //SEARCH KODE BUKU// { xtype:'checkbox', boxLabel: '', name: 'cbkdbuku', id: 'cbkdbuku', listeners: { change: function () { if (Ext.getCmp('cbkdbuku').getValue()==false) { Ext.getCmp('kdbuku').setValue(""); } } } }, { text: 'Kode Buku' }, { xtype: 'textfield', name: 'kdbuku', id: 'kdbuku', width: 250, validator: function() { ds_ejurnal.setBaseParam('cbjbuku', Ext.getCmp('cbjbuku').getValue()); ds_ejurnal.setBaseParam('cbkdbuku', Ext.getCmp('cbkdbuku').getValue()); ds_ejurnal.setBaseParam('cbisbn', Ext.getCmp('cbisbn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('kdjbuku', Ext.getCmp('kdjbuku').getValue()); ds_ejurnal.setBaseParam('kdbuku', Ext.getCmp('kdbuku').getValue()); ds_ejurnal.setBaseParam('isbn', Ext.getCmp('isbn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, //SEARCH ISBN// { xtype:'checkbox', boxLabel: '', name: 'cbisbn', id: 'cbisbn', listeners: { change: function () { if (Ext.getCmp('cbisbn').getValue()==false) { Ext.getCmp('isbn').setValue(""); } } } }, { text: 'ISBN' }, { xtype: 'textfield', name: 'isbn', id: 'isbn', width: 250, validator: function() { ds_ejurnal.setBaseParam('cbjbuku', Ext.getCmp('cbjbuku').getValue()); ds_ejurnal.setBaseParam('cbkdbuku', Ext.getCmp('cbkdbuku').getValue()); ds_ejurnal.setBaseParam('cbisbn', Ext.getCmp('cbisbn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('kdjbuku', Ext.getCmp('kdjbuku').getValue()); ds_ejurnal.setBaseParam('kdbuku', Ext.getCmp('kdbuku').getValue()); ds_ejurnal.setBaseParam('isbn', Ext.getCmp('isbn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, //SEARCH JUDUL// { xtype:'checkbox', boxLabel: '', name: 'cbjudul', id: 'cbjudul', listeners: { change: function () { if (Ext.getCmp('cbjudul').getValue()==false) { Ext.getCmp('judul').setValue(""); } } } }, { text: 'Judul' }, { xtype: 'textfield', name: 'judul', id: 'judul', width: 250, validator: function() { ds_ejurnal.setBaseParam('cbjbuku', Ext.getCmp('cbjbuku').getValue()); ds_ejurnal.setBaseParam('cbkdbuku', Ext.getCmp('cbkdbuku').getValue()); ds_ejurnal.setBaseParam('cbisbn', Ext.getCmp('cbisbn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('kdjbuku', Ext.getCmp('kdjbuku').getValue()); ds_ejurnal.setBaseParam('kdbuku', Ext.getCmp('kdbuku').getValue()); ds_ejurnal.setBaseParam('isbn', Ext.getCmp('isbn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, //SEARCH PENGARANG// { xtype:'checkbox', boxLabel: '', name: 'cbpengarang', id: 'cbpengarang', listeners: { change: function () { if (Ext.getCmp('cbpengarang').getValue()==false) { Ext.getCmp('pengarang').setValue(""); } } } }, { text: 'Pengarang' }, { xtype: 'textfield', name: 'pengarang', id: 'pengarang', width: 250, validator: function() { ds_ejurnal.setBaseParam('cbjbuku', Ext.getCmp('cbjbuku').getValue()); ds_ejurnal.setBaseParam('cbkdbuku', Ext.getCmp('cbkdbuku').getValue()); ds_ejurnal.setBaseParam('cbisbn', Ext.getCmp('cbisbn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('kdjbuku', Ext.getCmp('kdjbuku').getValue()); ds_ejurnal.setBaseParam('kdbuku', Ext.getCmp('kdbuku').getValue()); ds_ejurnal.setBaseParam('isbn', Ext.getCmp('isbn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, //BUTTON CARI// { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, { xtype: 'button', text: ' Cari ', iconCls: 'silk-zoom', id: 'btn_data', width: 5, style: 'margin-left: 76px', handler: function() { ds_ejurnal.setBaseParam('cbjbuku', Ext.getCmp('cbjbuku').getValue()); ds_ejurnal.setBaseParam('cbkdbuku', Ext.getCmp('cbkdbuku').getValue()); ds_ejurnal.setBaseParam('cbisbn', Ext.getCmp('cbisbn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('kdjbuku', Ext.getCmp('kdjbuku').getValue()); ds_ejurnal.setBaseParam('kdbuku', Ext.getCmp('kdbuku').getValue()); ds_ejurnal.setBaseParam('isbn', Ext.getCmp('isbn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, ] }/*, { xtype: 'button', text: ' Add ', iconCls: 'silk-add', id: 'btn_add', width: 5, style: 'margin-bottom: 100px', handler:function() { fnAddJurnal(); } }, { text: 'Edit', id: 'btn_edit', iconCls: 'silk-edit', style: 'margin-bottom: 100px', handler:function(){ if(sm_nya.getCount() > 0){ var module_id = sm_nya.getSelected().data['kdjurnal']; f_jurnal_form(module_id,ds_ejurnal); Ext.getCmp('kdprodi').enable(); } } }, { text: 'Delete', id: 'btn_delete', iconCls: 'silk-delete', style: 'margin-bottom: 100px', handler:function(){ if(sm_nya.getCount() > 0){ var delete_id = sm_nya.getSelected().data['kdjurnal']; Ext.MessageBox.show({ title: "Konfirmasi", msg: "Anda Yakin Untuk menghapus Data ini?", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { Ext.Ajax.request({ url: BASE_URL + 'e_library/c_jurnal/delete', method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Hapus Data Berhasil"); ds_ejurnal.load(); }, failure:function(result){ Ext.MessageBox.alert("Informasi", "Hapus Data Gagal"); }, params: { hapus_id: delete_id } }); } } }); } } } */ ], sm: sm_nya, vw: vw, cm: cm, bbar: paging, clicksToEdit: 1, listeners: { rowclick: function rowClick(grid, rowIdx) { var rec = ds_ejurnal.getAt(rowIdx); RH.setCompValue('frm.kdbuku', rec.data['KDBUKU']); RH.setCompValue('frm.isbn', rec.data['ISBN']); RH.setCompValue('frm.kdjnsbuku', rec.data['NMJNSBUKU']); RH.setCompValue('frm.judul', rec.data['JUDUL']); RH.setCompValue('frm.nmpengarang', rec.data['NMPENGARANG']); RH.setCompValue('frm.nmpenerbit', rec.data['NMPENERBIT']); RH.setCompValue('frm.tahunterbit', rec.data['TAHUNTERBIT']); RH.setCompValue('frm.stok', rec.data['STOK']); isi_gambar_jurnal(rec.data['cover']); Ext.getCmp('bdown').enable(); file = rec.data["file"]; kdjurnal = rec.data["kdjurnal"]; } } }); //DISPLAY FORM PANEL// var DispPanel = new Ext.form.FormPanel({ id: 'fp.mhsFDisp', fileUpload: true, border: false, autoScroll:true, bodyStyle: 'padding:5px 5px 0', frame: true, labelAlign: 'top', layout: 'anchor', forceFit:true, items: [ { layout: 'form', defaultType: 'textfield', defaults: { readOnly: true }, items: [ /* p , */ { id: 'frm.kdbuku', fieldLabel: 'Kode Buku' ,width: 225, height:24} , { id: 'frm.isbn', fieldLabel: 'ISBN' ,width: 225, height:24} , { id: 'frm.kdjnsbuku', fieldLabel: 'Jenis Buku' ,width: 225, height:24} , { id: 'frm.judul', fieldLabel: 'Judul' ,width: 225, height:50, xtype: 'textarea'} , { id: 'frm.nmpengarang', fieldLabel: 'Pengarang' ,width: 225, height:24} , { id: 'frm.nmpenerbit', fieldLabel: 'Penerbit' ,width: 225, height:24} , { id: 'frm.tahunterbit', fieldLabel: 'Tahun Terbit' ,width: 225, height:24} , { id: 'frm.stok', fieldLabel: 'Stok' ,width: 225, height:24} ] }] }); //FUNCTION// //add// function fnAddJurnal(){ f_jurnal_form('',ds_ejurnal); } /**FUNCTIONS UPDATE GRID KELAS*/ function updateStPublish(idstpublish){ Ext.Ajax.request({ url: BASE_URL + 'e_library/c_jurnal/update_stpublish', params: { kdjurnal : RH.getCompValue('frm.kdjurnal'), idstpublish : idstpublish, }, success: function() { Ext.Msg.alert("Info", "Ubah Berhasil"); ds_ejurnal.reload(); }, failure: function() { Ext.Msg.alert("Info", "Ubah Data Gagal"); } }); } //=================================================== AWAL// var jurnalPanel = new Ext.Panel({ layout: 'border', defaults: { collapsible: true, split: true }, items: [{ collapsible: false, title: "OPAC", region: 'center', id: 'images-view', items: [grid_nya], }, { region: 'east', xtype: 'panel', title: 'Detail Buku', border: true, layout:'fit', width:270, collapsible: true, collapseMode: 'header', titleCollapse: true, titleAlign: 'center', items: [DispPanel], collapsed: false }], listeners: { 'afterrender': function() { } } }); get_content(jurnalPanel); }