
<form  action="/insert" method="POST">
<input type = "hidden" name = "_token" value = "<?php echo csrf_token(); ?>">


    <div class="thumbnail">
        <div class="form-group row">
            <div class="col-lg-2">
                <input type="text" class="form-control" id="name" name="name" placeholder="請輸入姓名" required="">
            </div>
            <div class="col-lg-2">
                <input type="text" class="form-control" id="age" name="age" placeholder="請輸入年齡" required="">
            </div>
            <div class="col-lg-2">
                <select class="form-control" id="sex" name="sex">
                <option >男</option>
                <option >女</option>
                </select>
            </div>
            <div class="col-lg-2">
                <select class="form-control" id="work" name="work">
                <option>後端</option>
                <option>前台</option>
                <option>設計</option>
                <option>項目</option>
                </select>
            </div> 
            <div class="col-lg-2">
                <input id=phone name=phone type="text" class="form-control" placeholder="請輸入手機號碼">
            </div>
                <button type="submit" class="btn btn-primary">新增</button>

            
                <div class="col">
            <input class="form-control" id="myInput" type="text" placeholder="Search..">
        </div>
        </div>
    </div>


<div class="col-lg-13">
 
<div class="thumbnail">

   <br>
    <table style="text-align:center" class="table table-dark table-striped">
     <thead>
       <tr>
         <th>ID</th>
         <th>姓名</th>
         <th>年齡</th>
         <th>性別</th>
         <th>職業</th>
         <th>電話</th>
         <th>編輯</th> 
       </tr>
     </thead>
     <tbody id="myTable">
     @foreach ($people as $peoples) 
         <tr>
         <td>{{$peoples->id}}</td>
         <td>{{$peoples->name}}</td>
         <td>{{$peoples->age}}</td>
         <td>{{$peoples->sex}}</td>
         <td>{{$peoples->work}}</td>
         <td>{{$peoples->phone}}</td>
         <td>
         <form action="delete" method="POST">     
         <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); ?>">
         <button type="submit" class="btn btn-Success" value="{{$peoples->id}}" name='update'>修改</button>
         <button type="submit" class="btn btn-Danger" value="{{$peoples->id}}" name='delete'>刪除</button>
         </td>
         </tr>
         </form>
 
         @endforeach
     </tbody>
   </table>
   

 
 
 
 </div>
 </div>
 <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>
 
