<script>
    var urlValue = '';
</script>
<div class="col-sm-10">
    <div class="row">
        <div class="col-sm-12">
            <div class="col-sm-12 gray_ttc">
                <div class="course-detail-tab margin-zero ">
                    <ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
                        <h4>Add video Course Information</h4>
                    </ul>
                    <div id="my-tab-content" class="tab-content">



                        <!-- add_video_info tab-->
                        <div class="tab-pane active" id="add_video_info">
                            <div class="tab-content panel-body">
                                <div class="col-sm-10  "><br><br></div>
                                <div class="col-sm-10  ">
                                    <?php
                                    //formID1
//                                    echo validation_errors();
                                    $url = 'add-video-course';
                                    echo form_open_multipart($url, 'class="cmxform" id="formID1" name="add_video_course_form" onsubmit="return checkAddVideoCourse()" ');
                                    ?>

                                    <div class="form-group col-sm-12">
                                        <div class="input-group">
                                            <input type="text" 
                                                   class="form-control validate[required]"
                                                   id="video_course_title"
                                                   name="video_course_title"
                                                   oninput="checkVideoUrlValue(this.value,urlValue)"
                                                   value="<?php echo set_value('video_course_title'); ?>"
                                                   placeholder="Please Type Video Course Title.." 
                                                   aria-describedby="basic-addon1">
                                            <span class="input-group-addon" id="basic-addon1" title="Please Type Video Title"><i class="fa fa-video-camera"></i></span>
                                        </div>
                                        <input type="hidden" id="video_course_id" name="video_course_id" value="">
                                        <div class="col-sm-12" id="video_course_title_error" style="color: red"><?php echo form_error('video_course_title'); ?></div>
                                    </div>
                                    <div class="col-sm-12 "><br></div>



                                    <div class="form-group col-sm-6">
                                        <select class="form-control" id="menu_id" name="menu_id">
                                            <option value="" > Select Menu </option>
                                            <?php
                                            foreach ($all_menu as $menu_value) {
                                                echo '<option value="' . $menu_value->menu_id . '">' . $menu_value->menu_name . '</option>';
                                            }
                                            ?>
                                        </select>
                                    </div>
                                    
                                    <div class="form-group col-sm-6">
                                        <select class="form-control validate[required]" 
                                                id="course_category_id" 
                                                name="course_category_id">
                                            <option value="" > Select Category </option>
                                            <?php
                                            foreach ($all_course_category as $category_value) {
                                                echo '<option value="' . $category_value->course_category_id . '">' . $category_value->course_category_name . '</option>';
                                            }
                                            ?>
                                        </select>
                                        <div class="col-sm-12" id="course_category_id_error" style="color: red"><?php echo form_error('course_category_id'); ?></div>
                                    </div>




                                    <div class="col-sm-12 "><br></div>  
                                    <div class="form-group col-sm-6">
                                        <select class="form-control validate[required]" 
                                                id="resource_person_id" 
                                                name="resource_person_id">
                                            <option value="" > Select Resource Person </option>
                                            <?php
                                            foreach ($resource_persons as $resource_person_value) {
                                                echo '<option value="' . $resource_person_value->resource_person_id . '">' . $resource_person_value->person_first_name . ' ' . $resource_person_value->person_last_name . '</option>';
                                            }
                                            ?>
                                        </select>
                                        <div class="col-sm-12" id="resource_person_id_error" style="color: red"><?php echo form_error('resource_person_id'); ?></div>
                                    </div>



                                    <div class="form-group col-sm-6">
                                        <select class="form-control validate[required]" 
                                                id="video_management_level" name="video_management_level">
                                            <option value="">Select Video Course level</option>
                                            <option value="0">Any</option>
                                            <option value="1">Basic</option>
                                            <option value="2">Intermediate</option>
                                            <option value="3">Advance</option>
                                        </select>
                                        <div class="col-sm-12" id="video_management_level_error" style="color: red"><?php echo form_error('video_management_level'); ?></div>
                                    </div>



                                    <div class="col-sm-12 "><br></div>
                                    <div class="col-sm-12">
                                        <div class="form-group col-sm-6 padding-zero">
                                            <div class="input-group">
                                                <input type="text" 
                                                       class="form-control validate[required, custom[urlSpecialCaracter], custom[spaceFunction], custom[urlExistence], custom[noCapital], custom[checkUrlHypen], custom[checkUrlHypenLast]]"
                                                       id="video_course_url"
                                                       name="video_course_url"
                                                       oninput="checkVideoUrlValue(video_course_title.value,this.value)"
                                                       value="<?php echo set_value('video_course_url'); ?>"
                                                       placeholder="Please Type Video URL.." 
                                                       aria-describedby="basic-addon1">
                                                <span class="input-group-addon" id="basic-addon1" title="Please Type Video URL"><i class="fa fa-link"></i></span>
                                            </div>
                                            <input type="hidden" id="url_exist" value="">
                                            <div class="col-sm-12" id="video_course_url_error" style="color: red"><?php echo form_error('video_course_url'); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-sm-12"><br></div>

                                    <script>
                                        function checkVideoUrlValue(videoCourseTitle, urlInput) {
                                            urlValue = urlInput;
                                            if (urlValue === '') {
                                                makeVideoCourseUrl(videoCourseTitle);
                                                documentID('video_course_url_error').innerHTML = '';
                                            } else {
                                                checkVideoCourseURLExists(urlInput, '');
                                                documentID('video_course_url_error').innerHTML = '';
                                            }
                                        }
                                    </script>

                                    <div class="form-group col-sm-8">
                                        <div class="input-group">
                                            <input type="text" 
                                                   class="form-control validate[required, custom[checkVideoCourseFolder], custom[folderNameExistence]]"
                                                   id="video_folder_name"
                                                   name="video_folder_name"
                                                   oninput="checkFolderName(this.value,'<?php echo base_url() . 'check-folder-name-exists' ?>')"
                                                   value="<?php echo set_value('video_folder_name'); ?>"
                                                   placeholder="Please Type Video Folder Name" 
                                                   aria-describedby="basic-addon1">
                                            <span class="input-group-addon" id="basic-addon1" title="Please Type Video Folder Name"><i class="fa fa-folder"></i></span>
                                        </div>
                                        <input type="hidden" id="folder_exists" value="">
                                        <span class="col-sm-12" id="video_folder_name_error" style="color: red;"><?php echo form_error('video_folder_name'); ?></span>
                                    </div>
                                    <div class="col-sm-12"><br></div>




                                    <div class="form-group col-sm-8">
                                        <div class="input-group">
                                            <input type="text" 
                                                   class="form-control"
                                                   id="video_management_author"
                                                   name="video_management_author"
                                                   value="<?php echo set_value('video_management_author'); ?>"
                                                   placeholder="Please Type Video Course Author" 
                                                   aria-describedby="basic-addon1">
                                            <span class="input-group-addon" id="basic-addon1" title="Please Type Video Course Author"><i class="fa fa-user"></i></span>
                                        </div>
                                        <span class="col-sm-12" id="video_management_author_error" style="color: red;"><?php echo form_error('video_management_author'); ?></span>
                                    </div>
                                    <div class="col-sm-12"><br></div>




                                    <div class="form-group col-sm-8">
                                        <div class="input-group">
                                            <input type="text" 
                                                   class="form-control"
                                                   id="video_management_meta_title"
                                                   name="video_management_meta_title"
                                                   value="<?php echo set_value('video_management_meta_title'); ?>"
                                                   placeholder="Please Type Video Course Meta Title" 
                                                   aria-describedby="basic-addon1">
                                            <span class="input-group-addon" id="basic-addon1" title="Please Type Video Course Meta Title"><i class="fa fa-user"></i></span>
                                        </div>
                                        <span class="col-sm-12" id="video_management_meta_title_error" style="color: red;"><?php echo form_error('video_management_meta_title'); ?></span>
                                    </div>
                                    <div class="col-sm-12"><br></div>



                                    <?php
                                    $video_management_keyword = $this->input->post('video_management_keyword', TRUE);
                                    ?>

                                    <div class="form-group col-sm-12">
                                        <input class="col-sm-12"
                                               type="hidden" name="to_address" id="to_address" value="" >
                                        <div class="col-sm-12 padding-zero">
                                            <select name="video_management_keyword[]"  
                                                    id="video_management_keyword" 
                                                    data-errormessage-value-missing="Video Course Keywords is is Required!"
                                                    class="tokenize-sample validate[]"
                                                    title="" 
                                                    multiple="multiple" style="margin: 0px; padding: 0px; border: 0px; display: none;">
                                                        <?php
                                                        if (isset($video_management_keyword)) {
                                                            foreach ($video_management_keyword as $value1) {
                                                                ?>
                                                        <option value="<?php echo $value1; ?>" selected ><?php echo $value1; ?></option>
                                                        <?php
                                                    }
                                                }
                                                ?>
                                            </select>
                                        </div>
                                        <script type="text/javascript">
                                            $('select#video_management_keyword').tokenize({placeholder: "Please Type Video Course Topic"});
                                        </script>
                                        <span style="color: red;"><?php echo form_error('video_management_keyword'); ?></span>
                                    </div>
                                    <div class="col-sm-12"><br></div>




                                    <?php
                                    $video_management_meta_keywords = $this->input->post('video_management_meta_keywords', TRUE);
                                    ?>
                                    <div class="form-group col-sm-12">
                                        <input class="col-sm-12"
                                               type="hidden" name="to_address" id="to_address" value="" >
                                        <div class="col-sm-12 padding-zero">
                                            <select name="video_management_meta_keywords[]"  
                                                    id="video_management_meta_keywords" 
                                                    data-errormessage-value-missing="Video Course Meta Keywords is is Required!"
                                                    class="tokenize-sample validate[]"
                                                    title="" 
                                                    multiple="multiple" style="margin: 0px; padding: 0px; border: 0px; display: none;">
                                                        <?php
                                                        if (isset($video_management_meta_keywords)) {
                                                            foreach ($video_management_meta_keywords as $value1) {
                                                                ?>
                                                        <option value="<?php echo $value1; ?>" selected ><?php echo $value1; ?></option>
                                                        <?php
                                                    }
                                                }
                                                ?>
                                            </select>
                                        </div>
                                        <script type="text/javascript">
                                            $('select#video_management_meta_keywords').tokenize({placeholder: "Please Type Video Course Meta Keywords"});
                                        </script>
                                        <span style="color: red;"><?php echo form_error('video_management_meta_keywords'); ?></span>
                                    </div>
                                    <div class="col-sm-12"><br></div>




                                    <div class="form-group col-sm-12 padding-zero">
                                        <div class="form-group col-sm-12">
                                            <label>Course Meta Description</label>
                                            <div class="input-group text-left">
                                                <textarea class="form-control"
                                                          style="max-width: 600px; max-height: 200px;"
                                                          name="video_management_meta_description"
                                                          rows="2" cols="80"><?php echo set_value('video_management_meta_description'); ?></textarea>
                                            </div>
                                        </div>
                                        <div class="col-sm-12" style="color: red;"><?php echo form_error('video_management_meta_description'); ?></div>
                                    </div>
                                    <div class="col-sm-12"><br></div>

                                    <div class="form-group col-sm-12" >
                                        <div class="input-group text-left" id="screen1280" >
                                            <label>Video Training Objective</label>
                                            <textarea   class="form-control resoulation1280 resoulation1024 resoulationMobile resoulationMobile_max499"
                                                        name="video_training_objectives[]"
                                                        rows="4"  placeholder="Video Training Objective" ></textarea>
                                        </div>
                                    </div>
                                    <div class="col-sm-12"><br> </div>
                                    
                                    <div class="form-group text-left col-sm-12" >
                                        <div class="input-group " id="screen1280" >
                                            <label>Video Training Outline</label>
                                            <textarea   class="form-control  resoulation1280 resoulation1024 resoulationMobile resoulationMobile_max499" 
                                                        name="video_training_outline[]"
                                                        rows="4"  placeholder="Video Training Outline" ></textarea>
                                        </div>
                                    </div>
                                    <div class="col-sm-12"><br></div>

                                    <div class="form-group col-sm-6">
                                        <select class="form-control validate[required]" 
                                                id="video_language" 
                                                name="video_language">
                                            <option value="">Select Video Language</option>
                                            <option value="1">English</option>
                                            <option value="2">বাংলা (Bengali)</option>
                                        </select>
                                        <div class="col-sm-12" id="video_language_error" style="color: red"><?php echo form_error('video_language'); ?></div>
                                    </div>



                                    <div class="form-group col-sm-6">
                                        <select class="form-control validate[required]"
                                                id="video_access_level"
                                                name="video_access_level"
                                                onchange="getVideoCourseAccessLevel(this.value)">
                                            <option value="">Select Access Level</option>
                                            <option value="1">Public</option>
                                            <option value="2">TalhaTraining User </option>
                                        </select>
                                        <div class="col-sm-12" id="video_access_level_error" style="color: red"><?php echo form_error('video_access_level'); ?></div>
                                    </div>
                                    <div class="col-sm-12"><br></div>









                                    <div class="form-group col-sm-6">
                                        <div class="input-group">
                                            <input type="text"
                                                   id="video_management_rating"
                                                   name="video_management_rating"
                                                   class="form-control validate[custom[checkRating]]" 
                                                   placeholder="Please Type Video Course Reating"
                                                   value="<?php echo set_value('video_management_rating'); ?>"
                                                   aria-describedby="basic-addon1">
                                            <span class="input-group-addon" id="basic-addon1" title="Please Type Course Reating"><i class="fa fa-star"></i></span>
                                        </div>
                                        <span id="video_management_rating_error" style="color: red;"><?php echo form_error('video_management_rating'); ?></span>
                                    </div>





                                    <div class="form-group col-sm-6">
                                        <div class="text-left padding-zero col-sm-4">  <label >Course Type  :  &nbsp;&nbsp;</label></div>
                                        <div class="radio radio-success col-sm-8 radio-margin">
                                            <input type="radio"
                                                   data-errormessage-value-missing="Please Select Vieeo Course Type" 
                                                   class="validate[required]" 
                                                   name="video_course_type" 
                                                   id="Free" 
                                                   value="2" 
                                                   onclick="getCourseType(this.value)">
                                            <label for="Free">Free</label>
                                            <span style="margin-right: 20px"></span>
                                            <input type="radio" 
                                                   data-errormessage-value-missing="Please Select Vieeo Course Type" 
                                                   class="validate[required]" 
                                                   name="video_course_type" 
                                                   id="Paid" 
                                                   value="1" 
                                                   onclick="getCourseType(this.value)">
                                            <label for="Paid">Paid</label>
                                        </div>
                                        <div class="col-sm-12" id="video_course_type_error" style="color: red"><?php echo form_error('video_course_type'); ?></div>
                                    </div>
                                    <div class="col-sm-12"><br></div>






                                    <div class="form-group col-sm-12 padding-zero" id="video_course_Price" style="display: none">
                                        <div class="form-group col-sm-6">
                                            <div class="input-group">
                                                <select data-errormessage-value-missing="Please Select Course Price Currency " 
                                                        class="form-control validate[required]" 
                                                        name="video_course_price_currency" 
                                                        id="video_course_price_currency" >
                                                    <option value="">Select Price Currency</option>
                                                    <option value="1">BDT</option>
                                                    <option value="2">USD</option>
                                                </select>
                                                <span class="input-group-addon" id="basic-addon1" title="Please select  Access Level"><i class="fa fa-user"></i></span>
                                            </div>
                                            <script>
                                                document.forms['add_video_course_form'].elements['video_course_price_currency'].value = '<?php echo set_value('video_course_price_currency'); ?>';</script>
                                            <span id="video_course_price_currency_error" style="color: red;"><?php echo form_error('video_course_price_currency'); ?></span>
                                        </div>



                                        <div class="form-group col-sm-6" >
                                            <div class="input-group">
                                                <input type="number"
                                                       id="video_course_price"
                                                       name="video_course_price"
                                                       class="form-control validate[required, custom[integer], custom[nonZeroValue]]" 
                                                       placeholder="Please Type Video Course Price"
                                                       value="<?php echo set_value('video_course_price'); ?>"
                                                       aria-describedby="basic-addon1">
                                                <span class="input-group-addon" id="basic-addon1" title="Please Type Video Course Price"><i class="fa fa-dollar"></i></span>
                                            </div>
                                            <span id="video_course_price_error" style="color: red;"><?php echo form_error('video_course_price'); ?></span>
                                        </div>
                                    </div>





                                    <div class="col-sm-12"><br></div>
                                    <div class="form-group col-sm-10">
                                        <label class="col-sm-1 text-left padding-zero" for="video_management_status"> Status : &nbsp;</label>
                                        <div class="radio radio-success col-sm-11 margin-zero" >
                                            <input type="radio"
                                                   data-errormessage-value-missing="Please Select Vieeo Course Status" 
                                                   class="validate[required]" 
                                                   name="video_management_status" 
                                                   id="published" 
                                                   value="1">
                                            <label for="published">Active</label>
                                            <span style="margin-right: 30px"></span>
                                            <input type="radio" 
                                                   data-errormessage-value-missing="Please Select Vieeo Course Status" 
                                                   class="validate[required]" 
                                                   name="video_management_status" 
                                                   id="unpublished" 
                                                   value="6">
                                            <label for="unpublishded">Inactive</label>
                                            <span style="margin-right: 30px"></span>
                                            <input type="radio"
                                                   data-errormessage-value-missing="Please Select Vieeo Course Status" 
                                                   class="validate[required]" 
                                                   name="video_management_status" 
                                                   id="archived" 
                                                   value="2">
                                            <label for="archived">Archived</label>
                                            <span style="margin-right: 30px"></span>
                                            <input type="radio" 
                                                   data-errormessage-value-missing="Please Select Vieeo Course Status" 
                                                   class="validate[required]" 
                                                   name="video_management_status" 
                                                   id="pending" 
                                                   value="3">
                                            <label for="pending">Pending</label>
                                            <span style="margin-right: 30px"></span>
                                            <input type="radio" 
                                                   data-errormessage-value-missing="Please Select Vieeo Course Status" 
                                                   class="validate[required]" 
                                                   name="video_management_status" 
                                                   id="approved" 
                                                   value="4">
                                            <label for="approved">Approved</label>
                                            <span style="margin-right: 30px"></span>
                                            <input type="radio" 
                                                   data-errormessage-value-missing="Please Select Vieeo Course Status" 
                                                   class="validate[required]" 
                                                   name="video_management_status" 
                                                   id="draft" 
                                                   value="5">
                                            <label for="draft">Draft</label>
                                            <span style="color: red;"><?php echo form_error('video_management_status'); ?></span>
                                        </div>
                                    </div>




                                    <div class="col-sm-12"><br><br></div>
                                    <div class="form-group col-sm-4 col-sm-offset-4">
                                        <button type="submit"
                                                class="green-btn btn btn-default">
                                            Add Video information
                                        </button>
                                    </div>
                                    <?php echo form_close(); ?>
                                </div>    

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

            </div>
        </div>


    </div>
    <br>
    <div class="row gray">
        <div class="col-sm-12 ">
            <label><a href="<?php echo base_url(); ?>super-admin">Dashboard </a> ->> <a href="<?php echo base_url() ?>manage-video-course">Manage Video Course </a>->>Add Video Course </label>
        </div>
    </div>
    <br> <br>
