<?php
//$this->load->library('ForeignExchange');
//$fx = new ForeignExchange('BDT', 'USD');
?>
<div class="col-sm-8">
    <div class="row gray">
        <div class="col-sm-12">
            <ul class="nav nav-tabs">
                <li class="<?php
                if ($tab == 'free') {
                    echo 'active';
                }
                ?>"><a data-toggle="tab" href="#free_video_course">Free Course <span id="total_free_course"><?php
                    if ($free_courses) {
                        echo '(' . $total_free_courses->total . ')';
                    }
                    ?></span></a></li>

                <li class="<?php
                if ($tab == 'paid') {
                    echo 'active';
                }
                ?>"><a data-toggle="tab" href="#menu1">Paid Course <span id="total_paid_course"></span></a></li>

                <li class="<?php
                if ($tab == 'registration') {
                    echo 'active';
                }
                ?>"><a data-toggle="tab" href="#register_video_course">Registration <span id="total_register_course"><?php
                    if ($registered_courses) {
                        echo '(' . $total_registered_course->total . ')';
                    }
                    ?></span></a></li>
            </ul>
        </div>



        <div class="col-sm-12">
            <div class="tab-content">
                <div id="free_video_course" class="tab-pane <?php
                if ($tab == 'free') {
                    echo 'active';
                }
                ?>">
                    <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                        <div class="col-sm-9">Title</div>
                        <div class="col-sm-3">Action</div>
                    </div>
                    <div class="col-sm-12"><br></div>


                    <div class="col-sm-12 padding-zero" id=view_learner_free_video_course>
                        <?php
                        if ($free_courses) {
                            $i = 0;
                            foreach ($free_courses as $course_value) {
                                ?>

                                <div class="col-sm-12 gray">
                                    <div class="col-sm-9 text-left" style="padding-top: 10px ">
                                        <a target="_blank" href="<?php echo base_url() . $course_value->url; ?>">
                                            <?php echo $course_value->video_course_title; ?>
                                        </a>
                                    </div>

                                    <div class="col-sm-3" style="padding-top: 10px">
                                        <a href="<?php echo base_url() . 'course/' . $course_value->url . '/certificate' ?>">
                                            <i class="fa  fa-graduation-cap" title="View Certificate"></i>
                                            &nbsp;&nbsp;&nbsp;
                                        </a>

                                        <a href="<?php echo base_url() . 'course/' . $course_value->url . '/quiz' ?>">
                                            <i class="fa  fa  fa-lightbulb-o fa-lg" title="View quiz"></i>
                                            &nbsp;&nbsp;&nbsp;
                                        </a>
                                        <a href="javascript:void(0)"  data-toggle="modal" data-target="#deleteFreeVideoCourse<?php echo $course_value->video_management_id; ?>" >
                                            <i class="fa  fa-remove" title="Cancel"></i>
                                        </a>&nbsp;&nbsp;&nbsp;
                                    </div>

                                    <!-- Start Delete Modal View-->
                                    <div class="modal" style="" id="deleteFreeVideoCourse<?php echo $course_value->video_management_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                        <div class="modal-dialog">
                                            <div class="modal-content" style="top: 180px;border: 5px solid #80c12c;border-top: 20px solid #80c12c !important;margin: 0 auto;width: 450px">           
                                                <div class="modal-body">
                                                    <h4 style="text-align: center !important">Are you sure you want to Cancel this Video Course?</h4>
                                                </div>
                                                <div class="modal-footer">
                                                    <div  class="col-sm-12">               
                                                        <button onclick="cancelVideoCourseRegistration('<?php echo base_url() . 'cancel-learner-video-course-registration' ?>', '<?php echo $course_value->student_id ?>', 'free')" style="margin-left: 90px" type="button" class="btn btn-success  col-sm-2" data-dismiss="modal">Yes</button>
                                                        <button type="button" style="margin-left: 20px" class="btn btn-danger col-sm-2 col-sm-offset-4" data-dismiss="modal">No</button>
                                                    </div>
                                                </div>            
                                            </div>
                                        </div>
                                    </div> 
                                    <!-- END Delete Modal View-->

                                </div>
                                <div class="col-sm-12"><br></div> 
                                <?php
                                $i++;
                            }
                        } else {
                            echo 'You do not have register any Free Video Course';
                        }
                        ?>


                        <?php
                        $total_page = ceil($total_free_courses->total / 10);
                        if ($total_page > 1) {
                            ?>
                            <div class="col-sm-12 " style="padding: 0">
                                <nav class="course-pagination">
                                    <ul class="pagination">
                                        <?php
                                        if ($page > 2) {
                                            ?>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo '0' ?>')"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo ($page - 1) ?>')"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                                </a>
                                            </li>
                                        <?php } elseif ($page > 1) { ?>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo ($page - 1) ?>')"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                                </a>
                                            </li>
                                            <?php
                                        }
                                        for ($i = 0; $total_page > $i; $i++) {
                                            ?>
                                            <li><a href="javascript:void(0)"
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a></li>
                                                <?php
                                            }
                                            if ($total_page != $page) {
                                                ?>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo ($page + 1) ?>')"
                                                   aria-label="Next">
                                                    <span aria-hidden="true" title="Next Page">&raquo;</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo $total_page ?>')"
                                                   aria-label="Next">
                                                    <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                                                </a>
                                            </li>
                                        <?php } ?>
                                    </ul>
                                </nav>
                            </div>
                        <?php } ?>
                    </div>



                </div>
                <!--menu 1 Tab-->
                <div id="menu1" class="tab-pane <?php
                if ($tab == 'paid') {
                    echo 'active';
                }
                ?>">


                    <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                        <div class="col-sm-5">Title</div>
                        <div class="col-sm-3">Course Price</div>
                        <div class="col-sm-2">Payment Status</div>
                        <div class="col-sm-2">Action</div>
                    </div>
                    <div class="col-sm-12"><br></div> 

                    <?php
                    $p = 0;
                    foreach ($paid_courses as $value) {
                        $payment_status = $paid_course_payment_info[$value->course_id]->payment_status;
                        if ($payment_status == 1 || $payment_status == 2 || $payment_status == 6) {
                            ?>
                            <div class="col-sm-12 gray text-center">

                                <div class="col-sm-5" style="padding-top: 10px ">
                                    <a href="<?php echo base_url() . $value->url; ?>">
                                        <?php echo $value->video_course_title; ?>
                                    </a>
                                </div>

                                <div class="col-sm-3" style="padding-top: 10px">
                                    <?php
                                    $course_price = $value->video_course_price;
                                    $type = $value->video_course_type;
                                    $currency = $value->video_course_price_currency;
                                    if ($type == 1) {
                                        if ($currency == 1) {
                                            
                                            //echo 'BDT ' . $course_price . ' / USD ' . $this->tt_currency->set($course_price, 'BDT', 'USD')->convert_currency()->get();
                                            echo 'BDT ' . $course_price;
                                        } else if ($currency == 2) {
                                            
                                            //echo 'BDT ' . $this->tt_currency->set($course_price, 'USD', 'BDT')->convert_currency()->get() . ' / USD ' . $course_price;
                                            echo ' USD ' . $course_price;
                                        }
                                    } else {
                                        echo 'Free';
                                    }
                                    ?>
                                </div>

                                <div class="col-sm-2" style="padding-top: 10px">
                                    <?php
                                    if ($payment_status == 1) {
                                        echo 'Paid';
                                    } else if ($payment_status == 2) {
                                        echo 'Partial Paid';
                                    } else if ($payment_status == 3) {
                                        echo 'Pending';
                                    }
                                    ?>
                                </div>

                                <div class="col-sm-2 text-center" style="padding-top: 10px">

                                    <?php if ($value->video_course_type == 1) { ?>
                                        <a href="<?php echo base_url() . 'video-course/' . $value->url ?>">
                                            <i class="fa fa-calendar" title="Detail"></i>
                                            &nbsp;&nbsp;
                                        </a>
                                    <?php } ?>

                                    <?php if ($payment_status == 1) { ?>
                                        <a href="<?php echo base_url() . 'course/certificate' ?>">
                                            <i class="fa  fa-graduation-cap" title="View Certificate"></i>
                                            &nbsp;&nbsp;
                                        </a>
                                        <a href="<?php echo base_url() . 'course/' . $value->url . '/quiz' ?>">
                                            <i class="fa  fa  fa-lightbulb-o fa-lg" title="View quiz"></i>
                                            &nbsp;&nbsp;
                                        </a>
                                        <br>

                                    <?php } ?>
                                    <?php
                                    $payment_id = $this->encrypt->encode($value->payment_id);
                                    $id = str_replace("/", "%F2", $payment_id);
                                    ?>
                                    <a href="<?php echo base_url() . 'view-invoice-set-id/' . $id; ?>">
                                        <i class="fa  fa  fa-money" title="View Invoice"></i>
                                        &nbsp;&nbsp;
                                    </a>

                                    <a href="" onclick="">
                                        <i class="fa  fa-remove" title="Cancel"></i>
                                    </a>&nbsp;&nbsp;

                                </div>

                            </div>

                            <div class="col-sm-12"><br></div> 

                            <?php
                            $p++;
                        }
                    }
                    ?>

                    <div class="col-sm-12"><br></div>

                    <div class="col-sm-12 " style="padding: 0">
                        <!--                        <nav class="course-pagination">
                                                    <ul class="pagination">
                                                        <li>
                                                            <a href="#" aria-label="Previous">
                                                                <span aria-hidden="true" title="First Page">««</span>
                                                            </a>
                                                        </li>
                                                        <li>
                                                            <a href="#" aria-label="Previous">
                                                                <span aria-hidden="true" title="Previous Page">«</span>
                                                            </a>
                                                        </li>
                                                        <li><a href="#">1</a></li>
                                                        <li><a href="#">2</a></li>
                                                        <li><a href="#">3</a></li>
                                                        <li><a href="#">4</a></li>
                                                        <li><a href="#">5</a></li>
                                                        <li>
                                                            <a href="#" aria-label="Next">
                                                                <span aria-hidden="true" title="Next Page">»</span>
                                                            </a>
                                                        </li>
                                                        <li>
                                                            <a href="#" aria-label="Next">
                                                                <span aria-hidden="true" title="Last Page">»»</span>
                                                            </a>
                                                        </li>
                                                    </ul>
                                                </nav>-->
                    </div>
                </div>

                <!--Menu 2 Tab ...-->





                <div id="register_video_course" class="tab-pane <?php
                if ($tab == 'registration') {
                    echo 'active';
                }
                ?>">
                    <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                        <div class="col-sm-5">Title</div>
                        <div class="col-sm-3">Course Price</div>
                        <div class="col-sm-2">Payment Status</div>
                        <div class="col-sm-2">Action</div>
                    </div>
                    <div class="col-sm-12"><br></div> 

                    <div class="col-sm-12 padding-zero" id=view_learner_register_video_course>
                        <?php
                        if ($registered_courses) {
                            $k = 0;
                            foreach ($registered_courses as $course_value) {
                                ?>
                                <div class="col-sm-12 gray text-left">
                                    <div class="col-sm-5" style="padding-top: 10px ">
                                        <a target="_blank" href="<?php echo base_url() . $course_value->url; ?>">
                                            <?php echo $course_value->video_course_title; ?>
                                        </a>
                                    </div>

                                    <div class="col-sm-3" style="padding-top: 10px">
                                        <?php
//                                    if ($course_value->video_course_price_currency == 1) {
//                                        echo 'BDT ' . $course_value->video_course_price . ' / USD ' . $fx->toForeign($course_value->video_course_price);
//                                    } else if ($currency == 2) {
//                                        echo 'BDT ' . $fx->toForeign($course_value->video_course_price) . ' / USD ' . $course_value->video_course_price;
//                                    }
                                        ?>
                                    </div>
                                    <div class="col-sm-2" style="padding-top: 10px">Unpaid</div>
                                    <div class="col-sm-2" style="padding-top: 10px">
                                        <?php
//                                        $payment_id = $this->encrypt->encode($value->payment_id);
//                                        $id = str_replace("/", "%F2", $payment_id);
                                        ?>
                                        <a href="<?php // echo base_url() . 'view-invoice-set-id/' . $id;       ?>">
                                            <i class="fa  fa  fa-money" title="View Invoice"></i>
                                            &nbsp;&nbsp;&nbsp;
                                        </a>
                                        <a href="javascript:void(0)"  data-toggle="modal" data-target="#deleteRegisterVideoCourse<?php echo $course_value->video_management_id; ?>" >
                                            <i class="fa  fa-remove" title="Cancel"></i>
                                        </a>&nbsp;&nbsp;&nbsp;
                                    </div>

                                    <!-- Start Delete Modal View-->
                                    <div class="modal" style="" id="deleteRegisterVideoCourse<?php echo $course_value->video_management_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                        <div class="modal-dialog">
                                            <div class="modal-content" style="top: 180px;border: 5px solid #80c12c;border-top: 20px solid #80c12c !important;margin: 0 auto;width: 450px">           
                                                <div class="modal-body">
                                                    <h4 style="text-align: center !important">Are you sure you want to Cancel this Video Course?</h4>
                                                </div>
                                                <div class="modal-footer">
                                                    <div  class="col-sm-12">               
                                                        <button onclick="cancelVideoCourseRegistration('<?php echo base_url() . 'cancel-learner-video-course-registration' ?>', '<?php echo $course_value->payment_id ?>', 'registration')" 
                                                                style="margin-left: 90px" type="button" class="btn btn-success  col-sm-2" data-dismiss="modal">Yes</button>
                                                        <button type="button" style="margin-left: 20px" class="btn btn-danger col-sm-2 col-sm-offset-4" data-dismiss="modal">No</button>
                                                    </div>
                                                </div>            
                                            </div>
                                        </div>
                                    </div> 
                                    <!-- END Delete Modal View-->

                                </div>
                                <div class="col-sm-12"><br></div> 
                                <?php
                                $k++;
                            }
                        } else {
                            echo 'You do not have any register video course';
                        }
                        ?>

                        <?php
                        $total_register_page = ceil($total_registered_course->total / 10);
                        if ($total_register_page > 1) {
                            ?>
                            <div class="col-sm-12 " style="padding: 0">
                                <nav class="course-pagination">
                                    <ul class="pagination">
                                        <?php
                                        if ($page > 2) {
                                            ?>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo '0' ?>')"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo ($page - 1) ?>')"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                                </a>
                                            </li>
                                        <?php } elseif ($page > 1) { ?>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo ($page - 1) ?>')"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                                </a>
                                            </li>
                                            <?php
                                        }
                                        for ($i = 0; $total_register_page > $i; $i++) {
                                            ?>
                                            <li><a href="javascript:void(0)"
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a></li>
                                                <?php
                                            }
                                            if ($total_register_page != $page) {
                                                ?>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo ($page + 1) ?>')"
                                                   aria-label="Next">
                                                    <span aria-hidden="true" title="Next Page">&raquo;</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo $total_register_page ?>')"
                                                   aria-label="Next">
                                                    <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                                                </a>
                                            </li>
                                        <?php } ?>
                                    </ul>
                                </nav>
                            </div>
                        <?php } ?>
                    </div>

                </div>
                <!--Menu 3 Tab ...-->

                <!--                <div id="menu3" class="tab-pane fade">
                
                
                
                                    <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                                        <div class="col-sm-2">Image</div>
                                        <div class="col-sm-4">Title</div>
                                        <div class="col-sm-2">Course Price</div>
                                        <div class="col-sm-2">Action</div>
                                    </div>
                                    <div class="col-sm-12"><br></div> 
                <?php
