@extends('admin.layout.master')

@section('content')

<div class="app-content my-3 my-md-5">
  <div class="side-app">
    <div class="page-header">
      	<ol class="breadcrumb">
        	<li class="breadcrumb-item active" aria-current="page">
          		Coaching Listing
        	</li>
      	</ol>
    </div>
    <!-- MAIN BODY CONTENT -->
    <div class="top-header">
     	<h1>Coaching Listing</h1>
     	<div class="filter-group">
       		<p class="fs-15 font-medium">Display Method:</p>
       		<label class="switch-light" onclick="">
            	<input type="checkbox">
            	<span class="alert alert-light">
                <span class="on">Manual</span>
              	<span class="off">Auto</span>
              	<a class="btn btn-primary"></a></span>
          	</label>
        	<a href="{{route('admin.coaching_listing_publish')}}" class="btn btn-primary btn-streach-md fs-10" onclick="return publishconfirm(event)">Publish</a>
     	</div>
    </div>
    
    <div class="card">
      	<div class="card-header pt-5">
        	<h2>Trending</h2>
        	<div class="filter-group">
          		<a href="#" class="btn btn-primary add-btn add-btn-sm add_new_coaching"><i class="fa fa-plus-circle"></i>Add New Coaching</a>
          	<select name="exam_type" id="exam_type" class="form-control input-sm exam_type">
            	<option value="">Exam Type</option>
              @if(count($examType) > 0)
              @foreach($examType as $val)
                <option value="{{$val->id}}">{{$val->exam_type}}</option>
              @endforeach
              @endif
          	</select>
          	<select name="exam_name" id="exam_name" class="form-control input-sm exam_name">
            	<option value="">Exam Name</option>
          	</select>
            <label><strong>Tag:</strong></label>
            <!-- tag -->
              <div class="dropdown trending">
                <button class="btn btn-custom-toggle dropdown-toggle btn-block select_tag" type="button" id="dropdownMenuButton"
                  data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  Select Tag
                </button>
                <div class="dropdown-menu custom-dropdown-menu" aria-labelledby="dropdownMenuButton"
                  x-placement="bottom-start">
                  <div class="trand-cotent">
                    <ul class="tags_list">
                      <li>
                        <p id="tag_id" data-id="">Select Tag</p>
                      </li>
                      <li>
                        <a href="#" class="newTag add_tag_coaching">Add new Tag</a>
                      </li>
                    </ul>
                  </div>

                </div>
              </div>
            <!-- /tag -->
          </div>
    </div>
    <div class="card-body">
        <p class="text-right mb-1 fs-10 font-bold tpa">Total Product Available: {{count($coachingList)}}</p>
        <div class="table-responsive">
          <table class="table custom-bg-table card-table table-vcenter text-nowrap no-footer list-items examFaqUl" id="sorting_table">
          <!-- <table class="stripe row-border order-column dataTable no-footer"> -->
            <thead>
              	<tr>
                	<th>S.No</th>
                	<th>Coaching Name</th>
                	<th>Location  (City &amp; State)</th>
                	<th>Exam Type</th>
                	<th>T. Test  Packages</th>
                	<th>T. Practice Sets</th>
                	<th>T. Quizzes</th>
                	<th>Total Attempt</th>
                	<th>Total Time Spent</th>
                	<th>Sales</th>

                	<th>Action</th>
              	</tr>
            </thead>

            <div class="">
              <tbody class="sortable1" id="contents">
                @if(!$coachingList->isEmpty())
                @foreach($coachingList as $key => $value)
                <tr data-id="{{$value->cmlid}}" id="item-{{$value->cmlid}}">
                  <td class="fixed">{{$key+1}}</td>
                  <td>{{$value['coaching_name']}}</td>
                  <td>{{$value['city']}}, {{$value['name']}}</td>
                  <td>{{$value['exam_type']}}</td>
                  <td>{{$value['total_testseries']}}</td>
                  <td>{{$value['total_practice']}}</td>
                  <td>{{$value['total_quiz']}}</td>
                  <td>{{$value['total_attempts']}}</td>
                  <td>{{$value['total_time_spent']}}</td>
                  <td>
                    <i class="fa fa-rupee"></i> {{$value['life_time_sales']}} <br/>
                    <a href="javascript:void(0)" class="fs-10 text-underline text-warning graph_view" data-id="{{base64_encode($value->coaching_id)}}">View</a>
                  </td>
                  <td>
                    <a class="action-btn" href="{{route('admin.coaching.details', base64_encode($value->coaching_id))}}" target="_blank"><img src="{{asset('admin/images/view-eye.svg')}}" alt=""/></a>
                    <a class="action-btn" href="{{route('admin.coaching_list_delete', base64_encode($value->cmlid))}}" onclick="return deleteconfirm(event)"><img src="{{asset('admin/images/bin.svg')}}" alt=""/></a>
                  </td>
                </tr>
                @endforeach
                @endif
              </tbody>
            </div>

          </table>
          @if($coachingCount > 2)
          <input type="hidden" name="view_more_count" id="view_more_count" value="{{count($coachingList)}}">
          <a href="#" class="view_more" style="text-align: center; color: blue;">View More</a>
          @endif
        </div> 
        <button type="button" class="btn btn-primary btn-streach mt-5 font-book fs-13 sortable_order">Save</button>              
      </div>
    </div>
    <!--// MAIN BODY CONTENT -->
  </div>
</div>
@endsection
@section('scripts')
<script type="text/javascript" src="{{asset('js/manage_coaching_listing.js?v='.time())}}"></script>
<script type="text/javascript">
	@if(Session::has('error'))
	  alertify.error("{{ Session::get('error') }}");
	@endif
</script>
<!-- ECharts Plugin -->
<script src="{{asset('admin/plugins/echart/echarts.js')}}"></script> 
<script>
      $(document).ready(function () {
        $('#sortable1').sortable();
        $('#sortable1').disableSelection();
        // ECharts modal open
      });
</script>
@endsection
