<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <h4 class="modal-title" id="gridSystemModalLabel">Add Course</h4>
    <hr>
</div>
<div class="modal-body">

    <div class="col-sm-12 text-left" id="Create_New_Course">
        <span><a href="#" onclick="CreateCourse()">Create New Course</a></span>
    </div>
    <div class="col-sm-12"><br></div>

    <div class="col-sm-12" style='padding: 5px'>
        <div class="col-sm-3">
            <div class="row ">
                <p class="bg-primary lead" style="text-align: center;background-color: #8CC73F">Category</p>
                <div class="list-group text-left" id="course_cetegory" style="height: 450px; overflow-y: auto;">
                    <?php
                    if ($course_categories) {
                        foreach ($course_categories as $v_course_categories) {
                            ?>
                            <a href="#" onclick="selectCategoryCourse(<?php echo $v_course_categories->course_category_id; ?>);"  
                               class="list-group-item"> <?php echo $v_course_categories->course_category_name; ?></a>
                               <?php
                           }
                       }
                       ?>
                    <div id="new_category">

                    </div>
                </div>

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

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

                    <div class="input-group">
                        <input type="text"  class="form-control "  placeholder="Search Here ..">
                        <span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
                    </div>


                </div>
                <br>

                <br>
            </div>


            <form name="selectCourseForm" id="formID4" action="javascript:;" method="post" >
                <div class="radio radio-success col-sm-12" id="category_course" style="display: block">
                    <?php
                    if ($courses) {
                        foreach ($courses as $v_course) {
                            ?>
                            <input  type="radio"
                                    data-errormessage-value-missing="Course Type is Required!" 
                                    class="form-control validate[required] text-input"
                                    name="course_id" id="course_id<?php echo $v_course->course_id; ?>" 
                                    value="<?php echo $v_course->course_id; ?>" 
                                    checked="1">

                            <label for="<?php echo $v_course->course_name; ?>"><?php echo $v_course->course_name; ?></label>

                            <input type="hidden" name="course_name<?php echo $v_course->course_id; ?>" id="course_name<?php echo $v_course->course_id; ?>" value="<?php echo $v_course->course_name; ?>">
                            <input type="hidden" name="resource_person_id<?php echo $v_course->course_id; ?>" id="resource_person_id<?php echo $v_course->course_id; ?>" value="<?php echo $resource_person_info[$v_course->course_id]->resource_person_id; ?>">
                            <input type="hidden" name="resource_person_name<?php echo $v_course->course_id; ?>" id="resource_person_name<?php echo $v_course->course_id; ?>" value="<?php echo $resource_person_info[$v_course->course_id]->person_first_name; ?>">
                            <input type="hidden" name="course_time_duration<?php echo $v_course->course_id; ?>" id="course_time_duration<?php echo $v_course->course_id; ?>" value="<?php echo $v_course->class_hour_per_day; ?>">
                            <input type="hidden" 
                                   name="course_last_session_number<?php echo $v_course->course_id; ?>" id="course_last_session_number<?php echo $v_course->course_id; ?>" 
                                   value="<?php
                                   if ($class_session_number[$v_course->course_id]) {
                                       if ($class_session_number[$v_course->course_id]->class_session_number) {
                                           echo $class_session_number[$v_course->course_id]->class_session_number;
                                       }
                                   } else {
                                       echo 0;
                                   }
                                   ?>">

                            <div class="col-lg-12"><br></div>
                            <span><br></span>

                        <?php } ?>
                        <input type="submit" class="btn btn-success" value="Add Course" data-dismiss="modal" onclick="setCourse();" >
                    <?php } ?>

                </div>
            </form>

            <!--END NEW COURSE FORM-->

            <div class="col-sm-12 pull-left gray_ttc" id="newCourse" style="display: none">
                <form name = "newCourseForm" id = "formID3" action = "#" method = "post" onsubmit = " return addNewCourse();">
                    <br>
                    <div class = "col-sm-12 text-left" style = "font-size: 18px;font-weight: bold">Add New Course<br><br></div>

                    <div id = "message"></div>

                    <input type="hidden" name="recently_created_course_id" id="recently_created_course_id" value="<?php echo $recently_created_course_id; ?>">

                    <div class = "col-sm-8">
                        <select data-errormessage-value-missing = "Course category is Required!"
                                class = "form-control validate[required] text-input"
                                name = "course_category_id" id = "course_category_id"
                                onchange = "otherCategory()">
                            <option value = ""> -Select Course Category- </option>
                            <?php foreach ($course_categories as $v_course_categories) {
                                ?>
                                <option value="<?php echo $v_course_categories->course_category_id; ?>"><?php echo $v_course_categories->course_category_name; ?></option>
                            <?php } ?>
                            <option value="other">Other</option>
                        </select>
                    </div>

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

                    <div class="col-sm-8" id="other_category" style="display: none">
                        <div class="input-group">
                            <input type="text" 
                                   data-errormessage-value-missing="Category Name is Required!" 
                                   class="form-control validate[required, custom[courseName] ] text-input"
                                   name="other_category_name" id="other_category_name"
                                   placeholder="Please Type New Category" aria-describedby="basic-addon1">
                            <span class="input-group-addon" id="basic-addon1"><i class="fa fa-crosshairs "></i></span>
                        </div>
                    </div>

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

                    <div class="col-sm-8">
                        <div class="input-group">
                            <input type="text" 
                                   data-errormessage-value-missing="Course Name is Required!" 
                                   class="form-control validate[required, custom[courseName]] text-input"
                                   name="course_name" id="course_name"
                                   placeholder="Please Type Course Name.." aria-describedby="basic-addon1">
                            <span class="input-group-addon" id="basic-addon1"><i class="fa fa-book"></i></span>
                        </div>
                    </div>
                    <div class="col-sm-12"><br></div>
                    <div class="col-sm-12 pull-left">
                        <div class="col-sm-2" style="padding: 0;margin-top: 10px">  <label >Status :  &nbsp;&nbsp;</label></div>
                        <div class="radio radio-success col-sm-4 navbar-form" style="padding: 0">
                            <input   type="radio" 
                                     data-errormessage-value-missing="Course Type is Required!" 
                                     class="form-control validate[required] text-input"
                                     name="course_type" id="free" value="2" 
                                     onclick="priceOption(this.value)" checked="1">
                            <label for="Free">Free</label>
                            <span style="margin-right: 30px"></span>
                            <?php if ($last_feature_detail->feature_price_payment_status == 2) { ?>
                                <input  type="radio" 
                                        data-errormessage-value-missing="Course Type is Required!" 
                                        class="form-control validate[required] text-input" 
                                        name="course_type" id="paid" value="1"
                                        onclick="priceOption(this.value)" >
                                <label for="Paid">Paid</label>
                            <?php } ?>
                        </div>
                        <?php if ($last_feature_detail->feature_price_payment_status == 1) { ?>
                            <div class="col-sm-8">
                                <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>
                        <?php } ?>
                    </div>

                    <div class="col-sm-8" id="coursePrice" style="display: none">
                        <br>
                        <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" 
                                   name="course_price" id="course_price"
                                   placeholder="Please Type Course Price.." aria-describedby="basic-addon1">
                            <span class="input-group-addon" id="basic-addon1"><i class="fa fa-money"></i></span>
                        </div>
                    </div>

                    <div class="col-sm-8" >
                        <br>
                        <div class="input-group">
                            <input class="form-control btn btn-success" id="sm" type="submit"  value="Create Course" aria-describedby="basic-addon1">

                        </div>
                        <br>
                    </div>    
                </form>

            </div>

            <!--END NEW COURSE FORM-->
        </div>

    </div>

</div>

<div class="modal-footer">

    <button type="button" class="btn btn-danger pull-right" data-dismiss="modal">Close</button>
</div>