<?php 
$video_course_id = $this->session->userdata("video_course_id");
$add_edit_video_course_highlight = $this->session->userdata("add_edit_video_course_highlight");
?>
<div class="col-sm-10">
    <div class="row">
        <div class="col-sm-12 ">
            <div class="col-sm-2 form-group">
                <a href="<?php echo base_url(); ?>add-admin-video-course" class="btn btn-sm btn-success ">
                    <i class="fa fa-plus" aria-hidden="true" title="Add Course"></i>
                </a>
                <input type="hidden" id="sort_by" value="<?php echo $sort_by;?>">
                <?php
                switch ($sort_by) {
                    case 'asc':
                        ?>
                        <a href="<?php echo base_url('manage-admin-video-course/desc'); ?>" class="btn btn-sm btn-success">
                            <i class="fa fa-sort-alpha-desc" title="Short user by name"></i>
                        </a>
                        <?php
                        break;
                    case 'desc':
                        ?>
                        <a href="<?php echo base_url('manage-admin-video-course/asc'); ?>" class="btn btn-sm btn-success">
                            <i class="fa fa-sort-alpha-asc" title="Short user by name"></i>
                        </a>
                        <?php
                        break;

                    default:
                        ?>
                        <a href="<?php echo base_url('manage-admin-video-course/asc'); ?>" class="btn btn-sm btn-success">
                            <i class="fa fa-sort-alpha-asc" title="Short user by name"></i>
                        </a>
                        <?php
                        break;
                }
                ?>
            </div>
            <div class="col-sm-5">
                <div class="input-group">
                    <input type="text" 
                           class="form-control"
                           oninput="getVideoCourseSearchValue(this.value,'<?php echo base_url() . 'search-admin-video-course' ?>')"
                           id="search_video_course"
                           placeholder="Search here...">
                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                </div>
            </div>
            <div class="col-sm-3">
                <select class="form-control"
                        id="video_course_search_by_status"
                        onchange="get_video_course_status(this.value, '<?php echo base_url("search-admin-video-course"); ?>')">
                    <option value=''>All</option>
                    <option value='1'>Active</option>
                    <option value='6'>Inactive</option>
                    <option value='2'>Archive</option>
                    <option value='3'>Pending</option>
                    <option value='4'>Approved</option>
                    <option value='5'>Draft</option>
                </select>
            </div>
            <div class="col-sm-2">
                <select class="form-control"
                        id="video_course_search_type"
                        onchange="get_video_course_by_type(this.value, '<?php echo base_url("search-admin-video-course"); ?>')">
                    <option value=''>All</option>
                    <option value='1'>Free</option>
                    <option value='2'>Paid</option>
                </select>
            </div>
        </div>
    </div>

    <input type="hidden" id="baseUrl" value="<?php echo base_url(); ?>">
    <div class="row ">
        <div class="col-sm-12 "><br></div>
        <div class="col-sm-12 ">
            <div class="col-sm-12">
