403Webshell
Server IP : 127.0.0.1  /  Your IP : 192.168.99.1
Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9
System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64
User : Administrator ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /ADMINISTRATOR/simbada_2017/simbada_2017/application/modules/lokasi/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /ADMINISTRATOR/simbada_2017/simbada_2017/application/modules/lokasi/views/lokasi_view.php
<fieldset>
  <legend><?php echo $breadcrumbs;?></legend>
</fieldset>

<div id="grid_container">
  <div id="search" class="row">
  </div>
  <table id="grid"></table>
  <div id="pager"></div>
</div>

<script>
<?php
  $akses = isset($akses) ? $akses : 0;
  $canEdit = $akses >= 3;
  $canPrint = $akses >= 2;
?>
var grid = $('#grid'), id = last = 0, canEdit = <?php echo $canEdit ? 'true' : 'false'; ?>;

$(document).ready(function() {
  params = {
    container : $('#search'),
    grid : grid,
    cols : <?php echo json_encode($grid['fields']); ?>,
  }
  Search.init(params);

  $('#grid').jqGrid({
      url:'<?php echo base_url().$modul?>/get_daftar',
      editurl:'<?php echo base_url().$modul?>/proses',
      datatype:'json',
      mtype:'POST',
      colNames:['Kode Lokasi', 'Nama Lokasi', 'Alamat', 'Id SKPD', 'SKPD'],
      colModel:[
        {name:'kd_lokasi', width:120, editable:true},
        {name:'nm_lokasi', width:280, editable:true},
				{name:'alamat', width:350, editable:true},
				{name:'id_skpd', width:60, hidden:true, editable:true},
				{name:'nm_skpd', width:400, sortable:false, editable:true, cellattr:function(rowid, val, raw){return ' title="'+raw[05]+'"';}, editoptions:{dataInit:initselect}},
      ],
      pager:'#pager',
      rowNum:1000000,
      scroll:true,
      rownumbers:true,
      viewrecords:true,
      gridview:true,
      shrinkToFit:false,
      autowidth:true,
      height:'400',
      recordtext:'{2} baris',
      sortname: 'kode',
      onSelectRow: function(id){
        if(id && id!==last){
          $(this).restoreRow(last);
          last=id;
        }
      },
      ondblClickRow: edit_row,
    });
    $("#grid").jqGrid('bindKeys', {"onEnter": edit_row});
    $("#grid").jqGrid('navGrid', '#pager', {
      add: canEdit,
      addtext: 'Tambah',
      addfunc:add_row,
      edit: canEdit,
      edittext: 'Ubah',
      editfunc:edit_row,
      del:canEdit,
      deltext: 'Hapus',
      delfunc:del_row,
      search:false,
      refresh: true,
      refreshtext:'Refresh',
  })
	.navButtonAdd('#pager',{
		caption:'Cetak&nbsp;',
		onClickButton: function(){ print_list() },
		title:'Cetak Daftar',
		buttonicon:'ui-icon-print',
		position:'last'
	});  

  function add_row(){
    if (!canEdit) return;

    newid = --id;
    editparam = {
      keys : true,
      aftersavefunc: aftersavefunc,
      beforeSaveRow: beforesavefunc,
      afterrestorefunc: afterrestorefunc,
      oneditfunc: oneditfunc,
      successfunc: successfunc,
      errorfunc: errorfunc,
      restoreAfterError: false,
    }

    $(this).jqGrid('addRowData', newid, {}, 'last');
    $("#"+newid).addClass("jqgrid-new-row");
    $(this).jqGrid('editRow', newid, editparam);
    $(this).jqGrid('setSelection', newid);
  }

  function edit_row(id){
    if (!canEdit) return;

    editparam = {
      keys : true,
      aftersavefunc: aftersavefunc,
      beforeSaveRow: beforesavefunc,
      afterrestorefunc: afterrestorefunc,
      oneditfunc: oneditfunc,
      successfunc: successfunc,
      errorfunc: errorfunc,
      restoreAfterError: false,
    }
    $(this).jqGrid('editRow', id, editparam);

    last = id;
  }

  function del_row(id){
    if (!canEdit) return;

    var grid = $(this),
		question = 'Hapus Fungsi dari daftar ?';
    confirmation(question).then(function(answer){
      if (!answer) return;

      $.ajax({
				url: '<?php echo base_url().$modul?>/hapus',
				type: "post",
				dataType: "json",
				data: {id:id},
				success: function(res){
					if (res.isSuccess) show_info(res.message, 'Sukses');
					else show_error(res.message, 'Gagal');
					if(res.isSuccess == true) {
						grid.jqGrid('delRowData', id);
					}
				},
      });
    });
  }
	
	formatSelect2 = function(res){	
		return '<div>' + res.text + '</div>';
	}	
	
	function initselect(el){		
		var oid = el.id;
		$(el).select2({
			minimumInputLength: 2,
			ajax: {
				url: root+modul+'/get_skpd/',
				type: 'POST',
				dataType: 'json',
				quietMillis: 200,
				data: function(term){
					return {'q': term}
				},
				results: function(data) {
					return {results: data.results}
				},
			},
			placeholder: 'Pilih SKPD',
			allowClear: false,
			openOnEnter: false,
			dropdownAutoWidth : true,
			initSelection: function(element, callback){
				var data = {'text': element.val()};
				callback(data);
			},
			formatResult: formatSelect2
		});		
		$(el).on('change', function(e){			
			var ele = [
							{id: "id_skpd", nama: "nm_skpd"},
						];
			var idx = e.target.id;
			
			// apply selection to grid element
			$.each(ele, function(i, x){
				var pos = idx.indexOf(x.nama);				
				
				if ( pos > -1){
					var pre = idx.substring(0, pos);					
					
					$('#'+pre+x.id).val(e.added ? e.added.id : '');					
					$(e.target).val(e.added ? e.added.text : '');
					$('#'+pre+x.nama).val(e.added ? e.added.text : '');
					
					var rowId = $("#grid").jqGrid('getGridParam','selrow');  
					var rowData = jQuery("#grid").getRowData(rowId);					
					$("#grid").jqGrid('setCell', rowId, 'nm_skpd', e.added ? e.added.text : '');
						
					return false;
				}
			});
			e.stopPropagation();
		});
	}	

  function oneditfunc(id){
    $('#'+id+'kd_lokasi').focus();
  }

  function beforesavefunc(opt, id){
    kd_lokasi = $('#'+id+'_kd_lokasi').val();
    nm_lokasi = $('#'+id+'_nm_lokasi').val();
		alamat = $('#'+id+'_alamat').val();
		id_skpd = $('#'+id+'_id_skpd').val();

    // cek semua kolom sudah diisi
    if (kd_lokasi == ''  || nm_lokasi == '' || alamat == '' || id_skpd == '') {
			show_warning('Silahkan melengkapi semua isian Lokasi.'); 
			return false;
		}

    data = $('#grid').jqGrid('getRowData');
    found = $.grep(data, function(e){
      return (e.kd_lokasi == kd_lokasi);
    });
		
    if (found.length) {
			show_warning('Kode Lokasi sudah ada'); 
			return false;
		}
  }

  function aftersavefunc(id, resp){
    oresp = JSON.parse(resp.responseText);
    newid = oresp.id;
    if (oresp.isSuccess){
      show_info(oresp.message, 'Sukses');
      if (newid !== id){
        data = $(this).jqGrid('getRowData', id);
        data.id = newid;
        $(this).jqGrid('addRowData', newid, data, 'after', id);
        $(this).jqGrid('delRowData', id);
        $(this).jqGrid('setSelection', newid)
        last = id;
      }
    }
    else {
      show_error(oresp.message, 'Gagal');
      return false;
    }
    $(this).focus();
  }

  function successfunc(resp){
    oresp = JSON.parse(resp.responseText);
    return oresp.isSuccess;
  }

  function errorfunc(id, resp){
    oresp = JSON.parse(resp.responseText);
    show_error(oresp.message, 'Gagal');
  }

  function afterrestorefunc(){
    $(this).focus();
  }
	
	function print_list(){
		preview({"tipe":"daftar"}, grid);
	}
});
</script>

Youez - 2016 - github.com/yon3zu
LinuXploit