<div class="col-sm-10">
    <div class="row gray">
        <div class="course-detail-tab margin-zero ">
            <h3 style="padding-left: 10px">Update Course Work File</h3>
            <div id="my-tab-content" class="tab-content">
                <!--Work file-->    
                <div id="add_work_file">
                    <div class="tab-content panel-body">
                        <?php
                        $url = 'admin/course/save-work-file';
                        echo form_open_multipart($url, 'name="edit_course_work_form"');
                        ?>
                        <div class="col-sm-12  "><br></div>
                        <div class="col-sm-10 col-sm-offset-1" style="padding: 0;display: block;"><br> 
                            <div class="col-sm-12 padding-zero white" ><br>


                                <div class="form-group col-sm-10">
                                    <div class="input-group">
                                        <select class="form-control"
                                                name="course_id" 
                                                id="course_id">
                                            <option value="<?php echo $course_info->url; ?>"><?php echo $course_info->course_name; ?></option>
                                        </select>
                                        <span class="input-group-addon" id="basic-addon1"><i class="fa fa-book"></i></span>
                                    </div>
                                    <input type="hidden" id="baseUrl" value="<?php echo base_url() ?>">
                                    <input type="hidden" id="course_url" name="course_url" value="<?php echo $course_info->url; ?>">
                                </div>



                                <div class="col-sm-12 form-group"></div>
                                <div class="form-group col-sm-10" >
                                    <div class="input-group">
                                        <input type="text" 
                                               class="form-control"
                                               id="work_file_folder_name"
                                               name="work_file_folder_name"
                                               value="<?php echo $folder_name; ?>"
                                               placeholder="Please Type Work Folder Name">
                                        <span class="input-group-addon"  title="Please Type Work Folder Name"><i class="fa fa-folder"></i></span>
                                    </div>
                                    <div id="folder_name_error" style="color: red; display: none"><?php echo form_error('work_file_folder_name'); ?></div>
                                </div>
                            </div>



                            <div id="upload_WorkFile_heaader">
                                <?php
                                if ($work_file_info) {
                                    $i = 1;
                                    foreach ($work_file_info as $value) {
                                        ?>
                                        <div id="upload_WorkFile<?php echo $i; ?>">
                                            <div class="col-sm-12" style="padding: 0;" ><br>
                                                <div class="col-sm-12 padding-zero white" ><br>


                                                    <div class="form-group col-sm-2 col-sm-offset-10" id="cancelWorkFile<?php echo $i; ?>">
                                                        <a href="javascript:void(0)" id="deleteWorkFile<?php echo $i; ?>">
                                                            <i class="fa fa-times-circle fa-2x"></i>
                                                        </a>
                                                        <div class="modal fade" style="" id="viewDeleteWorkFile<?php echo $i; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                                            <?php
                                                            $message2 = '<span style="text-align:center">Are you sure you want to delete course work file?</span>';
                                                            $this->cf->view_modal($i, $message2);
                                                            ?>
                                                        </div>
                                                    </div>


                                                    <div class="form-group col-sm-6" >
                                                        <div class="input-group">
                                                            <input type="text" 
                                                                   class="form-control"
                                                                   id="work_file_name<?php echo $i; ?>"
                                                                   name="work_file_name[<?php echo $i; ?>]"
                                                                   value="<?php echo pathinfo($value->work_file_name, PATHINFO_FILENAME); ?>"
                                                                   placeholder="Please Type Work File Name"   >
                                                            <span class="input-group-addon"  title="Please Type Work File Name"><i class="fa fa-file"></i></span>
                                                        </div>
                                                        <div id="file_name_error<?php echo $i; ?>" style="color: red; display: none;"></div>
                                                    </div>
                                                    <div class="col-sm-12"><br> </div>




                                                    <div class="form-group col-sm-12">
                                                        <div class="text-left padding-zero col-sm-1">  <label>Status  :  &nbsp;&nbsp;</label></div>
                                                        <div class="radio radio-success col-sm-8 margin-zero">
                                                            <input  type="radio" 
                                                                    name="work_file_access_level[<?php echo $i; ?>]" 
                                                                    id="Free" 
                                                                    value="1" <?php echo ($value->work_file_access_level == 1) ? 'checked' : ''; ?>>
                                                            <label for="Free">Free</label>
                                                            <?php
                                                            if ($course_info->course_type == 1) {
                                                                ?>
                                                                <span style="margin-right: 20px"></span>
                                                                <input   type="radio" 
                                                                         name="work_file_access_level[<?php echo $i; ?>]" 
                                                                         id="Paid" 
                                                                         value="2" <?php echo ($value->work_file_access_level == 2) ? 'checked' : ''; ?>>
                                                                <label for="Paid">Paid</label>
                                                                <?php
                                                            }
                                                            ?>
                                                        </div>
                                                        <div class="col-sm-12" id="work_file_access_level_error<?php echo $i; ?>" style="margin-left: 50px; color: red;display: none;"> </div>
                                                    </div>
                                                    <div class="col-sm-12"><br> </div>




                                                    <div class="form-group col-sm-12" >
                                                        <div class="form-group col-sm-6 padding-zero" >
                                                            <div class="bootstrap-filestyle input-group">
                                                                <input id="upload_work_file<?php echo $i; ?>" name="upload_work_file[]" type="file"
                                                                       style="display:none;">
                                                                <input type="text" disabled="1"
                                                                       class="form-control"
                                                                       id="uploadedFileName<?php echo $i; ?>" value="<?php echo $value->work_file_name ?>"> 
                                                                <span class="group-span-filestyle input-group-btn" tabindex="1" >
                                                                    <label for="upload_work_file<?php echo $i; ?>" class="btn btn-default ">
                                                                        <span class="buttonText">Choose file</span>
                                                                    </label>
                                                                </span>
                                                            </div>
                                                        </div>
                                                        <div class="col-sm-5" >
                                                            <div class="col-sm-12" id="progressBar<?php echo $i; ?>" style="display: none">
                                                                <div class="progress">
                                                                    <div id="loadingProgressBar<?php echo $i; ?>" class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="40" 
                                                                         aria-valuemin="0" aria-valuemax="100" style="width:90%">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div id="upload_work_file_error<?php echo $i; ?>" style="color: red;display: none;" class="col-sm-12"></div>
                                                    <div id="remaining_work_file_size<?php echo $i; ?>" style="color: green;" class="col-sm-12">
                                                        <?php
                                                        echo $this->tt_storage->set_size($value->work_file_size)->calculate_disk_storage()->get_designed_file_size();
                                                        ?>
                                                    </div>
                                                </div>
                                                <div class="col-sm-12"><br> </div>
                                            </div>
                                        </div>
                                        <?php
                                        $i++;
                                    }
                                }
                                ?>
                            </div>
                        </div>



                        <div class="form-group col-sm-3 col-sm-offset-9 " >
                            <button type="button" id="add_more_course_work_file_button"
                                    class="btn btn-success">Add More</button>
                        </div>
                        <div class="col-sm-12"><br> </div>
                        <div id="final_error_message" style="color:red;" class="col-sm-12 text-center">
                            <?php
                            if (isset($this->session->work_file_error_msg)) {
                                echo $this->session->work_file_error_msg;
                                $this->session->unset_userdata('work_file_error_msg');
                            }
                            ?>
                        </div>
                        <div class="form-group col-sm-12">
                            <div id="submit_status"></div>
                            <div class="checkbox col-sm-12">
                                <center>
                                    <button type="submit" id="submit_work_file"
                                            class="btn btn-default" >Update Course Work File</button>
                                </center>
                            </div>
                        </div>
                        <?php echo form_close(); ?>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <br>
    <div class="row gray">
        <div class="col-sm-12 ">
            <label><a href="dashboard.html">Dashboard</a> ->> <a href="#">Manage Course</a>->>Create Course Work File</label>
        </div>
    </div>
</div>
<script type="text/javascript" src="<?php echo base_url() ?>back_end_resource/course/course_work_file.js">
</script>