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/SIPBOS_2020/application/modules/pihak_ketiga/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /wamp/www/SIPBOS_2020/application/modules/pihak_ketiga/views/pihak_ketiga_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'; ?>, id_skpd = <?php echo $id_skpd; ?>, initflag = 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', 'Kode SKPD', 'Nama SKPD', 'Nama', 'Nama Perusahaan', 'Alamat', 'Nama Bank', 'No Rekening Bank', 'NPWP'],
    colModel:[
        {name:'idskpd', hidden:true, editable:true},
        {name:'kode', width:100, editable:true, edittype:'text', editoptions:{maxlength:10}},
        {name:'kdskpd', width:100, editable:true, cellattr:function(rowid, val, raw){return ' title="'+raw[2]+'"';}, editoptions:{dataInit:initselect2}},
        {name:'nmskpd', hidden:true, editable:true},
        {name:'nama', width:200, editable:true, edittype:'text', editoptions:{maxlength:100}},
        {name:'perusahaan', width:200, editable:true, edittype:'text', editoptions:{maxlength:500}},
        {name:'alamat', width:250,editable:true,edittype:'text',editoptions:{size:200}},
        {name:'bank', width:200,editable:true,edittype:'text',editoptions:{size:100}},
        {name:'norek', width:110, editable:true, edittype:'text', editoptions:{maxlength:50}},
        {name:'npwp', width:100, editable:true, edittype:'text', editoptions:{maxlength:50}},
    ],
    pager:'#pager',
    rowNum:1000000,
    scroll:true,
    rownumbers:true,
    viewrecords:true,
    gridview:true,
    shrinkToFit:false,
    autowidth:true,
    height:'400',
    recordtext:'{2} baris',
    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,
    searchtext: 'Cari',
    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
  }
?>
  /* sembunyikan kolom skpd untuk user skpd */
  if (id_skpd > 0 ) grid.jqGrid('hideCol', ['kdskpd']);
});

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

    addparam = {
      rowID : --id,
      position :"last",
      addRowParams : {
        keys : true,
        aftersavefunc: aftersave_entri,
        beforeSaveRow: beforesave_entri,
        oneditfunc: onedit_entri,
        afterrestorefunc: afterrestore_entri,
        successfunc: successfunc,
        errorfunc: errorfunc,
        restoreAfterError: false,
      }
    }
    $(this).jqGrid('addRow', addparam);
  }

  function edit_row(id){
    if (!canEdit) return;
    pejabat_event = true;

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

    last = id;
    return false;
  }

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

    var grid = $(this),
         question = 'Hapus Pihak ketiga 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);
            }
          },
      });
    });
  }

  function aftersave_entri(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('resetSelection')
        $(this).jqGrid('setSelection', newid)
        last = id;
      }
    }
    else {
      show_error(oresp.message, 'Gagal');
    }
    $(this).focus();
  }

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

    if (kode == '') {
      show_warning('Kode Pihak ketiga belum diisi.', 'Perhatian');
      return false;
    }
    if (nama == '') {
      show_warning('Nama Pihak ketiga belum diisi.', 'Perhatian');
      return false;
    }

    /* remove select2 */
    $('#'+id+'_kdskpd').select2('destroy');
  }

  function onedit_entri(id){
    // untuk akses skpd, idskpd diisi langsung
    if (id_skpd > 0) {
      $('#'+id+'_idskpd').val(id_skpd);
      $('#'+id+'_nama').focus();  // focus ke elemen pertama
    }
    else {
      $('#'+id+'_kdskpd').select2('focus');  // focus ke elemen pertama
    }
    initflag = true;
  }

  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 afterrestore_entri(id){
    $(this).focus();
  }

  function setupselect2(el){

    $(el).select2({
      minimumInputLength: 1,
      ajax: {
        url: "<?php echo base_url() ?>pilih/skpd2",
        type: 'POST',
        dataType: 'json',
        quietMillis: 200,
        data: function(term){
          return {'q': term};
        },
        results: function(data) {
          return {results: data.results}
        },
      },
      placeholder: 'Pilih SKPD',
      minimumInputLength: 0,
      openOnEnter: false,
      dropdownAutoWidth : true,
      createSearchChoice:function(term, data) {
        if ( $(data).filter( function() {
          return this.text.localeCompare(term)===0;
        }).length===0) {
          return {id:term, text:term};
        }
      },
      initSelection: function(element, callback){
        var data = {'text': element.val()};
        callback(data);
      },
      formatResult: formatResult
    });
  }

  function initselect2(el){
    var oid = el.id;
    setupselect2(el);

    $(el).on('change', function(e){
      var ele = [
              {id: "idskpd", kode: "kdskpd", nama: "nmskpd"},
            ];
      idx = e.target.id;

      // apply selection to grid element
      $.each(ele, function(i, x){
        pos = idx.indexOf(x.kode);
        if ( pos > -1){
          pre = idx.substring(0, pos);
          if (x.id) $('#'+pre+x.id).val(e.added ? e.added.id : null);
          if (x.kode) $(e.target).val(e.added ? e.added.text : '');
          if (x.nama) $('#'+pre+x.nama).val(e.added.nama ? e.added.nama : '');
          return false;
        }
      });
      e.stopPropagation();
    });
    $(el).on('select2-removed', function(e){
      var ele = [
              {id: "idskpd", kode: "kdskpd", nama: "nmskpd"},
            ];
      idx = e.target.id;

      // apply selection to grid element
      $.each(ele, function(i, x){
        pos = idx.indexOf(x.kode);
        if ( pos > -1){
          pre = idx.substring(0, pos);
          $('#'+pre+x.id).val(null);
          return false;
        }
      });
      e.stopPropagation();
    });
    $('#s2id_' + oid).on('keyup', function(e){
      if (initflag) {
        initflag = !initflag;
        return;
      }

      if (e.keyCode === 13) {
        ev = $.Event('keydown');
        ev.keyCode= 13;
        $(el).trigger(ev);
      }
    });
  }

  formatResult = function(res){
    return '<div><strong>' + res.text + '</strong></div><div style="border-bottom:1px solid #ccc">' + res.nama + '</div>';
  }

</script>

Youez - 2016 - github.com/yon3zu
LinuXploit