@include('admin.include.header')

      <!-- Main Content -->
      <div class="main-content">
        <section class="section">
          <div class="section-header">
            <h1>All Reviews</h1>
            <div class="section-header-breadcrumb">
              <div class="breadcrumb-item active"><a href="{{ url('admin') }}">Dashboard</a></div>
              <div class="breadcrumb-item"><a href="javascript:void(0)">Reviews</a></div>
              <div class="breadcrumb-item">All Reviews</div>
            </div>
          </div>

          <div class="section-body">

            <div class="row">
              <div class="col-12 col-md-12 col-lg-12">
                <div class="card">
                  <div class="card-header">
                    <h4>Reviews</h4>
                  </div>
                  <div class="card-body">
                    @if(!$data->isEmpty())
                        <div class="table-responsive">
                            <table class="table table-striped table-md">
                                <tr>
                                    <th>#</th>
                                    <th>Product Code</th>
                                    <th>Reviews</th>
                                    <th>Ratings</th>
                                    <th>Status</th>
                                    <th>Created Date</th>
                                    <th>Actions</th>
                                </tr>
                                @foreach($data as $key => $review)
                                <tr>
                                    <td>{{ $key + 1 }}</td>
                                    <td>{{ $review->p_code }}</td>
                                    <td>{{ $review->reviews }}</td>
                                    <td>{{ $review->ratings }}</td>
                                    <td>
                                      <span class="badge badge-{{ $review->status == 1 ?  'success' : ($review->status == 2 ? 'warning' : 'danger') }}" id="span-{{ $review->id }}">
                                      {{ $review->status == 1 ?  'Active' : ($review->status == 2 ? 'Under Review' : 'Deleted') }}
                                      </span>
                                    </td>
                                    <td>{{ date('d M, Y',strtotime($review->created_at)) }}</td>
                                    <td>
                                        <label class="custom-switch mt-2">
                                          
                                          <input type="checkbox" name="custom-switch-checkbox" class="custom-switch-input requestDelete"
                                          data-id="{{$review->id}}" data-value="{{ $review->status == 2 ? 0 : 1 }}"
                                          onclick="" {{ $review->status == 2 ? 'checked' : '' }} >

                                          <span class="custom-switch-indicator"></span>
                                        </label>
                                    </td>
                                </tr>
                                @endforeach

                            </table>
                        </div>
                        @else
                        <h4>No Reviews yet!</h4>
                        @endif
                    </div>                    
                    <div class="card-footer text-right">
                        {{ $data->links() }}
                    </div>
                </div>
            </div>
          </div>
        </section>
      </div>
@include('admin.include.footer')
