<?php error_reporting(0);?>

<div class="edu-breadcrumb-area breadcrumb-style-3">
    <div class="container">
        <div class="breadcrumb-inner">
            <ul class="edu-breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo base_url(); ?>">Home</a></li>
                <li class="separator"><i class="icon-angle-right"></i></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url(); ?>course-category/<?php echo $course->category_slug; ?>"><?php echo $course->category_name; ?></a></li>
                <li class="separator"><i class="icon-angle-right"></i></li>
                <li class="breadcrumb-item active" aria-current="page"><?php echo mb_strimwidth($course->title, 0, 50, "...") ?></li>
            </ul>
            <div class="page-title">
                <h3 class="title"><?php echo $course->title; ?></h3>
            </div>
            <ul class="course-meta">
                <li><i class="icon-58"></i>1500+ Enrolled</li>
                <li><i class="icon-59"></i><?php echo ucwords($course->level); ?></li>
                <li class="course-rating">
                    <div class="rating">
                        <i class="icon-23"></i>
                        <i class="icon-23"></i>
                        <i class="icon-23"></i>
                        <i class="icon-23"></i>
                        <i class="icon-23"></i>
                    </div>
                    <span class="rating-count">(720 Rating)</span>
                </li>
            </ul>
            <div class="row">
                <div class="col-md-6">
                    <p><?php echo $course->short_description ?></p>
                </div>
            </div>
            
        </div>
    </div>
    <ul class="shape-group">
        <li class="shape-1">
            <span></span>
        </li>
        <li class="shape-2 scene"><img data-depth="2" src="<?php echo front_css(); ?>images/about/shape-13.png" alt="shape"></li>
        <li class="shape-3 scene"><img data-depth="-2" src="<?php echo front_css(); ?>images/about/shape-15.png" alt="shape"></li>
        <li class="shape-4">
            <span></span>
        </li>
        <li class="shape-5 scene"><img data-depth="2" src="<?php echo front_css(); ?>images/about/shape-07.png" alt="shape"></li>
    </ul>
</div>

