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 :  /wamp/www/sipapbd_2020_pergeseran3/application/modules/urusan/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /wamp/www/sipapbd_2020_pergeseran3/application/modules/urusan/views/urusan_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:['Urusan', 'Nama Urusan','',''],
      colModel:[
        {name:'kode', width:100, editable:true},
        {name:'nama', width:750, editable:true},
        {name:'last_changed', editable:true, hidden:true},
        {name:'param', editable:true, hidden:true},
      ],
      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',
  },{},{},{},{});
  <?php
  if ($canPrint)
  {
  ?>
  $("#grid").jqGrid().navSeparatorAdd('#pager')
    .navButtonAdd('#pager',{
      caption:'Cetak',
      onClickButton: function(){ preview({"tipe":"daftar"}, grid)},
      title:'Cetak Daftar',
      buttonicon:'ui-icon-print',
      position:'last'
    });
<?php
  }
?>

  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 Urusan 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 == true) {
          show_info(res.message, 'Sukses');
          grid.jqGrid('delRowData', id);
        }
        else {
          show_error(res.message, 'Gagal');
          if(res.error=="exist") grid.trigger('reloadGrid');
        }
      },
      });
    });
  }

  function oneditfunc(id){
    $('#'+id+'kode').focus();  // focus ke elemen pertama
  }

  function beforesavefunc(opt, id){
    kode = $('#'+id+'_kode').val();
    nama = $('#'+id+'_nama').val();

    // cek semua kolom sudah diisi
    if (kode == ''  || nama == '') {show_warning('Silahkan melengkapi semua isian Urusan.'); return false;}

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

  function aftersavefunc(id, resp){
    oresp = JSON.parse(resp.responseText);
    newid = oresp.id;
    grid.jqGrid('setCell', id, 'param', '0');
    if (oresp.isSuccess){
      show_info(oresp.message, 'Sukses');
      grid.jqGrid('setCell', id, 'last_changed', oresp.last_changed);
      if (newid !== id){
        data = $(this).jqGrid('getRowData', id);
        data.id = newid;
        data.last_changed = oresp.last_changed;
        $(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){
    $('#'+id+'_kode').keypress(function(e) {
      if (e.which == '13' || e.keyCode == '13' ||e.charCode == '0') {
        oresp = JSON.parse(resp.responseText);
        respon(oresp,grid,modul,successfunc,aftersavefunc,errorfunc,afterrestorefunc);
      }
    });
    $('#'+id+'_nama').keypress(function(e) {
      if (e.which == '13' || e.keyCode == '13' ||e.charCode == '0') {
        oresp = JSON.parse(resp.responseText);
        respon(oresp,grid,modul,successfunc,aftersavefunc,errorfunc,afterrestorefunc);
      }
    });
  }

  function afterrestorefunc(){
    $(this).focus();
  }

  grid.gridResize();

});
</script>

Youez - 2016 - github.com/yon3zu
LinuXploit