<?php //echo validation_errors(); ?>
<div class="col-sm-8 ">
    <div class="row gray_ttc">
        <div class="col-sm-12 row"><br>
            <nav class="text-justify">
                <center>
                    <div class="col-sm-12" style="padding: 0">
                        <span class="clo-sm-4" title="Video Management Information" style="padding: 0">
                            <span class="text-left label" style="color: #000;font-size: 16px;font-weight: normal">Update Video Information</span>
                        </span>
                    </div>
                </center>
            </nav>
        </div>

        <div class="col-sm-12"><br><br></div>
        <div class="col-sm-12">
            <div class="col-sm-12">
                <?php
//                echo validation_errors(); //id="formID2" 
                $url = 'edit-video-management/' . $video_course_info->url;
                echo form_open_multipart($url, 'class="" id="formID3" name="updateVideoForm"');
                ?>
                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Course Category is Required!" 
                            class="form-control" 
                            name="course_category_id"
                            id="course_category_id" 
                            onchange="otherCategory();"
                            title="Course Category">
                        <option value="">Select Category</option>
                        <?php
                        foreach ($all_course_category as $category_value) {
                            ?>
                            <option value="<?php echo $category_value->course_category_id; ?>"><?php echo $category_value->course_category_name; ?></option>
                            <?php
                        }
                        ?>
<!--                        <option value="other">Other Category</option>-->
                    </select>
                    <span id="course_category_id_message" style="color:red;"><?php echo form_error('course_category_id'); ?></span>
                    <script>
                        document.forms['updateVideoForm'].elements['course_category_id'].value = '<?php
                        if (set_value('course_category_id')) {
                            echo set_value('course_category_id');
                        } else {
                            echo $video_course_info->course_category_id;
                        }
                        ?>';
                    </script>
                </div>
