<div class="col-sm-8">
    <div class="row gray">
        <div class="col-sm-12 ">
            <div class="col-sm-12">
                <nav class="text-justify">
                    <div class="col-sm-12" style="padding: 0">
                        <span class="clo-sm-3" title="Add work Files" style="padding: 0">
                            <h3 style="text-align: center !important">Update Course Work Files</h3>
                        </span>
                    </div>
                </nav>
            </div>

            <div class="col-sm-12"><br></div>
            <div class="col-sm-12">
                <?php
//                echo validation_errors();
                $url = 'user/course/save-work-file/' . $course_info->url;
                echo form_open_multipart($url, 'class=""  name="fileUploadForm" onsubmit="return checkCourseWorkFile()"');
                ?>
                <div class="col-sm-12 padding-zero white"><br>
                    <div class="form-group col-sm-10">
                        <div class="input-group">
                            <input type="text" 
                                   data-errormessage-value-missing="Upload File Folder Name is Required"
                                   class="form-control" 
                                   name="work_file_folder_name" 
                                   id="work_file_folder_name" 
                                   placeholder="Please Type Work File Folder Name"
                                   value="<?php echo $folder_name; ?>">
                            <span class="input-group-addon"  title="Type Work File folder Name"><i class="fa fa-folder"></i></span>
                        </div>
                        <div class="form-group col-sm-10" id="folder_name_error" style="color:red; display: none;"></div>
                    </div>
                    <input type="hidden" id="baseUrl" value="<?php echo base_url() ?>">
                </div>


                <div id="upload_WorkFile_heaader">
                    <?php
                    $i = 1;
                    foreach ($work_file_info as $file_value) {
                        ?>
                        <div id="upload_WorkFile<?php echo $i; ?>">
                            <div class="col-sm-12 padding-zero margin-top-20 white">
                                <div class="col-sm-12"><br> </div>

                                <!--WORK FILE-->
                                <div class="form-group col-sm-6">
                                    <div>
                                        <div class="input-group">
                                            <input type="text" 
                                                   data-errormessage-value-missing="Work Files Name is Required!"
                                                   class="form-control"
                                                   placeholder="Please Type Work File Name" 
                                                   name="work_file_name[<?php echo $i; ?>]" 
                                                   id="work_file_name<?php echo $i; ?>"
                                                   value="<?php echo pathinfo($file_value->work_file_name, PATHINFO_FILENAME); ?>">
                                            <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;"></div>
                                    </div>
                                </div>



<!--                                <div class="form-group col-sm-1 text-right" 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="col-sm-12"><br></div>



                                <div class="form-group col-sm-6">
                                    <div class="text-left padding-zero col-sm-4">  <label >Access Level  :  &nbsp;&nbsp;</label></div>
                                    <div class="radio radio-success col-sm-8 radio-margin">
                                        <?php
                                        if ($course_info->course_type == 1) {
                                            ?>
                                            <input  type="radio" 
                                                    data-errormessage-value-missing="Work File Access Level is Required!"
                                                    class="control-form tokenize-sample" 
                                                    name="work_file_access_level[<?php echo $i; ?>]" 
                                                    id="free" 
                                                    value="1" <?php echo ($file_value->work_file_access_level == 1) ? 'checked' : ''; ?>>
                                            <label for="Free">Free</label>
                                            <span style="margin-right: 20px"></span>
                                            <input   type="radio" 
                                                     data-errormessage-value-missing="Work File Access Level is Required!"
                                                     class="control-form tokenize-sample" 
                                                     name="work_file_access_level[<?php echo $i; ?>]"
                                                     id="paid" 
                                                     value="2" <?php echo ($file_value->work_file_access_level == 2) ? 'checked' : ''; ?>>
                                            <label for="Paid">Paid</label>
                                        <?php } elseif ($course_info->course_type == 2) {
                                            ?>
                                            <input  type="radio" 
                                                    data-errormessage-value-missing="Work File Access Level is Required!"
                                                    class="control-form tokenize-sample" 
                                                    name="work_file_access_level[<?php echo $i; ?>]" 
                                                    id="free" 
                                                    value="1" checked="">
                                            <label for="Free">Free</label>
                                        <?php }
                                        ?>
                                    </div>
                                    <div class="col-sm-12" id="work_file_access_level_error<?php echo $i; ?>" style="margin-left: 20px; color: red;"> </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="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 $file_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>
                                        <!--<span class="pull-left"> [Upload work file] </span>-->
                                    </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 id="upload_work_file_error<?php echo $i; ?>" style="color: red;" 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($file_value->work_file_size)->calculate_disk_storage()->get_designed_file_size();
                                        ?>
                                    </div>
                                    <!--</div>-->
                                </div>
                            </div>
                        </div>
                        <?php
                        $i++;
                    }
                    ?>
                </div>
                <span id="final_error_message" style="color: red;" class="col-sm-12">
                    <?php
                    if (isset($this->session->work_file_error_msg)) {
                        echo $this->session->work_file_error_msg;
                        $this->session->unset_userdata('work_file_error_msg');
                    }
                    ?>
                </span>


                <div>
                    <div class="col-sm-12"><br></div>
                    <div class="form-group col-sm-3 ">
                        <button id="add_more_course_work_file_button" type="button"
                                class="btn btn-success"> Add More Work File
                        </button>
                    </div>
                    <div class="form-group col-sm-9" id="check_upload_error" style="color: red"></div>

                    <div class="col-sm-12"><br><br><br></div>
                    <div class="col-sm-12 padding-zero">
                        <div class="col-sm-4"></div>
                        <div class="form-group col-sm-2">
                            <button id="submit_work_file" type="submit"
                                    class="btn btn-success"> Update
                            </button><br/><br/>
                        </div>         
                        <div class="col-sm-2">
                            <button id="skip_work_file" type="button"
                                    class="btn btn-success skip"> Skip
                            </button>
                        </div>
                        <!--view skip work file modal-->
                        <div class="modal fade" style="" id="skipWorkFileModal-Skip" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                            <?php
                            $message3 = '<span style="text-align:center">Are you sure you want to skip course work file?</span>';
                            $this->cf->view_modal('-Skip', $message3);
                            ?>
                        </div>
                        <!--view skip work file modal--> 
                        <div class="col-sm-4"></div>
                    </div>

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

                </div><!-- /.row gray -->
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="<?php echo base_url() ?>front_end_resource/course/course_work_file.js">
</script>
<style>
    .skip{
        padding:6px 20px;
    }
</style>

