@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" aria-current="page"><a href="javascript:void()">Package Management</a></li>
        <li class="breadcrumb-item" aria-current="page"><a href="{{route('admin.test_series_manager.list')}}">Test Series Manager</a></li>
				<li class="breadcrumb-item active" aria-current="page">Test Series View</li>
			</ol>
		</div>
    <!-- {{$id}} -->
      <h1>
      @if($details->status==2)
        Publish Now
      @elseif($details->status==3)
        View Details
      @elseif($details->status==4)
        Check Reason
      @elseif($details->status==6)
        Expired
      @endif
      </h1>
      <!-- Table -->
      <div class="card">
        <div class="card-header pt-5">
          <h2>Package Details</h2>
          <div class="filter-group">
            @if($details->status != 3 && $details->status < 5)
            <a href="{{route('admin.test_series_manager.edit', base64_encode($details->id))}}"><button class="btn edit-btn fs-14"><i class="fa fa-pencil"></i> Edit</button></a>
            @endif
          </div>
        </div>
        <div class="card-body pt-3">
          <div class="details-box mb-7">
            <div class="row">
              <div class="col-lg-6">
                <ul class="details-list">
                  <li>
                    <label>Package Name</label>
                    <span>{{$details->package_name}}</span>
                  </li>

                  <li>
                    <label>Internal Coaching</label>
                    <span>{{$details->internalCoaching['coaching_name']}}</span>
                  </li>

                  <li>
                    <label>Exam Type</label>
                    <span>
                      @if($testTypeName->exam_type)
                        {{$testTypeName->exam_type}}
                      @else
                        {{'N/A'}}
                      @endif
                    </span>
                  </li>

                  <li>
                    <label>Test Type</label>
                    <span>
                      @if($testTypeName->test_type_name)
                        {{$testTypeName->test_type_name}}
                      @else
                        {{'N/A'}}
                      @endif
                    </span>
                  </li>

                  <li>
                    <label>Package Validity</label>
                    <span>
                      @if($details->validity > 1)
                          {{$details->validity}} Days
                      @else
                          {{$details->validity}} Day
                      @endif
                    </span>
                  </li>

                  <li>
                    <label>Languages</label>
                    <span> 
                        @if(isset($details->PackageLanguage))
                        @foreach($details->PackageLanguage as $val)
                          @if($val->language_id == 1)
                                {{'English, '}} 
                              @else
                                {{'Hindi, '}}
                              @endif 
                        @endforeach
                        @endif
                    </span>
                  </li> 
                
                </ul>
              </div>
              <div class="col-lg-3">
                <label for="" class="form-label"></label>
                <div class="package-image">
                  <div class="img-wrapper">
                    @if($details->package_image)
                      <img src="{{asset('storage/test_package_image/').'/'.$details->package_image}}" alt="" />
                    @else
                      <img src="{{asset('admin/images/no-picture.png')}}" alt="" />
                    @endif
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- Seo Details -->
          <h2>Test Details</h2>
          <p class="text-right font-bold tn">Total No. Of Test(s): 0</p>
          
          <table id="test-package-view" class="stripe row-border order-column">
            <thead>
              <tr>
                <th>Test Name<span><i class="fa fa-angle-up"></i><i class="fa fa-angle-down"></i></span></th>
                <th>Test Type<span><i class="fa fa-angle-up"></i><i class="fa fa-angle-down"></i></span></th>
                <th>Subject Name<span><i class="fa fa-angle-up"></i><i class="fa fa-angle-down"></i></span></th>
                <th>Difficulty Level<span><i class="fa fa-angle-up"></i><i class="fa fa-angle-down"></i></span></th>
                <th>Total Number Of Questions<span><i class="fa fa-angle-up"></i><i class="fa fa-angle-down"></i></span></th>
                <th>Marks<span><i class="fa fa-angle-up"></i><i class="fa fa-angle-down"></i></span></th>
                <th>Durations<span><i class="fa fa-angle-up"></i><i class="fa fa-angle-down"></i></span></th>
              </tr>
            </thead>
          </table>
          <br><br>
          <!-- <h5 style="text-align: center;">lorem imsum</h5> -->
          <h2>Test Type Details</h2>
          <table class="table card-table table-border-top table-center text-nowrap outline-border details-box mb-5">
            <thead>
              <tr class="bg-light">
                <th>Test type</th>
                <th>Total No Of Test</th>
                <th>Total No Of Test Subject Wise</th>
                <th>Difficulty Level</th>
              </tr>
            </thead>
            <tbody id="test_type">
              @if(!$allTestType->isEmpty())
              @foreach($allTestType as $val)
              <tr>
                <td>
                  @if($val->test_type_name == '')
                    N/A
                  @else
                    {{$val->test_type_name}}
                  @endif
                </td>
                <td>{{$val->questionsCount}}</td>
                <td>
                  @if($val->subject)
                  @foreach($val->subject as $v)
                    <p>{{$v->subject}} : {{$v->no_of_questions}}</p>
                  @endforeach
                  @else
                    N/A
                  @endif
                </td>
                <td>
                  <p>Easy : {{$val->easy}}</p>
                  <p>Medium : {{$val->med}}</p>
                  <p>Hard : {{$val->hard}}</p>
                </td>
              </tr> 
              @endforeach
              @else
              <tr>
                <td colspan="4">No Test Type Available</td>
              </tr>
              @endif                       
            </tbody>
          </table>
          @if($count > 1)
          <input type="hidden" name="count_view" id="count_view" value="{{count($allTestType)}}">
          <a href="#" class="btn btn-outline-primary btn-pill btn-streach d-flex view_type_more">View More</a>
          @endif
          <br><br>
          <h2>Price Details</h2>

          <div class="details-box mb-5">
            <div class="row">
              <div class="col-md-6 col-lg-6">
                <label for="examName" class="form-label">Product Price<span class="text-danger"></span>
                  <img src="{{asset('admin/images/info.svg')}}" class="fa fa-info" data-toggle="tooltip" data-placement="right" title="Total Price of the selected package"
                  alt="info"/>
                  <span class="text-right"><i class="fa fa-rupee"></i> 
                  @if($testTypeName['product_price'] == '' || $testTypeName['product_price'] == 0 || $testTypeName['product_price'] == NULL)
                    0
                  @else
                    {{$testTypeName['product_price']}}
                  @endif
                  </span>
                </label>
                @if($testTypeName['sale_type'] == 1 || $testTypeName['sale_type'] == 2)
                <label for="examName" class="form-label  mt-6">Discounted Price<span class="text-danger"></span>
                  <img src="{{asset('admin/images/info.svg')}}" class="fa fa-info" data-toggle="tooltip" data-placement="right" title="Decreased price visible to Students"
                  alt="info"/>
                  <span class="text-right"><i class="fa fa-rupee"></i> 
                    @if($testTypeName['discount_price'] == '' || $testTypeName['discount_price'] == 0 || $testTypeName['discount_price'] == NULL)
                      0
                    @else
                      {{$testTypeName['discount_price']}}
                    @endif
                  </span>
                </label>
                @endif

                @if($testTypeName['sale_type'] == 2)
                <label for="examName" class="form-label mt-6">Share &amp; Unlock Discounted Price<span class="text-danger"></span>
                  <img src="{{asset('admin/images/info.svg')}}" class="fa fa-info"
                    data-toggle="tooltip" data-placement="right" title="Total Discounted Price after Student shares package with specific number of people."
                    alt="info"/>
                    <span class="text-right"><i class="fa fa-rupee"></i> 
                      @if($testTypeName['share_unlock_discount_price'] == '' || $testTypeName['share_unlock_discount_price'] == 0 || $testTypeName['share_unlock_discount_price'] == NULL)
                        0
                      @else
                        {{$testTypeName['share_unlock_discount_price']}}
                      @endif
                    </span>
                </label>
                @endif
              </div>

              <div class="col-md-6 col-lg-6">
                <div class="more-options">
                  <label for="" class="form-label"
                    >More Options</label
                  >
                  <ul>
                    @if(!$saleTypes->isEmpty())
                    @foreach($saleTypes as $sale)
                    <li>
                      <label class="custom-control custom-radio">
                        <input type="radio" class="custom-control-input sale_type" name="example_radios" value="{{$sale->id}}" disabled id="{{$sale->id}}"  @if($sale->id == $testTypeName['sale_type']) checked @endif/>
                        <span class="custom-control-label">
                          {{$sale->sale_name}}
                          <img src="{{asset('admin/images/info.svg')}}" class="fa fa-info"
                            data-toggle="tooltip" data-placement="right" title="{{$sale->tooltip}}" alt="info" width="12"/></span>
                      </label>
                    </li>
                    @endforeach
                    @endif
                    
                  </ul>
                </div>
              </div>
            </div>
          </div>

          @if($details->status==3 || $details->status==4 || $details->status==6)
          <br><br>
            <h2>Package Status</h2>
            <div class="details-box mb-5">

              <h3 style="text-decoration: underline;">Information</h3>

              <ul class="details-list-desc">
                <li>
                  <label for="">Current Status Of Package</label> 
                  <span>
                  @if($details['status'] == 3)
                    In Review
                  @elseif($details['status'] == 4)
                    Decline
                  @elseif($details['status'] == 6)
                    Expired
                  @endif
                  </span>
                </li>
                <li>
                  <label for="">Submitted Date And Time</label>
                  <span>
                    @if($details['created_date'] != NULL)
                      {{date('d-m-Y', strtotime($details['created_date']))}} / {{$details['created_time']}}
                    @else
                     N/A
                    @endif
                  </span>
                </li>
                <li>
                  <label for="">Submitted By</label>
                  <span>{{Auth::guard('admin')->user()->username}}</span>
                </li>
                @if($details['status'] == 4)
                  <li>
                    <label for="">Reason</label>
                    <span>{{$details['reject_reason']}}</span>
                  </li>
                @elseif($details['status'] == 6)
                  <li>
                    <label for="">Comments</label>
                    <span>{{$details['reject_reason']}}</span>
                  </li>
                @endif

              </ul>
              <br><br>
              <strong><h5>Contact Details</h5></strong>
              <ul class="details-list-desc">
                <li>
                  <label for="">Helpline Number</label> <span>9830000000</span>
                </li>
                <li>
                  <label for="">Email Id</label>
                  <span>support@admisure.com</span>
                  <!-- <span>{{Auth::guard('admin')->user()->email}}</span> -->
                </li>
              </ul>
            </div>
          @endif
          


          @if($details->status==2)
          <label class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" name="checkbox1" value="1"/>
            <span class="custom-control-label">I declare that most or all of the content for this package has been produced by us and I have properly acquired all of the rights necessary to publish all content for this package on Admisure.</span>
          </label>
          <label class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" name="checkbox" value="1"/>
            <span class="custom-control-label">I am a person or a company publishing this package through either partnership, employment or contract with the creator of most or all of the content and I have properly acquired all of the necessary rights to publish all content for this package on Admisure. I agree to abide by the Terms and Conditions and Privacy Policy put forward by Admisure Educational Services Pvt Ltd.</span>
          </label>
          <label class="mt-5">
            <span class="">Please be aware, we do not give permission to persons or companies with private label, rights to resell package that they purchased from a package owner on Admisure.</span>
          </label>
          @endif
          <div class="test-footer">
            <a href="{{route('admin.test_series_manager.list')}}"><button class="btn btn-outline-primary btn-pill btn-streach font-book  mt-6 fs-14"> Back </button></a>
              @if($details->status==2)
                <button class="btn btn-primary btn-streach font-book mt-6 fs-14 ml-3 finalsubmitBtn" data-id="{{base64_encode($details->id)}}">Submit For Review</button>
              @endif
          </div>
          <!--// Price Details -->
        </div>
      <!--// MAIN BODY CONTENT -->
  </div>
</div>
@endsection
@section('scripts')
<script type="text/javascript">
  var view_id = "{{$id}}";
  // alert(view_id);
</script>
<script type="text/javascript" src="{{asset('js/test_package_manager.js')}}"></script>
<script type="text/javascript" src="{{asset('js/test_package_view.js')}}"></script>
@endsection