<!--                <input type="hidden" name="feature_price_status" id="feature_price_status" value="<?php //echo $feature_price_status; ?>">-->



                <div class="form-group col-sm-6"  id="other_course_category" style="display: none">
                    <input type="text" 
                           data-errormessage-value-missing="Category Name is required!" 
                           class="form-control" 
                           id="course_category_name" 
                           name="course_category_name" 
                           maxlength="150"
                           oninput="checkCourseCategory(this.value,'<?php echo base_url() . 'check-course-category'; ?>')"
                           placeholder="Please Enter Category Name"  
                           value="<?php echo set_value('course_category_name'); ?>"
                           title="New Category Name">
                    <input type="hidden" name="course_category_name_exist" id="course_category_name_exist" value="">
                    <span id="course_category_name_message" style="color:red;"><?php echo form_error('course_category_name'); ?></span>
                </div>



                <div class="col-sm-12"><br></div>
                <div class="form-group col-sm-6">
                    <div class="input-group">
                        <input type="text"
                               data-errormessage-value-missing="Video Folder Name is Required"
                               class="form-control "
                               name="video_folder_name" 
                               id="video_folder_name"
                               oninput="getVideoFolderName(this.value,'<?php echo base_url() . 'check-video-folder-name'; ?>','<?php echo $video_course_info->video_folder_name ?>')"
                               value="<?php
                               if (set_value('video_folder_name')) {
                                   echo set_value('video_folder_name');
                               } else {
                                   echo $video_course_info->video_folder_name;
                               }
                               ?>"
                               placeholder="Please Type Folder Name.." 
                               <?php
                              
                                   echo 'readonly=""';
                               
                               ?>
                               aria-describedby="basic-addon1">
                        <span class="input-group-addon" id="basic-addon1" title="Please Type Folder Name"><i class="fa fa-folder"></i></span>
                    </div>
                    <input type="hidden" id="video_name_exixts" value="">
                    <span id="video_folder_name_message" style="color:red;"><?php echo form_error('video_folder_name'); ?></span>
                </div>




                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Video Course Level is Required!" 
                            class="form-control" 
                            name="video_management_level" id="video_management_level"
                            title="Video Management Level">
                        <option value="">Select Course Level</option>
                        <option value="0">Any</option>
                        <option value="1">Basic</option>
                        <option value="2">Intermediate</option>
                        <option value="3">Advance</option>
                    </select>
                    <span id="video_management_level_message" style="color:red;"><?php echo form_error('video_management_level'); ?></span>
                    <script>
                        document.forms['updateVideoForm'].elements['video_management_level'].value = '<?php
                               if (set_value('video_management_level')) {
                                   echo set_value('video_management_level');
                               } else {
                                   echo $video_course_info->video_management_level;
                               }
                               ?>';
                    </script>
                </div>
                <div class="col-sm-12"><br></div>





                <div class="form-group col-sm-12">
                    <div class="input-group">
                        <input type="text" 
                               data-errormessage-value-missing="Video Title is Required"
                               class="form-control tokenize-sample" 
                               name="video_course_title" 
                               id="video_course_title"
                               value="<?php
                               if (set_value('video_course_title')) {
                                   echo set_value('video_course_title');
                               } else {
                                   echo $video_course_info->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>
                    <span id="video_course_title_message" style="color:red;"><?php echo form_error('video_course_title'); ?></span>
                </div>
                <div class="col-sm-12"><br></div>



                <div class="form-group col-sm-6">
                    <div class="input-group">
                        <input type="text" 
                               data-errormessage-value-missing="Video Course Url is Required!" 
                               class="form-control"
                               id="video_course_url" 
                               name="video_course_url" 
                               oninput="getUrlValue1(this.value,'<?php echo base_url() . 'video-url-existance'; ?>','<?php echo $video_course_info->url ?>')"
                               value="<?php
                               if (set_value('video_course_url')) {
                                   echo set_value('video_course_url');
                               } else {
                                   echo $video_course_info->url;
                               }
                               ?>"
                               title="Video Course Url"
                               placeholder="Please Type Video Course URL.." aria-describedby="basic-addon1"
                               maxlength="100">
                        <span class="input-group-addon" id="basic-addon1" title="Please Type Video Course URL"><i class="fa fa-link"></i></span>
                    </div>
                    <input type="hidden" id="video_url_exist" value="">
                    <span id="video_course_url_message" style="color:red;"><?php echo form_error('video_course_url'); ?></span>
                </div>
                <div class="form-group col-sm-12"></div>



                <?php if ($person_info->person_role == 4) { ?>
                    <div class="form-group col-sm-6">
                        <select data-errormessage-value-missing="Resource person is Required!" 
                                class="form-control" 
                                name="resource_person_id" 
                                id="resource_person_id" 
                                title="Resource person">
                            <option value="">Select Resource Person</option>
                            <?php foreach ($all_resource_person as $resource_person_value) { ?>
                                <option value="<?php echo $resource_person_value->resource_person_id; ?>"><?php echo $resource_person_value->person_first_name . ' ' . $resource_person_value->person_last_name; ?></option>
                            <?php } ?>
                        </select>
                        <span id="resource_person_id_message" style="color:red;"><?php echo form_error('resource_person_id'); ?></span>
                    </div>

                    <script>
                        document.forms['updateVideoForm'].elements['resource_person_id'].value = '<?php 
                        if(set_value('resource_person_id')){
                            echo set_value('resource_person_id');
                        }else{
                            echo $video_course_info->resource_person_id;
                        }
                        ?>';
                    </script>
                <?php } ?>


                <!--                <div class="form-group col-sm-6">
                                    <div class=" col-sm-12" style="padding: 0">
                                        <label class="col-xs-4 col-sm-4  text-left" style="padding: 0">Course type: </label>
                                        <div  class="col-xs-8 col-sm-8 radio radio-success" style="margin: 0">
                                            <input data-errormessage-value-missing="Course Type is Required!" 
                                                   class="validate[required,custom[checkVideoCourseType]] text-input radio" 
                                                   type="radio" 
                                                   name="video_course_type" 
                                                   id="paid" 
                                                   value="1" 
                                                   onclick="getVideoCourseType(this.value, '<?php // echo $feature_price_status;   ?>')">
                                            <label for="paid">Paid</label>
                                            <span style="margin-right: 30px"></span>
                                            <input  data-errormessage-value-missing="Course Type is Required!" 
                                                    class="validate[required] text-input radio"  
                                                    type="radio" 
                                                    name="video_course_type" 
                                                    id="free" 
                                                    value="2" 
                                                    onclick="getVideoCourseType(this.value, '<?php // echo $feature_price_status;   ?>')">
                                            <label for="free">Free</label>
                                            <div id="access_type_error"style="color: red"><?php // echo form_error('video_course_type');   ?></div>
                                        </div>
                                        <input type="hidden" id="hidden_access_type" value="">
                                    </div>
                                    <script>
                                        document.forms['updateVideoForm'].elements['video_course_type'].value = '<?php
//                               if (set_value('video_course_type')) {
//                                   echo set_value('video_course_type');
//                               } else {
//                                   echo $video_course_info->video_course_type;
//                               }
                ?>';
                                    </script>
                                </div>-->




                <!--                <div class="form-group col-sm-6">
                                    <div style="display:none;" id="course_price_view">
                                        <div class="col-sm-5">
                                            <select class="form-control"
                                                    name="video_course_price_currency" id="video_course_price_currency">
                                                <option value="1">BDT</option>
                                                <option value="2">USD</option>
                                            </select>
                
                                            <script>
                                                document.forms['updateVideoForm'].elements['video_course_price_currency'].value = '<?php
//                               if (set_value('video_course_price_currency')) {
//                                   echo set_value('video_course_price_currency');
//                               } else {
//                                   echo $video_course_info->video_course_price_currency;
//                               }
                ?>';
                                            </script>
                                        </div>
                                        <div class="input-group">
                                            <input type="text" 
                                                   data-errormessage-value-missing="Course Price is Required!" 
                                                   class="form-control validate[required, custom[coursePriceValue], custom[checkCoursePrice], custom[number], custom[nonZeroValue]] text-input" 
                                                   id="video_course_price" 
                                                   name="video_course_price"  
                                                   value="<?php
//                                   if (set_value('video_course_price')) {
//                                       echo set_value('video_course_price');
//                                   } else {
//                                       echo $video_course_info->video_course_price;
//                                   }
                ?>"
                                                   maxlength="10" title="Video Course Price"
                                                   placeholder="Set Course Price" >
                                            <span class="input-group-addon" id="basic-addon1" title="Video course price"><i class="fa fa-usd"></i></span>
                                        </div>
                                    </div>
                                    <div id="pricing_view" style="display: none;">
                                        <span style="color: red;">Please update your account to create paid course</span>
                                        <a href="<?php // echo base_url() . 'pricing'   ?>" target="blank" class="btn btn-success" title="Update Account">
                                            <i class="fa fa-arrow-up"></i>
                                        </a>
                                    </div>
                                </div>-->

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

                <div class="form-group col-sm-12" >
                    <div class="input-group text-left screen1280" id="" >
                        <label>Video Training Objective</label>
                        <textarea class="form-control  resoulation1280" 
                                  name="video_training_objectives[]" 
                                  id="video_training_objectives"  
                                  placeholder="Video Training Objective" ><?php
                                      if (set_value('video_training_objectives')) {
                                          echo set_value('video_training_objectives');
                                      } else {
                                          echo $video_course_info->video_training_objectives;
                                      }
                                      ?></textarea>
                    </div>

                    <div class="input-group screen1024" id="" >
                        <label>Video Training Objective</label>
                        <textarea class="form-control resoulation1024 " 
                                  name="video_training_objectives[]" 
                                  rows="4" placeholder="Video Training Objective"><?php
                                      if (set_value('video_training_objectives')) {
                                          echo set_value('video_training_objectives');
                                      } else {
                                          echo $video_course_info->video_training_objectives;
                                      }
                                      ?></textarea>
                    </div>

                    <div class="input-group screenMobile" id="" >
                        <label>Video Training Objective</label>
                        <textarea class="form-control  resoulationMobile " 
                                  name="video_training_objectives[]" 
                                  rows="4"   placeholder="Video Training Objective" ><?php
                                      if (set_value('video_training_objectives')) {
                                          echo set_value('video_training_objectives');
                                      } else {
                                          echo $video_course_info->video_training_objectives;
                                      }
                                      ?></textarea>
                    </div>

                    <div class="input-group screenMobile_max499" id="" >
                        <label>Video Training Objective</label>
                        <textarea class="form-control  resoulationMobile_max499 "
                                  name="video_training_objectives[]" 
                                  rows="4"   placeholder="Video Training Objective"  ><?php
                                      if (set_value('video_training_objectives')) {
                                          echo set_value('video_training_objectives');
                                      } else {
                                          echo $video_course_info->video_training_objectives;
                                      }
                                      ?></textarea>
                    </div>
                </div>

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

                <div class="form-group text-left col-sm-12">
                    <div class="input-group screen1280" id="">
                        <label>Video Training Outline</label>
                        <textarea class="form-control  resoulation1280 "  
                                  name="video_training_outline[]"
                                  placeholder="Video Training Outline" ><?php
                                      if (set_value('video_training_outline')) {
                                          echo set_value('video_training_outline');
                                      } else {
                                          echo $video_course_info->video_training_outline;
                                      }
                                      ?></textarea>
                    </div>

                    <div class="input-group screen1024" id="" >
                        <label>Video Training Outline</label>
                        <textarea   class="form-control  resoulation1024 " 
                                    name="video_training_outline[]"
                                    rows="4"   placeholder="Video Training Outline"  ><?php
                                        if (set_value('video_training_outline')) {
                                            echo set_value('video_training_outline');
                                        } else {
                                            echo $video_course_info->video_training_outline;
                                        }
                                        ?></textarea>
                    </div>
                    <div class="input-group screenMobile" id="" >
                        <label>Video Training Outline</label>
                        <textarea   class="form-control  resoulationMobile " 
                                    name="video_training_outline[]"
                                    rows="4"   placeholder="Video Training Outline"  ><?php
                                        if (set_value('video_training_outline')) {
                                            echo set_value('video_training_outline');
                                        } else {
                                            echo $video_course_info->video_training_outline;
                                        }
                                        ?></textarea>
                    </div>

                    <div class="input-group screenMobile_max499" id="" >
                        <label>Video Training Outline</label>
                        <textarea   class="form-control  resoulationMobile_max499 " 
                                    name="video_training_outline[]" 
                                    id="video_training_outline"
                                    rows="4"   placeholder="Video Training Outline"  ><?php
                                        if (set_value('video_training_outline')) {
                                            echo set_value('video_training_outline');
                                        } else {
                                            echo $video_course_info->video_training_outline;
                                        }
                                        ?></textarea>
                    </div>
                </div>

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

                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Course Language is Required!" 
                            class="form-control"   
                            name="video_language" 
                            id="video_language" 
                            title="Video Language">
                        <option value="">Select Language</option>
                        <option value="1">English</option>
                        <option value="2">বাংলা(Bengali)</option>
                    </select>
                    <span id="video_language_message" style="color:red;"><?php echo form_error('video_language'); ?></span>
                    <script>
                        document.forms['updateVideoForm'].elements['video_language'].value = '<?php
                            if (set_value('video_language')) {
                                echo set_value('video_language');
                            } else {
                                echo $video_course_info->video_language;
                            }
                                        ?>';
                    </script>
                </div>



                <div class="form-group col-sm-6">
                    <select data-errormessage-value-missing="Access Level is Required!" 
                            class="form-control"   
                            name="video_access_level" 
                            id="video_access_level" 
                            onchange="getAccessLevel(this.value);"
                            title="Video Access Level">
                        <option value="">Select Access Level</option>
                        <option value="1">Public</option>
                        <option value="2">TalhaTraining User</option>
                        <?php
                        if ($person_info->person_role == 3) {
                            if ($resource_person_info->resource_person_type == 2) {
                                ?>
                                <option value="3">My Link</option>
                                <option value="4">Only Group</option>
                                <option value="5">Special User</option>
                                <?php
                            }
                        } else {
                            ?>
                            <option value="3">My Link</option>
                            <option value="4">Only Group</option>
                            <option value="5">Special User</option>
                            <?php
                        }
                        ?>
                    </select>
                    <script>
                        document.forms['updateVideoForm'].elements['video_access_level'].value = '<?php
                        if (set_value('video_access_level')) {
                            echo set_value('video_access_level');
                        } else {
                            echo $video_course_info->video_access_level;
                        }
                        ?>';
                    </script>
                    <div class="col-sm-12" 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-12 padding-zero" id="group_div" style="display: none;">
                    <div class="form-group col-sm-12">
                        <div class="input-group">
                            <input type="text"
                                   id="search_group_name"
                                   name="search_group_name"
                                   class="form-control" 
                                   placeholder="Search Group Name..."
                                   oninput="getSearchGroupName('<?php echo base_url() . 'get-front-end-group-name' ?>',this.value)"
                                   value=""
                                   aria-describedby="basic-addon1">
                            <span class="input-group-addon" id="basic-addon1" title="Please Search Group Name"><i class="fa fa-book"></i></span>
                        </div>
                        <span id="search_group_name_error" style="color: red;"><?php echo form_error('hidden_search_group_name'); ?></span>
                    </div>
                    <input type="hidden" id="hidden_search_group_name" name="hidden_search_group_name" value="<?php
                    if ($video_course_info->video_access_level == 4) {
                        if (set_value('hidden_search_group_name')) {
                            echo set_value('hidden_search_group_name');
                        } else {
                            echo $selected_group->group_id;
                        }
                    }
                    ?>">
                </div>



                <div class="form-group col-sm-12 padding-zero" id="special_user_div" style="display: none;">
                    <div class="form-group col-sm-12">
                        <div class="input-group">
                            <input type="text"
                                   id="search_special_user_name"
                                   name="search_special_user_name"
                                   class="form-control" 
                                   placeholder="Search special_user..."
                                   oninput="getSearchSpecialUser('<?php echo base_url() . 'front-end-special-user-name' ?>',this.value)"
                                   value=""
                                   aria-describedby="basic-addon1">
                            <span class="input-group-addon" id="basic-addon1" title="Please Search Special User Name"><i class="fa fa-book"></i></span>
                        </div>
                        <span id="search_special_user_name_error" style="color: red;"><?php echo form_error('hidden_special_user_name'); ?></span>
                    </div>
                    <input type="hidden" id="hidden_special_user_name" name="hidden_special_user_name" value="<?php
                    if ($video_course_info->video_access_level == 5) {
                        if (set_value('hidden_special_user_name')) {
                            echo set_value('hidden_special_user_name');
                        } else {
                            echo $selected_special_uesr->person_id;
                        }
                    }
                    ?>">
                </div>

                <div class="form-group col-sm-12" id="check_checkbox_name_div" style="display: none;"></div>




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

                <div class="form-group col-sm-2 col-sm-offset-5">
                    <input type="submit" class="green-btn btn btn-default" value="Update"><br/><br/>
                </div>

                <?php echo form_close(); ?>
            </div>
        </div>
        <!--</div>-->
    </div>
</div>

<script type="text/javascript" src="<?php echo base_url()?>front_end_resource/video_course/video_course.js">
</script>
<script>
    getVideoCourseType('<?php
                if (set_value('video_course_type')) {
                    echo set_value('video_course_type');
                } else {
                    echo $video_course_info->video_course_type;
                }
                ?>', '<?php echo $feature_price_status; ?>');
    getAccessLevel('<?php
                if (set_value('video_access_level')) {
                    echo set_value('video_access_level');
                } else {
                    echo $video_course_info->video_access_level;
                }
                ?>');
</script>
<?php
if ($video_course_info->video_access_level == 4) {
    if (set_value('hidden_search_group_name')) {
        ?>
        <script>
            groupList = '<?php echo set_value('hidden_search_group_name'); ?>'.split(',');
            getSearchGroupName('<?php echo base_url() . 'get-front-end-group-name' ?>', '');
        </script>
    <?php } else { ?>
        <script>
            groupList = '<?php echo $selected_group->group_id; ?>'.split(',');
            getSearchGroupName('<?php echo base_url() . 'get-front-end-group-name' ?>', '');
        </script>
        <?php
    }
} else {
    ?>
    <?php if (set_value('hidden_special_user_name')) { ?>
        <script>
            personList = '<?php echo set_value('hidden_special_user_name'); ?>'.split(',');
            getSearchSpecialUser('<?php echo base_url() . 'front-end-special-user-name' ?>', '');
        </script>
    <?php } else { ?>
        <script>
            personList = '<?php echo $selected_special_uesr->person_id; ?>'.split(',');
            getSearchSpecialUser('<?php echo base_url() . 'front-end-special-user-name' ?>', '');
        </script>
        <?php
    }
}