 @extends('admin.layouts.main-layout')
 @section('content')
 <div class="card">
   <div class="card-header">
     <h3 class="card-title">How To Play Roullete</h3>
   </div>
   <!-- <div align="left">
     <a href="{{ url('admin/how-to-play/create') }}" class="btn btn-info">Add New </a>
   </div> -->
   <div class="card-header">
     <!-- <form role="form" method="get" action="">
       <div class="box-body">
         <div class="row">
           <div class="col-md-3">
             <div class="form-group">
               <input type="text" name="search_name" class="form-control  " value="{{Request::get('search_name')}}" placeholder="Search Banner Name">
             </div>
           </div>
           <div class="col-md-3">
             <button type="submit" class="btn btn-success mr-2">Search</button>
             <a href="{{url('admin/banner')}}" class="btn btn-danger mr-2">Reset</a>
           </div>
         </div>
       </div>
     </form> -->
   </div>
   <!-- /.card-header -->
   <div class="card-body">
     @if(session()->has('message'))
     <div class="alert alert-success">
       {{ session()->get('message') }}
     </div>
     @endif
     <div id="example1_wrapper" class=" dt-bootstrap4">
       <div class="row">
         <div class="col-md-12">
           <div class='tablescroll'>
             <div class="table-responsive">
               <div class="table-responsive">
                 <table class="sa-datatables table">
                   <thead>
                     <th>Sr.No.</th>
                     <th>Game Name</th>
                     <th>Description</th>
                     <th>Status</th>
                     <th>Action</th>
                   </thead>
                   <tbody>
                     @php
                     $page = 1;
                     if (Request::input('page')) {
                     $page = Request::input('page');
                     }
                     $sort = $lists->perPage();
                     @endphp
                     @foreach($lists as $key => $list)
                     <tr>
                       <td>{{ $sort * ($page - 1) + ($key + 1) }}</td>
                       <td>{{isset($list->game) ? $list->game->name : ''}}</td>
                       <td>{{ \Illuminate\Support\Str::limit($list->description, 100, '...') }}</td>
                       <td>
                         <a href="{{url('admin/how-to-play/changestatus/'.$list->id)}}" class="badge rounded-pill p-2 px-3 btn-{{($list->status == '0') ? 'danger' : 'success'}} button_flow" data-toggle="tooltip" data-placement="top" title="" onclick="return confirm('Do you Really want to {{($list->status == '0') ? 'Active' : 'Inactive'}} this User?')"> <i class="fa {{($list->status == '0') ? 'fa-toggle-off' : 'fa-toggle-on'}} fa-xl"></i></a>

                       </td>
                       <td>
                         <a href="{{url('admin/how-to-play/'.$list->id.'/edit')}}"
                           class="btn btn-primary"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
                       </td>
                     </tr>
                     @endforeach
                   </tbody>
                 </table>
               </div>
             </div>
           </div>
           <div class="row">
             <div class="col-md-6 text-left" style="margin: 20px 0px;">
               Showing {{$lists->firstItem()}} to {{$lists->lastItem()}} of {{$lists->total()}}
             </div>
             <div class='col-md-6 text-md-right text-start'>
               <div class='flex-wrap'>
                 {!! $lists->appends(request()->input())->links() !!}
               </div>
             </div>
           </div>
         </div>
       </div>
     </div>
   </div>
 </div>
 <!-- Modal -->
 <div id="myModal" class="modal fade" role="dialog">
   <div class="modal-dialog">
     <!-- Modal content-->
     <div class="modal-content">
       <!--  <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div> -->
       <div class="modal-body">
         <div class="container">
           <div class="justify-content-center">
             <div class="">
               <div class="card">
                 <div class="card-header">Add Point <button type="button" class="close" data-dismiss="modal">&times;</button></div>
                 <div class="card-body">
                   @if ($errors->any())
                   <div class="alert alert-danger">
                     <ul>
                       @foreach ($errors->all() as $error)
                       <li>{{ $error }}</li>
                       @endforeach
                     </ul>
                   </div>
                   @endif
                   <form method="post" action="{{ url('/admin/payment') }}" autocomplete="off" enctype="multipart/form-data">
                     @csrf
                     <div class="form-group">
                       <label for="title">Payment </label>
                       <input type="number" class="form-control"
                         name="amount" id="amount" required placeholder="Enter Amount" required="">
                     </div>
                     <br>
                     <input type="hidden" name="user_id" value="">
                     <div class="form-group">
                       <button type="submit" class="btn btn-primary">Submit</button>
                     </div>
                   </form>
                 </div>
               </div>
             </div>
           </div>
         </div>
       </div>
       <div class="modal-footer">
         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
       </div>
     </div>
   </div>
 </div>


 <!-- Modal -->
 <div id="rmovePoint" class="modal fade" role="dialog">
   <div class="modal-dialog">

     <!-- Modal content-->
     <div class="modal-content">
       <!--  <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div> -->
       <div class="modal-body">
         <div class="container">
           <div class="justify-content-center">
             <div class="">
               <div class="card">
                 <div class="card-header">Remove Point <button type="button" class="close" data-dismiss="modal">&times;</button></div>
                 <div class="card-body">
                   @if ($errors->any())
                   <div class="alert alert-danger">
                     <ul>
                       @foreach ($errors->all() as $error)
                       <li>{{ $error }}</li>
                       @endforeach
                     </ul>
                   </div>
                   @endif
                   <form method="post" action="{{ url('/admin/removepoint') }}" autocomplete="off" enctype="multipart/form-data">
                     @csrf
                     <div class="form-group">
                       <label for="title">Payment </label>
                       <input type="number" class="form-control"
                         name="amount" id="amount" required placeholder="Enter Amount" required="">
                     </div>
                     <br>
                     <input type="hidden" name="user_idr" value="">
                     <div class="form-group">
                       <button type="submit" class="btn btn-primary">Submit</button>
                     </div>

                   </form>
                 </div>
               </div>
             </div>
           </div>
         </div>
       </div>
       <div class="modal-footer">
         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
       </div>
     </div>

   </div>
 </div>
 @endsection
 @section('js-content')
 <script>
   function openModal(id) {
     $('input[name="user_id"]').val(id);
     $('#myModal').modal();
   }

   function removePoint(id) {
     $('input[name="user_idr"]').val(id);
     $('#rmovePoint').modal();
   }
 </script>
 @endsection