loreng

[SETTING] Auto Filter

Feb 20th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 4.13 KB | None | 0 0
  1. @extends('admin.layoutview')
  2. @section('content')
  3.  
  4. <div class="col-md-6" style="padding:0;">
  5.     <h1>{{$title}}</h1>
  6. </div>
  7. <div class="col-md-6" style="padding:16px 0 0;">
  8.     <div class="table-toolbar">
  9.         <div class="btn-group pull-right">
  10.             <button class="btn btn-default" onclick="window.location.href='{{ url("cuti/add") }}'">
  11.                 <i class="fa fa-plus"></i> &nbsp;&nbsp;<b>Add New</b>
  12.             </button>
  13.             <button class="btn btn-default" data-toggle="dropdown"><b>Tools</b> &nbsp;<i class="fa fa-caret-down"></i></button>
  14.             <ul class="dropdown-menu pull-right">
  15.                 <li>
  16.                     <a href="#"><i class="fa fa-print"></i>&nbsp;&nbsp;Print</a>
  17.                 </li>
  18.                 <li>
  19.                     <a href="#"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Save as PDF</a>
  20.                 </li>
  21.                 <li>
  22.                     <a href="#"><i class="fa fa-file-excel-o"></i>&nbsp;&nbsp;Export to Excel</a>
  23.                 </li>
  24.             </ul>
  25.         </div>
  26.     </div>
  27. </div>
  28. <div class="clearfix"></div>
  29. <br/>
  30. <select id="myInput" onchange="myFunction()">
  31.    <option value="">- Status -</option>
  32.    <option value="1">Pending</option>
  33.    <option value="2">Approve</option>
  34.    <option value="3">Cancel</option>
  35.    <option value="4">Reject</option>
  36. </select>
  37. <div class="portlet box grey">
  38.     <div class="portlet-body">
  39.         <table id="myTable" cellpadding="0" cellspacing="0" border="0"  class="table table-striped table-hover">
  40.             <form id="frmdata">
  41.                 <tr>
  42.                     <th>No</th>
  43.                     <th>Nama Karyawan</th>
  44.                     <th>Alamat</th>
  45.                     <th>Bagian</th>
  46.                     <th>Jumlah Hari</th>
  47.                     <th>Dari Tanggal</th>
  48.                     <th>Sampai Tanggal</th>
  49.                     <th>Jenis Cuti</th>
  50.                     <th>Action Status</th>
  51.                     <th>Status</th>
  52.                     <th>Action</th>    
  53.                 </tr>
  54.                 <?php $no = 1?>
  55.                 @foreach($data as $row)
  56.  
  57.                 <tr class="gradeX">
  58.                     <td style="line-height:6.2;">{!! $no++ !!}</td>
  59.                     <td style="line-height:6.2;">{!! $row["admin_name"] !!}</td>
  60.                     <td style="line-height:6.2;">{!! $row["alamat"] !!}</td>
  61.                     <td style="line-height:6.2;">{!! $row["user_group_name"] !!}</td>
  62.                     <td style="line-height:6.2;">{!! $row["jumlah_hari"] !!}</td>
  63.                     <td style="line-height:6.2;">{!! $row["dari"] !!}</td>
  64.                     <td style="line-height:6.2;">{!! $row["sampai"] !!}</td>
  65.                     <td style="line-height:6.2;">{!! $row["jenis"] !!}</td>
  66.                         <td style="line-height:6.2;">
  67.                         <form action="{{url('cuti/approved/'.$data[0]['id_cuti'])}}" method="POST">
  68.                         <button class="btn btn-action" type="submit"><i class="kfa fa fa-approve">Approve</i></button>
  69.                     </form>
  70.                         <form action="{{url('cuti/cancel/'.$data[0]['id_cuti'])}}" method="POST">
  71.                         <button class="btn btn-action" type="submit"><i class="kfa fa fa-approve">Cancel</i></button>
  72.                         </form>
  73.                         <form action="{{url('cuti/reject/'.$data[0]['id_cuti'])}}" method="POST">
  74.                         <button class="btn btn-action" type="submit"><i class="kfa fa fa-approve">Reject</i></button>
  75.                     </form>
  76.                     </td>
  77.                     <td style="line-height:6.2;">{!! $row["status"] !!}</td>
  78.                     <td style="line-height:6.2;">
  79.                         <button class="btn btn-action" onclick="window.location.href='{!! url("cuti/edit/".$row["id_cuti"]) !!}'"><i class="kfa fa fa-file"></i></button>
  80.                         <button class="btn btn-action" onclick="del_confirm('Are you sure to delete {!! $row["id_cuti"] !!} from users?','{{ url("cuti/delete/".$row["id_cuti"]) }}')"><i class="kfa fa fa-remove"></i></button>
  81.                         </form>
  82.                     </td>
  83.                 </tr>
  84.                
  85.                 @endforeach
  86.  
  87.         </table>
  88.     </div> 
  89. </div>
  90.  
  91. <script>
  92.     function del_confirm(msg,url){
  93.         if(confirm(msg)){
  94.             window.location.href=url
  95.         }else{
  96.             false;
  97.         }
  98.     }
  99. </script>
  100. <script>
  101. function myFunction() {
  102.   var input, filter, table, tr, td, i, txtValue;
  103.   input = document.getElementById("myInput");
  104.   filter = input.value.toUpperCase();
  105.   table = document.getElementById("myTable");
  106.   tr = table.getElementsByTagName("tr");
  107.   for (i = 0; i < tr.length; i++) {
  108.    td = tr[i].getElementsByTagName("td")[9];
  109.    if (td) {
  110.      txtValue = td.textContent || td.innerText;
  111.      if (txtValue.toUpperCase().indexOf(filter) > -1) {
  112.         tr[i].style.display = "";
  113.       } else {
  114.         tr[i].style.display = "none";
  115.       }
  116.     }      
  117.   }
  118. }
  119. </script>
  120.  
  121. @endsection
Advertisement
Add Comment
Please, Sign In to add comment