<!--=====================================-->
<!--=     Courses Details Area Start    =-->
<!--=====================================-->
<section class="edu-section-gap course-details-area">
    <div class="container">
        <div class="row row--30">
            <div class="col-lg-8">
                <div class="course-details-content">
                    <ul class="nav nav-tabs" id="myTab" role="tablist">
                        <li class="nav-item" role="presentation">
                            <button class="nav-link active" id="overview-tab" data-bs-toggle="tab" data-bs-target="#overview" type="button" role="tab" aria-controls="overview" aria-selected="true">Overview</button>
                        </li>
                        <li class="nav-item" role="presentation">
                            <button class="nav-link" id="carriculam-tab" data-bs-toggle="tab" data-bs-target="#carriculam" type="button" role="tab" aria-controls="carriculam" aria-selected="false">Curriculum</button>
                        </li>
                        <?php if($course->certification): ?>
                            <li class="nav-item" role="presentation">
                                <button class="nav-link" id="carriculam-tab" data-bs-toggle="tab" data-bs-target="#certification" type="button" role="tab" aria-controls="certification" aria-selected="false">Certification</button>
                            </li>
                        <?php endif;
                        if($course->assignments):?>
                            <li class="nav-item" role="presentation">
                                <button class="nav-link" id="carriculam-tab" data-bs-toggle="tab" data-bs-target="#assignments" type="button" role="tab" aria-controls="assignments" aria-selected="false">Assignments</button>
                            </li>
                        <?php endif;
                        if($course->project):?>
                            <li class="nav-item" role="presentation">
                                <button class="nav-link" id="carriculam-tab" data-bs-toggle="tab" data-bs-target="#practical" type="button" role="tab" aria-controls="practical" aria-selected="false">Practical</button>
                            </li>
                        <?php endif; ?>
                        <!-- <li class="nav-item" role="presentation">
                            <button class="nav-link" id="instructor-tab" data-bs-toggle="tab" data-bs-target="#instructor" type="button" role="tab" aria-controls="instructor" aria-selected="false">Instructor</button>
                        </li>

                        <li class="nav-item" role="presentation">
                            <button class="nav-link" id="review-tab" data-bs-toggle="tab" data-bs-target="#review" type="button" role="tab" aria-controls="review" aria-selected="false">Reviews</button>
                        </li> -->
                    </ul>

                    <div class="tab-content" id="myTabContent">
                        <div class="tab-pane fade show active" id="overview" role="tabpanel" aria-labelledby="overview-tab">
                            <div class="course-tab-content">
                                <div class="course-overview">
                                    <h3 class="heading-title">Course Description</h3>
                                    <?php echo $course->description ?>
                                    <h5 class="title mb--10">What You’ll Learn?</h5>
                                    <ul class="mb--20">
                                        <?php
                                           foreach (json_decode($course->outcomes) as $outcomes) {
                                        ?>
                                            <li><?php echo $outcomes; ?></li>
                                        <?php }; ?>
                                    </ul>
                                    <h5 class="title mb--10">Requirements</h5>
                                    <ul class="mb-2">
                                        <?php
                                           foreach (json_decode($course->requirements) as $requirements) {
                                        ?>
                                            <li><?php echo $requirements; ?></li>
                                        <?php }; ?>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="carriculam" role="tabpanel" aria-labelledby="carriculam-tab">
                            <?php 
                            $all_lession = $this->course_model->get_all_lession_by_course($course->id);
                            ?>
                            <div class="course-tab-content course-details-3">
                                <div class="course-curriculam">
                                    <h3 class="heading-title">Course Curriculum</h3>
                                    <div class="accordion edu-accordion" id="accordionExample">
                                        <h4 class="heading-title">Introduction</h4>
                                        <?php
                                        $lession_d = 0;
                                        foreach ($all_lession as $key => $lession) {
                                            $lession_d += count(json_decode($lession->content));
                                        }
                                        $a = 1;
                                        foreach ($all_lession as $key => $lession) : ?>
                                            <div class="accordion-item">
                                                <h3 class="accordion-header" id="heading_<?php echo $a; ?>">
                                                    <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapse_<?php echo $a; ?>" aria-expanded="true" aria-controls="collapse_<?php echo $a; ?>">
                                                        Module <?php echo $a; ?>. <?php echo $lession->l_title; ?> 
                                                        <span class="expand">Expand</span>
                                                    </button>
                                                </h3>
                                                <div id="collapse_<?php echo $a; ?>" class="accordion-collapse collapse" aria-labelledby="heading_<?php echo $a; ?>" data-bs-parent="#accordionExample">
                                                    <?php 
                                                    $lesst = 0;
                                                    $lessio_co = [];
                                                    for ($g = 0; $g < count(json_decode($lession->content)); $g++) :
                                                        $lessio_co[] = json_decode($lession->content)[$g]; 
                                                        $lesst = count($lessio_co);
                                                    endfor; ?>
                                                    <?php $ass_pdf = $this->course_model->get_ass_pdf_by_c_id_and_lession_id_for_c_details_page($lession->course, $lession->l_id); ?>
                                                    <?php $mini_pdf = $this->course_model->get_mini_pdf_by_c_id_and_lession_id_for_c_details_page($lession->course, $lession->l_id); ?>
                                                    <div class="accordion-body">
                                                        <div class="course-lesson">
                                                            <div class="reading-status">
                                                                <h5 class="title"><i class="icon-65"></i> <?php echo $lession->l_description; ?></h5>
                                                                <span class="complete-text">
                                                                    <span><i class="fa fa-paperclip"></i> <?php echo $ass_pdf; ?> Assignment</span>
                                                                    <span><i class="fa fa-file"></i> <?php echo $mini_pdf; ?> Practical</span>
                                                                    <span><i class="fa fa-book"></i> <?php echo $lesst; ?> Lession</span>
                                                                </span>
                                                            </div>
                                                            <ul>
                                                                <?php
                                                                foreach ($lessio_co as $keyy => $value):?>
                                                                    <li><?php echo $value; ?></li>
                                                                <?php endforeach; ?>
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        <?php $a++; endforeach; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="certification" role="tabpanel" aria-labelledby="instructor-tab">
                            <div class="course-tab-content">
                                <div class="course-curriculam">
                                    <?php echo $course->certification; ?>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="assignments" role="tabpanel" aria-labelledby="instructor-tab">
                            <div class="course-tab-content">
                                <div class="course-curriculam">
                                    <?php echo $course->assignments; ?>    
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="practical" role="tabpanel" aria-labelledby="instructor-tab">
                            <div class="course-tab-content">
                                <div class="course-curriculam">
                                    <?php echo $course->project; ?>   
                                </div>
                            </div>
                        </div>

                        <!-- <div class="tab-pane fade" id="instructor" role="tabpanel" aria-labelledby="instructor-tab">
                            <div class="course-tab-content">
                                <div class="course-instructor">
                                    <div class="thumbnail">
                                        <img src="<?php //echo front_css(); ?>images/course/author-01.png" alt="Author Images">
                                    </div>
                                    <div class="author-content">
                                        <h6 class="title">Edward Norton</h6>
                                        <span class="subtitle">Founder & CEO</span>
                                        <p>Consectetur adipisicing elit, sed do eiusmod tempor incididunt labore et dolore magna aliqua enim minim veniam quis nostrud exercitation ulla mco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate.</p>
                                        <ul class="social-share">
                                            <li><a href="#"><i class="icon-facebook"></i></a></li>
                                            <li><a href="#"><i class="icon-twitter"></i></a></li>
                                            <li><a href="#"><i class="icon-linkedin2"></i></a></li>
                                            <li><a href="#"><i class="icon-youtube"></i></a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="review" role="tabpanel" aria-labelledby="review-tab">
                            <div class="course-tab-content">
                                <div class="course-review">
                                    <h3 class="heading-title">Course Rating</h3>
                                    <p>5.00 average rating based on 7 rating</p>
                                    <div class="row g-0 align-items-center">
                                        <div class="col-sm-4">
                                            <div class="rating-box">
                                                <div class="rating-number">5.0</div>
                                                <div class="rating">
                                                    <i class="icon-23"></i>
                                                    <i class="icon-23"></i>
                                                    <i class="icon-23"></i>
                                                    <i class="icon-23"></i>
                                                    <i class="icon-23"></i>
                                                </div>
                                                <span>(7 Review)</span>
                                            </div>
                                        </div>
                                        <div class="col-sm-8">
                                            <div class="review-wrapper">

                                                <div class="single-progress-bar">
                                                    <div class="rating-text">
                                                        5 <i class="icon-23"></i>
                                                    </div>
                                                    <div class="progress">
                                                        <div class="progress-bar" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
                                                    </div>
                                                    <span class="rating-value">7</span>
                                                </div>

                                                <div class="single-progress-bar">
                                                    <div class="rating-text">
                                                        4 <i class="icon-23"></i>
                                                    </div>
                                                    <div class="progress">
                                                        <div class="progress-bar" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
                                                    </div>
                                                    <span class="rating-value">0</span>
                                                </div>

                                                <div class="single-progress-bar">
                                                    <div class="rating-text">
                                                        4 <i class="icon-23"></i>
                                                    </div>
                                                    <div class="progress">
                                                        <div class="progress-bar" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
                                                    </div>
                                                    <span class="rating-value">0</span>
                                                </div>

                                                <div class="single-progress-bar">
                                                    <div class="rating-text">
                                                        4 <i class="icon-23"></i>
                                                    </div>
                                                    <div class="progress">
                                                        <div class="progress-bar" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
                                                    </div>
                                                    <span class="rating-value">0</span>
                                                </div>

                                                <div class="single-progress-bar">
                                                    <div class="rating-text">
                                                        4 <i class="icon-23"></i>
                                                    </div>
                                                    <div class="progress">
                                                        <div class="progress-bar" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
                                                    </div>
                                                    <span class="rating-value">0</span>
                                                </div>

                                            </div>
                                        </div>
                                    </div>

                                    <div class="comment-area">
                                        <h3 class="heading-title">Reviews</h3>
                                        <div class="comment-list-wrapper">
                     
                                            <div class="comment">
                                                <div class="thumbnail">
                                                    <img src="<?php //echo front_css(); ?>images/blog/comment-01.jpg" alt="Comment Images">
                                                </div>
                                                <div class="comment-content">
                                                    <div class="rating">
                                                        <i class="icon-23"></i>
                                                        <i class="icon-23"></i>
                                                        <i class="icon-23"></i>
                                                        <i class="icon-23"></i>
                                                        <i class="icon-23"></i>
                                                    </div>
                                                    <h5 class="title">Haley Bennet</h5>
                                                    <span class="date">Oct 10, 2021</span>
                                                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div> -->
                    </div>
                </div>
            </div>
            <div class="col-lg-4">
                <div class="course-sidebar-3 sidebar-top-position">
                    <div class="edu-course-widget widget-course-summery">
                        <div class="inner">
                            <?php
                            if ($course->video_url) {
                                 $link = $course->video_url;
                                 $video_id = explode("?v=", $link);
                                 $video_id = $video_id[1];
                                 $thumbnail = "http://img.youtube.com/vi/" . $video_id . "/maxresdefault.jpg";
                            ?>
                            <div class="thumbnail">
                                <img src="<?php echo $thumbnail; ?>" alt="<?php echo $course->title ?>">
                                <a href="https://www.youtube.com/watch?v=PICj5tr9hcc" class="play-btn video-popup-activation"><i class="icon-18"></i></a>
                            </div>
                            <?php } else { ?>
                            <div class="thumbnail">
                                <img src="<?php echo base_url(); ?><?php echo $course->image ?>" alt="<?php echo $course->title ?>">
                            </div>
                            <?php } ?>
                            <div class="course-details-content">
                                <div class="content pt-0">
                                    <div class="nav-tab-wrap">
                                        <ul class="nav nav-tabs" id="myTab" role="tablist">
                                            <li class="nav-item" role="presentation">
                                                <button class="nav-link active" id="overview-tab" data-bs-toggle="tab" data-bs-target="#in_class" type="button" role="tab" aria-controls="overview" aria-selected="true">In Class</button>
                                            </li>
                                            <li class="nav-item" role="presentation">
                                                <button class="nav-link" id="carriculam-tab" data-bs-toggle="tab" data-bs-target="#online" type="button" role="tab" aria-controls="carriculam" aria-selected="false">Online</button>
                                            </li>
                                        </ul>
                                        <div class="tab-content" id="myTabContent">
                                            <div class="tab-pane fade show active" id="in_class" role="tabpanel" aria-labelledby="overview-tab">
                                                <div class="course-tab-content mt-1">
                                                    <ul class="course-item">
                                                        <li>
                                                            <span class="label"><i class="icon-60"></i>Price:</span>
                                                            <?php if($course->discount_flag == 1): ?>
                                                                <span class="value price">&#x20B9;<?php echo $course->discounted_price; ?>
                                                                <div style="font-size: 15px"><del>&#x20B9;<?php echo $course->price; ?></del></div>
                                                            </span>
                                                            <?php else: ?>
                                                                <span class="value price">&#x20B9;<?php echo $course->price; ?></span>
                                                            <?php endif; ?>
                                                            
                                                        </li>
                                                        <li>
                                                            <span class="label"><i class="icon-61"></i>Duration:</span>
                                                            <span class="value"><?php echo $course->duration; ?></span>
                                                        </li>
                                                        <li>
                                                            <span class="label">
                                                                <img class="svgInject" src="<?php echo front_css(); ?>images/svg-icons/books.svg" alt="book icon">
                                                                 &nbsp;&nbsp;Lessons:</span>
                                                            <span class="value"><?php echo $this->course_model->count_lession_by_course($course->id); ?></span>
                                                        </li>
                                                        <li>
                                                            <span class="label"><i class="icon-63"></i>Enrolled:</span>
                                                            <span class="value">1500+ students</span>
                                                        </li>
                                                        <li>
                                                            <span class="label"><i class="icon-64"></i>Certificate:</span>
                                                            <span class="value">Yes</span>
                                                        </li>
                                                    </ul>
                                                    <div class="read-more-btn">
                                                        <a href="javascript:void(0)" onclick="book_a_seat('<?php echo $course->title; ?>', 'In Class')" class="edu-btn btn-small">Book A Seat <i class="icon-4"></i></a>
                                                        <?php if ($course->syllabus):?>
                                                            <!-- <a href="#" class="edu-btn btn-small btn-secondary mt-3">Download Syllabus <i class="icon-4"></i></a> -->
                                                        <?php endif; ?>
                                                    </div>
                                                    <div class="share-area">
                                                        <h4 class="title">Share On:</h4>
                                                        <ul class="social-share">
                                                            <li><a href="#"><i class="icon-facebook"></i></a></li>
                                                            <li><a href="#"><i class="icon-twitter"></i></a></li>
                                                            <li><a href="#"><i class="icon-linkedin2"></i></a></li>
                                                            <li><a href="#"><i class="icon-youtube"></i></a></li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="tab-pane fade" id="online" role="tabpanel" aria-labelledby="carriculam-tab">
                                                <div class="course-tab-content mt-1">
                                                    <ul class="course-item">
                                                        <li>
                                                            <span class="label"><i class="icon-60"></i>Price:</span>
                                                            <?php if($course->online_training_has_discount == 1): ?>
                                                                <span class="value price">&#x20B9;<?php echo $course->online_training_discount; ?>
                                                                <div style="font-size: 15px"><del>&#x20B9;<?php echo $course->online_training_price; ?></del></div>
                                                            </span>
                                                            <?php else: ?>
                                                                <span class="value price">&#x20B9;<?php echo $course->online_training_price; ?></span>
                                                            <?php endif; ?>
                                                            
                                                        </li>
                                                        <li>
                                                            <span class="label"><i class="icon-61"></i>Duration:</span>
                                                            <span class="value"><?php echo $course->duration; ?></span>
                                                        </li>
                                                        <li>
                                                            <span class="label">
                                                                <img class="svgInject" src="<?php echo front_css(); ?>images/svg-icons/books.svg" alt="book icon">
                                                                 &nbsp;&nbsp;Lessons:</span>
                                                            <span class="value"><?php echo $this->course_model->count_lession_by_course($course->id); ?></span>
                                                        </li>
                                                        <li>
                                                            <span class="label"><i class="icon-63"></i>Enrolled:</span>
                                                            <span class="value">1500+ students</span>
                                                        </li>
                                                        <li>
                                                            <span class="label"><i class="icon-64"></i>Certificate:</span>
                                                            <span class="value">Yes</span>
                                                        </li>
                                                    </ul>
                                                    <div class="read-more-btn">
                                                        <a href="javascript:void(0)" onclick="book_a_seat('<?php echo $course->title; ?>', 'Online')" class="edu-btn btn-small">Book A Seat <i class="icon-4"></i></a>
                                                        <?php if ($course->syllabus):?>
                                                            <!-- <a href="#" class="edu-btn btn-small btn-secondary mt-3">Download Syllabus <i class="icon-4"></i></a> -->
                                                        <?php endif; ?>
                                                    </div>
                                                    <div class="share-area">
                                                        <h4 class="title">Share On:</h4>
                                                        <ul class="social-share">
                                                            <li><a href="#"><i class="icon-facebook"></i></a></li>
                                                            <li><a href="#"><i class="icon-twitter"></i></a></li>
                                                            <li><a href="#"><i class="icon-linkedin2"></i></a></li>
                                                            <li><a href="#"><i class="icon-youtube"></i></a></li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<style type="text/css">
    .social-share li a i
    {
        line-height: 2.5;
    }
    
