<script type="text/javascript" src="<?php echo base_url(); ?>back_end_resource/manage_admin_video/add_admin_video.js"></script>
<input type="hidden" id="baseUrl" value="<?php echo base_url(); ?>">
<div class="col-sm-10">
    <div class="row gray_ttc">
        <div class="col-sm-12 row"><br>
            <nav class="text-justify">
                <div class="col-sm-12" style="padding: 0">
                    <span class="col-sm-4 col-sm-offset-4" title="Video Information" style="padding: 0">
                        <span class="text-left label" style="color: #8CC73F;font-size: 18px; font-family: Times New Roman; font-weight: bold">Update Video Information</span>
                    </span>
                </div>
            </nav>
        </div>
        <div class="col-sm-12"><hr></div>
        <div class="col-sm-12"><br></div>
        <div class="col-sm-12">
        <?php
            $url = 'edit-admin-video/'.$encrypt_data.'/'.$section_id;
            echo form_open_multipart($url, 'class="cmxform"  name="add_admin_video_form"');
        ?>
        <div class="col-sm-12" id="add_video_area" >
            <div class="col-sm-10 padding-zero white" style="margin-left: 10px;">
            <div class="col-sm-12"><br></div>
        <!-- ---------Video Course Upload Video Title Start---------- -->    
                <div class="form-group col-sm-10">
                    <div class="form-group col-sm-12">
                        <div class="input-group">
                            <input type="text" 
                                   class="form-control"
                                   id="manage_video_title<?php echo $video_counter; ?>"
                                   name="manage_video_title<?php echo $video_counter; ?>"
                                   value="<?php echo $manage_video[0]->manage_video_title; ?>"
                                   onkeyup ="checkError('manage_video_title<?php echo $video_counter; ?>','<?php echo $video_counter; ?>' )"
                                   placeholder=" Please Type Video Title.." >
                            <span class="input-group-addon"><i class="fa fa-file"></i></span>
                        </div>
                        <span style="color: red;" id="manage_video_title_error<?php echo $video_counter; ?>"></span>
                    </div>
                </div>
                <div class="col-sm-12"><br></div>
        <!-- ---------Video Course Upload Video Title End---------- -->    


        <!-- ---------Video Course Upload Video File Start---------- -->   
                <div class="form-group col-sm-12">
                    <div class="col-sm-7">
                        <input tabindex = "-1"
                               style = "position: absolute; clip: rect(0px, 0px, 0px, 0px);"
                               id="videoFile_video<?php echo $video_counter; ?>"
                               data-icon = "false" type = "file" value = ""
                               onchange="getVideoFile(this, '<?php echo $video_counter; ?>', '<?php echo base_url() . 'upload-admin-video' ?>')" >
                        <div class = "bootstrap-filestyle input-group">
                            <input class = "form-control " disabled type = "text" 
                                   id="view_video_file_name<?php echo $video_counter; ?>" value="">
                            <span tabindex = "0" class = "group-span-filestyle input-group-btn">
                                <label for = "videoFile_video<?php echo $video_counter; ?>" class = "btn btn-default ">
                                    <span class = "buttonText">Choose file</span>
                                </label>
                            </span>
                        </div>
                        <span class="pull-left" id="manage_upload_video_error<?php echo $video_counter; ?>" 
                              style="color: red">
                            <span style="color: black;"><label>[ Upload Video ]</label></span>
                        </span>
                    </div>

                    <div class="col-sm-5"> 
                        <div id="uploadVideoFileName<?php echo $video_counter; ?>" style="display:block;">
                            <?php
                            $video_name = substr(strrchr($manage_video[0]->manage_video_location, '/'), 1);
                            $file_basename = substr($video_name, 0, strripos($video_name, '.')); 
                            $file_ext = substr($video_name, strripos($video_name, '.')); 
                            $final_video_name = substr( $file_basename, 0, -35 );
                            if(isset($final_video_name)){
                                echo mb_strimwidth($final_video_name.$file_ext, 0, 46, "...");
                            }             
                            ?>
                        </div>
                        <div class="progress" id="progressID_video<?php echo $video_counter; ?>" style="display: none">
                            <div class="progress-bar progress-bar-success progress-bar-striped"
                                 id="videoProgressBar_video<?php echo $video_counter; ?>"
                                 role="progressbar"
                                 aria-valuenow="90" 
                                 aria-valuemin="0" aria-valuemax="100" 
                                 style="">
                            </div>
                        </div>

                        <div id="processing_image<?php echo $video_counter; ?>" style="display:none">
                            <span>Processing</span>
                            <img src="<?php echo base_url('image/ajaxloader.gif') ?>" style="max-width: 35px;">
                        </div>
                    </div>
                    <div class="col-sm-12" style="color: green;" id="view_file_size_video<?php echo $video_counter; ?>"></div>
                </div>
                <div class="col-sm-12"></div>
        <!-- ---------Video Course Upload Video File End---------- -->   


        <!-- ---------Video Course Upload Video Payment Type Start---------- -->   
                <div class="form-group col-sm-6">
                    <div class="form-group col-sm-7 text-left" style="margin-top: 10px">  <label >Video Payment Type  :</label></div>
                    <div class="form-group radio radio-success col-sm-5">
                        <input  type="radio" 
                                name="manage_video_payment_type[<?php echo $video_counter; ?>]" 
                                id="free" value="1" 
                                <?php if($manage_video[0]->manage_video_payment_type == 1){?>checked<?php } ?>>
                        <label for="free">Free</label>
                        <span style="margin-right: 30px"></span>
                        <input  type="radio" 
                                name="manage_video_payment_type[<?php echo $video_counter; ?>]" 
                                id="paid" 
                                value="2"
                                <?php if($manage_video[0]->manage_video_payment_type == 2){?>checked<?php } ?>>
                        <label for="paid">Paid</label>
                    </div>
                </div>
        <!-- ---------Video Course Upload Video Payment Type End---------- -->   


        <!-- ---------Video Course Upload Video Work FIle Status Start---------- -->   
                <div class="form-group col-sm-6">
                    <div class="form-group col-sm-5 text-left" style="margin-top: 10px">  <label > Work files  :</label></div>
                    <div class="form-group radio radio-success col-sm-7"  >
                        <input  onclick="getWorkFileStatus(this.value, '<?php echo $video_counter; ?>')" 
                                type="radio" 
                                name="manage_video_work_file[<?php echo $video_counter; ?>]" 
                                id="yes" 
                                value="1" 
                                <?php if($manage_video[0]->manage_video_work_file == 1){?>checked<?php } ?>>
                        <label for="yes">Yes</label>
                        <span style="margin-right: 30px"></span>
                        <input  onclick="getWorkFileStatus(this.value, '<?php echo $video_counter; ?>')" 
                                type="radio" 
                                name="manage_video_work_file[<?php echo $video_counter; ?>]" 
                                id="no" 
                                value="2"
                                <?php if($manage_video[0]->manage_video_work_file == 2){?>checked<?php } ?>>
                        <label for="no">No</label>
                    </div>
                    <span style="color: red;" id="manage_video_work_file_error<?php echo $video_counter; ?>"></span>
                </div>
                <div class="col-sm-12"></div>
        <!-- ---------Video Course Upload Video Work File Status End---------- -->   

                <div class="col-sm-12" id="work_file_video_<?php echo $video_counter; ?>" name="work_file_video_<?php echo $video_counter; ?>" style="<?php if($manage_video[0]->manage_video_work_file == 2){?>display: none<?php } ?>">
                    <input type="hidden" id="work_file_id<?php echo $video_counter; ?>" name="work_file_id<?php echo $video_counter; ?>" value="<?php if(isset($work_files)){ echo $work_files->work_file_id; } ?>">
                    <!-- ---------Video Course Upload Video Work File Name Start---------- -->   
                    <div class="form-group col-sm-10">
                        <div class="input-group">
                            <input type="text" 
                                   class="form-control"
                                   id="work_file_name<?php echo $video_counter; ?>"
                                   name="work_file_name<?php echo $video_counter; ?>"
                                   onkeyup ="checkError('work_file_name<?php echo $video_counter; ?>','<?php echo $video_counter; ?>' )"
                                   placeholder="Please Type Work File Name"  
                                   value="<?php if(isset($work_files)){ echo $work_files->work_file_name; } ?>">
                            <span class="input-group-addon "  title="Please Type Work File Name"><i class="fa fa-file"></i></span>
                        </div>
                        <span style="color: red;" id="work_file_name_error"><?php //echo form_error('work_file_name');  ?></span>
                    </div>
                    <div class="col-sm-12"><br></div>
                    <!-- ---------Video Course Upload Video Work File Name End---------- --> 


                    <!-- ---------Video Course Upload Video Work File Browse Start---------- -->   
                    <div class="col-sm-7"> 
                        <input tabindex = "-1"
                               style = "position: absolute; clip: rect(0px, 0px, 0px, 0px);"
                               id="work_file<?php echo $video_counter; ?>"
                               data-icon = "false" type = "file" value = ""
                               onchange="getAdminVideoWorkFile(this, '<?php echo $video_counter; ?>', '<?php echo base_url() . 'upload-admin-video-work-file' ?>')" >
                        <div class = "bootstrap-filestyle input-group">
                            <input class = "form-control " disabled type = "text" 
                                   id="view_work_file_name<?php echo $video_counter; ?>" value="">
                            <span tabindex = "0" class = "group-span-filestyle input-group-btn">
                                <label for = "work_file<?php echo $video_counter; ?>" class = "btn btn-default ">
                                    <span class = "buttonText">Choose file</span>
                                </label>
                            </span>
                        </div>
                        <span class="pull-left" id="manage_upload_video_work_file_error<?php echo $video_counter; ?>" 
                              style="color: red">
                        <span ><label style="color: #666;">[ Upload work file ]</label></span>
                        </span>
                    </div>
                    <div class="col-sm-5"> 
                        <div id="uploadWorkfileName<?php echo $video_counter; ?>" style="display:block;">
                            <?php
                            if(isset($work_files)){ 
                                $work_file_name = substr(strrchr($work_files->work_file_location, '/'), 1);
                                if(isset($work_file_name)){
                                    echo $work_file_name;
                                } 
                            }
                            ?>
                        </div>
                        <div class="progress" id="progressID_work_file<?php echo $video_counter; ?>" style="display: none">
                            <div class="progress-bar progress-bar-success progress-bar-striped"
                                 id="progressBar_work_file<?php echo $video_counter; ?>"
                                 role="progressbar"
                                 aria-valuenow="90" 
                                 aria-valuemin="0" aria-valuemax="100" 
                                 style="">
                            </div>
                        </div>

                        <div id="processing_image_work_file<?php echo $video_counter; ?>" style="display:none">
                            <span>Processing</span>
                            <img src="<?php echo base_url('image/ajaxloader.gif') ?>" style="max-width: 35px;">
                        </div>
                    </div>
                    <div class="col-sm-12"><br></div>
                    <!-- ---------Video Course Upload Video Work File Browse End---------- --> 


                    <!-- ---------Video Course Upload Video Work File Payment Type Start---------- -->   
                    <div class="form-group col-sm-6">
                        <div class="form-group col-sm-7 text-left pull-Left" style="margin-top: 10px">  <label >Work File Payment Type  :</label></div>
                        <?php if($manage_video[0]->manage_video_payment_type == 1){ ?>
                                <div class="form-group radio radio-success col-sm-5">
                                    <input  type="radio" 
                                            name="work_file_payment_type[<?php echo $video_counter; ?>]" 
                                            id="free" value="1" checked>
                                    <label for="Free">Free</label>
                                </div>

                        <?php
                            }else{
                        ?>
                                <div class="form-group radio radio-success col-sm-5">
                                    <input  type="radio" 
                                            name="work_file_payment_type[<?php echo $video_counter; ?>]" 
                                            id="free" value="1" 
                                            <?php if(isset($work_files)){ if($work_files->work_file_payment_type == 1){?>checked<?php } } ?>>
                                    <label for="Free">Free</label>
                                    <span style="margin-right: 30px"></span>
                                    <input  type="radio" 
                                            name="work_file_payment_type[<?php echo $video_counter; ?>]" 
                                            id="paid" 
                                            value="2"
                                            <?php if(isset($work_files)){ if($work_files->work_file_payment_type == 2){?>checked<?php } } ?>>
                                    <label for="Paid">Paid</label>
                                </div>
                        <?php } ?>
                        <span style="color: red;" id="work_file_payment_type_error"><?php //echo form_error('work_file_payment_type');  ?></span>
                    </div>
                    <div class="col-sm-12"></div>
                    <!-- ---------Video Course Upload Video Work File Payment Type End---------- --> 
                </div>

        <!-- ---------Video Course Upload Video Status Start---------- -->   
                <div class="form-group col-sm-6">
                    <div class="form-group col-sm-5 text-left" style="margin-top: 10px">  <label>Video Status  :</label></div>
                    <div class="form-group radio radio-success col-sm-7">
                        <input  type="radio" 
                                name="manage_video_status[<?php echo $video_counter; ?>]" 
                                id="active" 
                                onclick="checkManageVideoName(this.value, '<?php echo $video_counter; ?>')"
                                value="1" 
                                <?php if($manage_video[0]->manage_video_status == 1){?>checked<?php } ?>>
                        <label for="active">Active</label>
                        <span style="margin-right: 30px"></span>
                        <input  type="radio" 
                                name="manage_video_status[<?php echo $video_counter; ?>]" 
                                id="draft" 
                                onclick="checkManageVideoName(this.value, '<?php echo $video_counter; ?>')"
                                value="2"
                                <?php if($manage_video[0]->manage_video_status == 2){?>checked<?php } ?>>
                        <label for="draft">Draft</label>
                    </div>
                    <span style="color: red;" id="manage_video_status_error"><?php //echo form_error('manage_video_status');  ?></span>
                </div>
                <div class="col-sm-12"><br></div>
        <!-- ---------Video Course Upload Video Status End---------- -->   
            </div>
        </div>
        <div class=" col-sm-12"><br></div>
        <div class="col-sm-4">
            <div class="form-group col-sm-6 pull-right">
                <input type="hidden"
                    name="all_video_form_counter"
                    id="allVideoFormCounter" value="<?php echo $video_counter; ?>">
                <input type="hidden" 
                       id="manage_video_id<?php echo $video_counter; ?>" 
                       name="manage_video_id<?php echo $video_counter; ?>" value="<?php echo $manage_video[0]->manage_video_id; ?>">
                <input type="hidden" 
                       id="all_work_file_id" 
                       name="all_work_file_id" value="">
            </div>
        </div>
        <div class="col-sm-8">
            <div class="form-group col-sm-6 pull-Left">
                <input type="submit" 
                   class="btn btn-sm btn-success" 
                   id="update_video_workfile"
                   name="update_video_workfile"
                   title="Update Video/Workfile"
                   value="&#xf03d;"
                   style="font-family: fontawesome">
            </div>
        </div>
        <?php echo form_close(); ?>
        </div>
    </div>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>back_end_resource/manage_admin_video/add_admin_video.js"></script>
<link href="<?php echo base_url();?>back_end_resource/manage_admin_video/add_admin_video.css" rel="stylesheet" type="text/css"/>