<!--                    <a href="<?php //echo base_url(); ?>super-admin/all-video-course" target="_blank"> <span class="float: left;" style="font-size: 18px">View All Video course</span></a>-->
               <h3>
                    Manage Video Course
                </h3>
                <hr>
            </div>

            <div class="col-sm-12" >
                <div class="col-sm-12 gray_ttc text-left manage_video_course_title_by_topic_action">
                    <div class="col-sm-4">Title</div>
                    <div class="col-sm-3">BY</div>
                    <div class="col-sm-3">Topic</div>
                    <div class="col-sm-2">Action</div>
                </div>
                <div class="col-sm-12"><br></div> 


                <div id="view_video_courses">
                    <?php
                        if($video_course_id != '' && $add_edit_video_course_highlight == 'highlight'){
                            $video_course = $this->Manage_admin_video_course_model->highlight_add_edit_admin_video_course($video_course_id);
                            //$this->cf->dd($video_course);
                            if(isset($video_course)){
                            
                        ?>
                        <div class="col-sm-12 gray text-left add_edit_highlight_course">
                            <div class="col-sm-4 manage_title_by_topic">
                                <a href="<?php echo base_url().'view-single-video-course/'.$video_course->url;?>"><?php echo $video_course->video_course_title; ?></a>
                            </div>
                            <div class="col-sm-3 manage_title_by_topic">
                                <a href=""><?php echo $video_course->person_first_name; ?></a>
                            </div>
                            <div class="col-sm-3 manage_title_by_topic">
                                <a href=""><?php echo $video_course->topic_name; ?></a>
                            </div>
                            <div class="col-sm-2" id="video_course_status">
                                <?php
                                switch ($video_course->video_course_publication_status) {
                                case 1:
                                ?>
                                <a href="javascript:void(0)"
                                    onclick="changeVideoCourseStatus('<?php echo base_url() . 'video-course-status-change'; ?>', '<?php echo $video_course->video_course_id; ?>', 'Published')">
                                    <i class="fa fa-dropbox" title="Draft"></i>
                                </a>
                                <?php
                                    break;
                                case 2:
                                    ?>
                                <a href="javascript:void(0)"
                                    onclick="changeVideoCourseStatus('<?php echo base_url() . 'video-course-status-change'; ?>', '<?php echo $video_course->video_course_id; ?>', 'Pending')">
                                    <i class="fa fa-user-plus" title="Published"></i>
                                </a>
                                <?php
                                    break;
                                case 3:
                                    ?>
                                <a href="javascript:void(0)"
                                    onclick="changeVideoCourseStatus('<?php echo base_url() . 'video-course-status-change'; ?>', '<?php echo $video_course->video_course_id; ?>', 'Draft')">
                                    <i class="fa fa-refresh fa-spin" title="Pending"></i>
                                </a>
                                <?php
                                    break;
                                case 4:
                                    ?>
                                <a href="javascript:void(0)"
                                    onclick="changeVideoCourseStatus('<?php echo base_url() . 'video-course-status-change'; ?>', '<?php echo $video_course->video_course_id; ?>', 'Pending')">
                                    <i class="fa fa-archive" title="Archived"></i>
                                </a>
                                <?php
                                break;
                                    }
                                ?>
                                
                                <a href="<?php echo base_url() . 'edit-admin-video-course/' . $video_course->video_course_id; ?>">
                                    <i class="fa fa-edit" title="Edit"></i>
                                </a>
                                <a href="<?php echo base_url() . 'send-video-course-invitation/'. $video_course->url; ?>">
                                    <i class="fa fa-envelope-o" title="Invite Learners"></i>
                                </a>
                                <a href="<?php echo base_url() . 'view-video-course-invitation/'. $video_course->url; ?>">
                                    <i class="fa fa-telegram" title="View Invitation"></i>
                                </a>
                                <a href="<?php echo base_url(); ?>super-admin/registered-sutdent-for-paid-course">
                                    <i class="fa fa-registered" title="View Registered Student"></i>
                                </a>
                                <a href="<?php echo base_url().'manage-video-section/'.$video_course->video_course_id;?>">
                                    <i class="fa fa-clone" title="Add Section"></i>
                                </a>
                                <a href="<?php echo base_url() ?>super-admin/manage-video-course-section">
                                    <i class="fa fa-puzzle-piece" title="View Section"></i>
                                </a>
                                <a href="<?php echo base_url() ?>super-admin/course-url/add-video">
                                    <i class="fa fa-file-video-o" title="Add Video/ Work file"></i>
                                </a>
                                <a href="<?php echo base_url() . 'super-admin/view-video-back-end'; ?>">
                                    <i class="fa fa-film" title="View Video"></i>
                                </a>
                                <a href="">
                                    <i class="fa fa-star" title="View rating"></i>
                                </a>
                                <a href="<?php echo base_url() . 'manage-video-course-meta/'.$video_course->video_course_id; ?>">
                                    <i class="fa fa-info-circle" title="Add Meta"></i>
                                </a>
                                <a href="javascript:void(0)" data-toggle="modal" data-target="#deleteVideoCoures<?php echo $video_course->video_course_id; ?>">
                                    <i class="fa fa-trash-o" title="Delete"></i>
                                </a>
                            </div>
                        </div>
                    <div class="col-sm-12"><br></div> 
                        <div class="modal" id="deleteVideoCoures<?php echo $video_course->video_course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                            <div class='modal-dialog'>
                                <div class='modal-content delete_modal_content'>           
                                    <div class='modal-body text-center delete_modal_body'>
                                        <span class='text-center'>Are you sure want to Delete this video course?</span>
                                    </div>
                                    <div class='modal-footer'>
                                        <div  class='col-sm-12 text-center'>  
                                            <span class='col-sm-3 col-sm-offset-3'>
                                                <button type='button' class='btn btn-danger  col-sm-12 delete_modal_no_button' data-dismiss='modal'>No</button>
                                            </span> 
                                            <span class='col-sm-3'>
                                                <button onclick="deleteVideoCoures('<?php echo base_url('delete-admin-video-course/' . $video_course->video_course_id); ?>')" class='btn btn-success col-sm-12' data-dismiss='modal'>Yes</button>
                                            </span>

                                        </div>
                                    </div>            
                                </div>
                            </div>
                        </div>
                        <?php
                            }
                    }
                   if($all_video_course){
                    
                    foreach ($all_video_course as $v_video_course) {
                        ?>
                        <div class="col-sm-12 gray text-left">
                            <div class="col-sm-4 manage_title_by_topic">
                                <a href="<?php echo base_url().'view-single-video-course/'.$v_video_course->url;?>"><?php echo $v_video_course->video_course_title; ?></a>
                            </div>
                            <div class="col-sm-3 manage_title_by_topic">
                                <a href=""><?php echo $v_video_course->person_first_name; ?></a>
                            </div>
                            <div class="col-sm-3 manage_title_by_topic">
                                <a href=""><?php echo $v_video_course->topic_name; ?></a>
                            </div>
                            <div class="col-sm-2" id="video_course_status">
                                <?php
                                switch ($v_video_course->video_course_publication_status) {
                                case 1:
                                ?>
                                <a href="javascript:void(0)"
                                    onclick="changeVideoCourseStatus('<?php echo base_url() . 'video-course-status-change'; ?>', '<?php echo $v_video_course->video_course_id; ?>', 'Published')">
                                    <i class="fa fa-dropbox" title="Draft"></i>
                                </a>
                                <?php
                                    break;
                                case 2:
                                    ?>
                                <a href="javascript:void(0)"
                                    onclick="changeVideoCourseStatus('<?php echo base_url() . 'video-course-status-change'; ?>', '<?php echo $v_video_course->video_course_id; ?>', 'Pending')">
                                    <i class="fa fa-user-plus" title="Published"></i>
                                </a>
                                <?php
                                    break;
                                case 3:
                                    ?>
                                <a href="javascript:void(0)"
                                    onclick="changeVideoCourseStatus('<?php echo base_url() . 'video-course-status-change'; ?>', '<?php echo $v_video_course->video_course_id; ?>', 'Archived')">
                                    <i class="fa fa-refresh fa-spin" title="Pending"></i>
                                </a>
                                <?php
                                    break;
                                case 4:
                                    ?>
                                <a href="javascript:void(0)"
                                    onclick="changeVideoCourseStatus('<?php echo base_url() . 'video-course-status-change'; ?>', '<?php echo $v_video_course->video_course_id; ?>', 'Draft')">
                                    <i class="fa fa-archive" title="Archived"></i>
                                </a>
                                <?php
                                break;
                                    }
                                ?>
                                
                                <a href="<?php echo base_url() . 'edit-admin-video-course/' . $v_video_course->video_course_id; ?>">
                                    <i class="fa fa-edit" title="Edit"></i>
                                </a>
                                <a href="<?php echo base_url() . 'send-video-course-invitation/'. $v_video_course->url; ?>">
                                    <i class="fa fa-envelope-o" title="Invite Learners"></i>
                                </a>
                                <a href="<?php echo base_url() . 'view-video-course-invitation/'. $v_video_course->url; ?>">
                                    <i class="fa fa-telegram" title="View Invitation"></i>
                                </a>
                                <a href="<?php echo base_url(); ?>super-admin/registered-sutdent-for-paid-course">
                                    <i class="fa fa-registered" title="View Registered Student"></i>
                                </a>
                                <a href="<?php echo base_url().'manage-video-section/'.$v_video_course->video_course_id;?>">
                                    <i class="fa fa-clone" title="Add Section"></i>
                                </a>
                                <a href="<?php echo base_url() ?>super-admin/manage-video-course-section">
                                    <i class="fa fa-puzzle-piece" title="View Section"></i>
                                </a>
                                <a href="<?php echo base_url() ?>super-admin/course-url/add-video">
                                    <i class="fa fa-file-video-o" title="Add Video/ Work file"></i>
                                </a>
                                <a href="<?php echo base_url() . 'super-admin/view-video-back-end'; ?>">
                                    <i class="fa fa-film" title="View Video"></i>
                                </a>
                                <a href="">
                                    <i class="fa fa-star" title="View rating"></i>
                                </a>
                                <a href="<?php echo base_url() . 'manage-video-course-meta/'.$v_video_course->video_course_id; ?>">
                                    <i class="fa fa-info-circle" title="Add Meta"></i>
                                </a>
                                <a href="javascript:void(0)" data-toggle="modal" data-target="#deleteVideoCoures<?php echo $v_video_course->video_course_id; ?>">
                                    <i class="fa fa-trash-o" title="Delete"></i>
                                </a>
                            </div>
                        </div>
                    <div class="col-sm-12"><br></div> 
                        <div class="modal" id="deleteVideoCoures<?php echo $v_video_course->video_course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                            <div class='modal-dialog'>
                                <div class='modal-content delete_modal_content'>           
                                    <div class='modal-body text-center delete_modal_body'>
                                        <span class='text-center'>Are you sure want to Delete this video course?</span>
                                    </div>
                                    <div class='modal-footer'>
                                        <div  class='col-sm-12 text-center'>  
                                            <span class='col-sm-3 col-sm-offset-3'>
                                                <button type='button' class='btn btn-danger  col-sm-12 delete_modal_no_button' data-dismiss='modal'>No</button>
                                            </span> 
                                            <span class='col-sm-3'>
                                                <button onclick="deleteVideoCoures('<?php echo base_url('delete-admin-video-course/' . $v_video_course->video_course_id); ?>')" class='btn btn-success col-sm-12' data-dismiss='modal'>Yes</button>
                                            </span>

                                        </div>
                                    </div>            
                                </div>
                            </div>
                        </div>
                        <?php
                    }
                    echo $video_course_pagination;
                        }
                    ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php 
$this->session->unset_userdata('video_course_id');
$this->session->unset_userdata('add_edit_video_course_highlight');
?>
<link href="<?php echo base_url();?>back_end_resource/Manage_admin_video_course/manage_admin_video_course.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo base_url();?>back_end_resource/Manage_admin_video_course/manage_admin_video_course.js" type="text/javascript"></script>
<script src="<?php echo base_url();?>back_end_resource/Manage_admin_video_course/delete_admin_video_course.js" type="text/javascript"></script>

