
  <h2>Filterable Table for Docker API</h2>
  <p>Type something in the input field to search the table for first names, last names or emails:</p>  
  <input class="form-control" id="myInput" type="text" placeholder="Search..">
  <br>
  <!-- <form method="post" action="{{route('api')}}"> -->
  <table class="table table-bordered" style="color:#fff">
    <thead>
      <tr>
        <th>Container</th>
        <th>State</th>
        <th>Published Ports</th>
        <th>Status</th>
        <th>Created</th>
        <th>P.S</th>
      </tr>
    </thead>
    <tbody id="myTable">
        @foreach($contents as $content)
            <tr>
                <form method="post" action="{{route('api')}}">
                  <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); ?>">
                  <td>{{$content['Names'][0]}}</td>
                  <td>{{$content['State']}}</td>
                  <td></td>
                  <td>{{$content['Status']}}</td>
                  <td>{{$content['Created']}}</td>
                  <td>
                      <input type = "hidden" name = "id" value = "{{$content['Id']}}">
                      <button  type="submit" class="btn btn-Success" name="btn" value="start">啟動</button>
                      <button type="submit" class="btn btn-Danger" name="btn" value="stop">停止</button>
                      <button type="submit" class="btn btn-Primary" name="btn" value="restart">重啟</button>
                  </td>
                </form>
            </tr>
        @endforeach
    </tbody>
  </table>
  <!-- </form>     -->
  <p>Note that we start the search in tbody, to prevent filtering the table headers.</p>


<script>
$(document).ready(function(){
  $("#myInput").on("keyup", function() {
    var value = $(this).val().toLowerCase();
    $("#myTable tr").filter(function() {
      $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
    });
  });
});
</script>