//                    $w = 0;
//                    foreach ($wish_courses as $value) {
                ?>
                                        <div class="col-sm-12 gray text-center" id="data<?php //echo $value->course_id;           ?>">
                                            
                                            <div class="col-sm-5" style="padding-top: 10px ">
                                                <a href="<?php //echo base_url() . $value->url;           ?>">
                <?php // echo $value->video_course_title; ?>
                                                </a>
                                            </div>
                
                                            <div class="col-sm-4" style="padding-top: 10px">
                <?php
//                                $course_price = $value->video_course_price;
//                                $type = $value->video_course_type;
//                                $currency = $value->video_course_price_currency;
//                                if ($type == 1) {
//                                    if ($currency == 1) {
//                                        echo 'BDT ' . $course_price . ' / USD ' . $fx->toForeign($course_price);
//                                    } else if ($currency == 2) {
//                                        echo 'BDT ' . $fx->toForeign($course_price) . ' / USD ' . $course_price;
//                                    }
//                                } else {
//                                    echo 'Free';
//                                }
                ?>
                                            </div>
                
                                            <div class="col-sm-2" style="padding-top: 10px">
                                                <a href="#" onclick="return checkForAction('<?php //echo base_url() . 'cancel-wishlist/' . $value->course_id;           ?>', 'Calcel', '<?php //echo $value->course_id;           ?>')">
                                                    <i class="fa fa-trash-o" title="Cancel Wish list"></i></a>&nbsp;&nbsp;&nbsp;
                
                                                <a href="<?php // echo base_url() . 'course/' . $value->url . '/registration';           ?>" >
                                                    <i class="fa fa-link" title="Get Enrollment in this Course"></i>
                                                </a>
                                            </div>
                                        </div>
                
                                        <div class="col-sm-12"><br></div> 
                
                <?php
//                        $w++;
//                    }
                ?>
                                    <div class="col-sm-12"><br></div>
                
                                    <div class="col-sm-12 " style="padding: 0">
                                       
                                    </div>
                                </div>-->
            </div>
        </div>

    </div>


</div>

<script type="text/javascript" src="<?php echo base_url(); ?>front_end_resource/video_course/video_course.js">
</script>