<div class='row justify-content-end'>
    <div class='col-md-4'>
        <form>
            <div class="input-group mb-3">
              <input type="text" name="key" class="form-control" placeholder="Cari Member" aria-label="Cari Member" aria-describedby="button-addon2" value="{{request()->key}}">
              <button class="btn btn-primary" type="submit" id="button-addon2"><span class='fa fa-search'></span></button>
            </div>            
        </form>
    </div>
</div>
<div class="table-responsive">
    <table class="table table-hover myTable" id="mytable">
        <thead>
            <tr class="table-primary">
                <th class="text-center">#</th>
                <th>Nama</th>
                <th>Email</th>
                <th>Phone</th>
                <th>Tgl Lahir</th>
                <th>Total Poin</th>
                <th>Cabang</th>
                <th>Tipe Member</th>
                <th width="11%">Aksi</th>
            </tr>
        </thead>
        <tbody>
            @php
                $no = isset($_GET['page']) ? ($_GET['page']-1) * 25 : 0;
            @endphp
            @foreach($data as $item)
                @php
                    $no++;
                @endphp
                <tr>
                    <td>{{$no}}</td>
                    <td>{{$item->nama}}</td>
                    <td>{{$item->email}}</td>
                    <td>{{$item->phone}}</td>
                    <td>{{$item->tgl_lahir}}</td>
                    <td>{{$item->poin}}</td>
                    <td>{{$item->cabang}}</td>
                    <td>{{$item->category}}</td>
                        <td>
                        <div class="form-inline btn-action">
                             <a href="{{url('voucher/create?member='.$item->id)}}" class="mr-2 mb-2">
                                         <button type="button" id="PopoverCustomT-1" class="btn btn-rgb-success btn-sm"
                                             data-toggle="tooltip" title="Create Voucher" data-placement="top"><span
                                                 class="fa fa-gift fa-sm"></span></button>
                             </a>              
                             @if(Auth::user()->level == 0)
                                 <a href={{url('member/'.$item->id.'/edit')}} class="mr-2 mb-2">
                                             <button type="button" id="PopoverCustomT-1" class="btn btn-rgb-primary btn-sm"
                                         data-toggle="tooltip" title="Edit" data-placement="top"><span
                                             class="fa fa-edit fa-sm"></span></button>
                                 </a>
                                 <form action="{{route('member.destroy', $item->id)}}" method="post" class="mr-2 mb-2">
                                     {{csrf_field()}}
                                     {{method_field("DELETE")}}
                                     <button type="submit" class="btn btn-rgb-danger btn-sm" data-toggle="tooltip"
                                         title="Hapus" data-placement="top"
                                         onclick="return confirm('Apakah anda yakin ingin menghapus ?')">
                                         <span class="fa fa-trash fa-sm"></span>
                                     </button>
                                 </form>
                             @endif
                     </div>                        
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
</div>
{{ $data->links() }}    
