@extends('user.app')
@section('main-content')
<div class="banner-part">
   <img src="{{ asset('user/images/inner-ban1.jpg') }}" alt="">    
    <div class="inner-ban-tx">
        <h2>{{$course->package_name}}</h2>
    </div>
</div>
<section class="single-page">
    <div class="container">
        <div class="row">
            <div class="col-md-5 main-pro">
                @php 
                $photos =array();
                if( !empty($course->product_image))
                {
                  $photos = unserialize( $course->product_image);
                  if(count($photos)>0)
                  {
                    
                    $img_path=url('/logo/'.$photos['product_image']); 
                    echo '<img src="'.$img_path.'" width="100px">';
                  }
                  
                }                             
                @endphp
            </div>
            <div class="col-md-7 pro-decp">
                <h2>{{$course->package_name}}</h2>
                {{-- <h3>CA Final New FR, SFM, Audit And Law Combo Course By AS Foundation In Google Drive</h3> --}}
                <p> 
                    @php if( $course->product_details) { @endphp
                        {{ strip_tags( html_entity_decode(stripslashes($course->product_details),ENT_QUOTES,"UTF-8") ) }}
                    @php } @endphp
                </p>
                <h5>Instructed by 

                      @php if( $course->faculty_name) { @endphp
                       
                            @foreach($educators as $educator)
                             @php if($course->faculty_name==$educator->id) { @endphp
                                     <a href="foundation.php"> {{$educator->coaching_classes  }} </a>
                             @php }  @endphp  
                            @endforeach
                       
                    @php } @endphp          
                    {{-- <i class="fas fa-users"></i> 1000 students enrolled --}}
                </h5>
                <div class="price">
                    <h2><del>{{ ($course->price) ? 'Rs.'.$course->price : ''  }}</del></span> {{ ($course->discounted_price) ? 'Rs.'.$course->discounted_price : ''  }}</h2>
                    @php
                     $pcartprice =0;
                     $pcartprice = ($course->discounted_price) ? $course->discounted_price : $course->price;
                    
                    @endphp

                    @if (Auth::check())
                          {!! Form::open(array('route' => 'cart.store', 'class' => 'form' ,'id' =>'createroomsform','files' => true)) !!}
                            {{ Form::hidden('product_id', $course->id) }}
                            {{ Form::hidden('user_id',Auth::user()->id ) }}
                            {{ Form::hidden('name', $course->package_name) }}
                            {{ Form::hidden('quantity', 1) }}
                            {{ Form::hidden('price', $pcartprice) }}

                           {!! Form::submit('Take This Course', 
                                  array('class'=>'add-acte')) !!}
                      {!! Form::close() !!}
                    @else
                        <a href="{{ url('login') }}" class="add-acte">Take This Course</a>
                    @endif

                     @if (Auth::check())
                          {!! Form::open(array('route' => 'wishlist.store', 'class' => 'form' ,'id' =>'createroomsform','files' => true)) !!}
                            {{ Form::hidden('product_id', $course->id) }}
                            {{ Form::hidden('user_id',Auth::user()->id ) }}
                            {{ Form::hidden('name', $course->package_name) }}
                            {{ Form::hidden('quantity', 1) }}
                            {{ Form::hidden('price', $pcartprice) }}

                           {!! Form::submit('Add to Wishlist', 
                                  array('class'=>'add-acte')) !!}
                      {!! Form::close() !!}
                    @else
                        <a href="{{ url('login') }}" class="add-acte">Add to Wishlist</a>
                    @endif
                </div>
            </div>
            <div class="col-md-12 cources_details_wrap">
                <div class="row">
                     <div class="col-md-6 Course-Details">
                       <h3>Course Details</h3>

                               <div class="clearfix"></div>
                        <table class="coursetable">

                            @php if( $course->degree) { @endphp
                                <tr>
                                    @foreach($degrees as $degree)
                                        @php if($course->degree==$degree->id) { @endphp
                                            <td><span>Degree : </span></td><td> {{$degree->name  }}</td>
                                        @php }  @endphp 
                                    @endforeach
                                </tr>
                                @php } @endphp
                                @php if( $course->level) { @endphp
                                    <tr>
                                        @foreach($levels as $level)
                                            @php if($course->level==$level->id) { @endphp
                                                <td><span>Level : </span></td><td> {{$level->name  }}</td>
                                            @php }  @endphp 
                                        @endforeach
                                    </tr>
                                @php } @endphp
                                @php if( $course->subject) { @endphp
                                    <tr>
                                        @foreach($subjects as $subject)
                                            @php if($course->subject==$subject->id) { @endphp
                                                <td><span>Subject : </span></td><td> {{$subject->name  }}</td>
                                            @php }  @endphp 
                                        @endforeach
                                    </tr>
                                @php } @endphp
                                @php if( $course->recording) { @endphp
                                    <tr>
                                       <td><span>Recording : </span></td><td> {{$course->recording  }}</td>
                                    </tr>
                                @php } @endphp

                                @php if( $course->syllabus) { @endphp
                                    <tr>
                                       <td><span>Syllabus : </span></td><td> {{$course->syllabus  }}</td>
                                    </tr>
                                @php } @endphp

                                @php if( $course->format) { @endphp
                                    <tr>
                                       <td><span>Format : </span></td><td> {{$course->format  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->material_by) { @endphp
                                    <tr>
                                       <td><span>Material by : </span></td><td> {{$course->material_by  }}</td>
                                    </tr>
                                @php } @endphp


                                 @php if( $course->hard_copy) { @endphp
                                    <tr>
                                       <td><span>Hard Copy : </span></td><td> {{$course->hard_copy  }}</td>
                                    </tr>
                                @php } @endphp

                                @php if( $course->applicable_for_attempt) { @endphp
                                    <tr>
                                       <td><span>Applicable for attempt : </span></td><td> {{$course->applicable_for_attempt  }}</td>
                                    </tr>
                                @php } @endphp
                              {{--   @php if( $course->faculty_name) { @endphp
                                    <tr>
                                        @foreach($educators as $educator)
                                         @php if($course->faculty_name==$educator->id) { @endphp
                                                <td><span>Faculty : </span></td><td> {{$educator->coaching_classes  }}</td>
                                            @php }  @endphp  
                                        @endforeach
                                    </tr>
                                @php } @endphp --}}
                                @php if( $course->lectures_no) { @endphp
                                    <tr>
                                       <td><span>Lectures_no : </span></td><td> {{$course->lectures_no  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->hours_no) { @endphp
                                    <tr>
                                       <td><span>Hours  : </span></td><td> {{$course->hours_no  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->video_language) { @endphp
                                    <tr>
                                       <td><span>Video Language : </span></td><td> {{$course->video_language  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->lectures_view) { @endphp
                                    <tr>
                                       <td><span>Lectures view  : </span></td><td> {{$course->lectures_view  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->fast_forward) { @endphp
                                    <tr>
                                       <td><span>Fast Forward : </span></td><td> {{$course->fast_forward  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->fast_forward_details) { @endphp
                                    <tr>
                                       <td><span>Fast Forward Details  : </span></td><td> {{$course->fast_forward_details  }}</td>
                                    </tr>
                                @php } @endphp

                                @php if( $course->expire_validity) { @endphp
                                    <tr>
                                       <td><span>Expire Validity : </span></td><td> {{$course->expire_validity  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->topics_covered) { @endphp
                                    <tr>
                                       <td><span>Topics Covered  : </span></td><td> {{$course->topics_covered  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->doubt_clearing_availability) { @endphp
                                    <tr>
                                       <td><span>Doubt Clearing Availability : </span></td><td> {{$course->doubt_clearing_availability  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->amendmend) { @endphp
                                    <tr>
                                       <td><span>Amendments  : </span></td><td> {{$course->amendmend  }}</td>
                                    </tr>
                                @php } @endphp

                                @php if( $course->video_run_on) { @endphp
                                    <tr>
                                       <td><span>Video run on : </span></td><td> {{$course->video_run_on  }}</td>
                                    </tr>
                                @php } @endphp
                              {{--   @php if( $course->mention_details) { @endphp
                                    <tr>
                                       <td><span>Mention details  : </span></td><td>  {{ strip_tags( html_entity_decode(stripslashes($course->mention_details),ENT_QUOTES,"UTF-8") ) }}</td>
                                    </tr>
                                @php } @endphp --}}
                                @php if( $course->charts_details) { @endphp
                                    <tr>
                                       <td><span>Charts details : </span></td><td> {{ strip_tags( html_entity_decode(stripslashes($course->charts_details),ENT_QUOTES,"UTF-8") ) }} </td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->dispatch) { @endphp
                                    <tr>
                                       <td><span>Dispatch  : </span></td><td> {{$course->dispatch  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->dispatch_schedule) { @endphp
                                    <tr>
                                       <td><span>Dispatch Schedule : </span></td><td>
                                         {{ strip_tags( html_entity_decode(stripslashes($course->dispatch_schedule),ENT_QUOTES,"UTF-8") ) }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->lectures_link) { @endphp
                                    <tr>
                                       <td><span>Lectures link  : </span></td><td> {{$course->lectures_link  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->books_images_link) { @endphp
                                    <tr>
                                       <td><span>Books images link : </span></td><td> {{$course->books_images_link  }}</td>
                                    </tr>
                                @php } @endphp
                                @php if( $course->other_details) { @endphp
                                    <tr>
                                       <td><span>Other details  : </span></td><td>   {{ strip_tags( html_entity_decode(stripslashes($course->other_details),ENT_QUOTES,"UTF-8") ) }}</td>
                                    </tr>
                                @php } @endphp
                               
                            </table>
                              
                               @php if( $course->lectures_link) { @endphp
                                <h3>Related Courses</h3>
                                  <iframe width="100%" height="315"
                                  src="https://www.youtube.com/embed/{{$course->lectures_link }}">
                                  </iframe>
                             
                                @php } @endphp
                        </div>
                         <div class="col-md-6 Course-Details">
                              <h3>Related Courses</h3>

                               <div class="clearfix"></div>
                                @if(isset($relatedcources))

                                        @foreach($relatedcources as $value)
                                        @php 
                                            if($course->id == $value->id ) continue; 
                                        @endphp
                                <div class="relcourse">
                                  <div class="col-md-4">
                                    @php 

                                      $photos =array();

                                      if( !empty($value->product_image))
                                      {
                                          $photos = unserialize( $value->product_image);

                                          if(count($photos)>0)

                                          {

                                              $img_path=url('/logo/'.$photos['product_image']); 
                                              echo '<img class="card-img-top"  src="'.$img_path.'">';

                                          }
                                      }                             

                                      @endphp



                                  </div> 
                                  <div class="col-md-8">
                                    <div class="card-body">

                                         <h3>{{ substr($value->package_name,0,38) }}..</h3>

                                         {{-- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eligendi, nisi ratione illo. </p> --}}

                                         <h4 class="cross-t">

                                             <del> Rs.{{ $value->price }}</del>
                                             Rs.{{ $value->discounted_price }}
                                         </h4>
                                         
                                          <a href="{{url('/')}}/enrol/{{ $value->slug }}">add to cart</a>
                                      </div>  

                                      

                                  </div>
                                </div>
                                   @endforeach

                                    @endif




                           
                         </div>
                    </div>
                </div>
            </div>
    </div>
</section>
<div class="clearfix"></div>

@endsection