.form-group input, .form-group textarea {
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    padding: 20px 0 10px;
}
</style>
<script type="text/javascript">
function book_a_seat(title, class_name) 
{
    $('#book_modal').modal('show');
    $('#course_lead').val(title);
    $('#class_lead').val(class_name);
}
</script>
<div class="modal fade" id="book_modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Booking Form</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <form class="p-5 pt-2" id="booking_form_submit">
            <div class="form-group col-12">
                <input type="text" name="lead_name" required placeholder="Your Full Name *">
            </div>
            <div class="form-group col-12">
                <input type="email" name="lead_email" required placeholder="Your Email ID *">
            </div>
            <div class="form-group col-12">
                <input type="text" name="lead_mobile" required placeholder="Your Mobile No *">
            </div>
            <input type="hidden" name="lead_source" value="Booking Form">
            <input type="hidden" name="lead_course" id="course_lead" >
            <input type="hidden" name="lead_class" id="class_lead" >
            <div class="form-group col-12">
                <button style="width: 100%;" class="rn-btn edu-btn btn-small submit-btn" name="submit" type="submit">Submit Message <i class="icon-4"></i></button>
            </div>
        </form>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
$("#booking_form_submit").submit(function(e) {
    e.preventDefault(); 
    var form = $(this);
    $.ajax({
        type: "POST",
        url: '<?php echo base_url(); ?>home/submit_booking_form',
        data: form.serialize(), // serializes the form's elements.
        success: function(data)
        {
          console.log(data);
          if(data != 0)
          {
            window.location = "<?php echo base_url(); ?>thank_you/"+data;
          }
          else
          {
            alert('Data Submitted Failed')
          }
        }
    });
    
});
</script>