</div>
<script>
    checkVideoCourseURLExistsURL = '<?php echo base_url() . 'video-course-url-exists' ?>';
</script>
<script type="text/javascript" src="<?php echo base_url(); ?>back_end_resource/video_course/video_course.js">
</script>
<script type="text/javascript">
    document.forms['add_video_course_form'].elements['menu_id'].value = '<?php echo set_value('menu_id'); ?>';
    document.forms['add_video_course_form'].elements['course_category_id'].value = '<?php echo set_value('course_category_id'); ?>';
    document.forms['add_video_course_form'].elements['resource_person_id'].value = '<?php echo set_value('resource_person_id'); ?>';
    document.forms['add_video_course_form'].elements['video_management_level'].value = '<?php echo set_value('video_management_level'); ?>';
    document.forms['add_video_course_form'].elements['video_language'].value = '<?php echo set_value('video_language'); ?>';
    document.forms['add_video_course_form'].elements['video_access_level'].value = '<?php echo set_value('video_access_level'); ?>';
    document.forms['add_video_course_form'].elements['video_course_type'].value = '<?php echo set_value('video_course_type'); ?>';
    document.forms['add_video_course_form'].elements['video_management_status'].value = '<?php echo set_value('video_management_status'); ?>';
    getVideoCourseAccessLevel('<?php echo set_value('video_access_level'); ?>');
    getCourseType('<?php echo set_value('video_course_type'); ?>');

</script>
