<div class="col-sm-10">
    <div class="row gray_ttc">
        <div class="col-sm-10 ">
            <div class="col-sm-12">
                <h3>Edit Batch Information</h3>  
            </div>
            <div class="col-sm-12"> <hr><br></div>
            <div class="col-sm-12">

                <?php
        echo validation_errors();
              $url = 'admin/edit-batch/'.$batch_tab.'/'.$this->utility_model->encode_id($course_batch_id  , '/', 'Tt');
               echo form_open($url, 'class="" id="formID2" name="editBatchForm" onsubmit="check_form()"');
                ?>
                <div class="col-sm-12">
                    <div class="col-sm-12 form-group">
                        <div class="input-group">
                            <input type="text" 
                                   data-errormessage-value-missing="Batch name is required"
                                   class="form-control validate[required] text-input" 
                                   name="course_batch_name" id="course_batch_name"
                                   placeholder="Type your Batch Name.." aria-describedby="basic-addon1"
                                   value="<?php
                                   if (set_value('course_batch_name')) {
                                       echo set_value('course_batch_name');
                                   } else {
                                       echo $batch_info->course_batch_name;
                                   }
                                   ?>">
                            <span class="input-group-addon" id="basic-addon1" title="Type your Batch Name"><i class="fa fa-ge"></i></span>
                        </div>
                        <span id="course_batch_name_message" style="color: red"><?php echo form_error('course_batch_name'); ?></span>
                    </div>
                    <div class="col-sm-12"><br></div>
<!--------------------------------  start search --------------------------------->
                    <div class="col-sm-12 form-group">
                        <select class="form-control" 
                           name="course_type" id="course_type"
                           onchange="getCourseType(this.value, '<?php echo base_url().'super-admin/select-course-type' ?>')">
                            <option value=""> -Select Course Type- </option>
                            <option value="2"> All Course</option>                           
                            <option value="1">TT Course </option>
                            <option value="3">Organization Course</option>
                            <option value="4">Teacher Course</option>
                        </select>
                        <span id="course_message" style="color: red"><?php echo form_error('course'); ?></span>
                    </div>
                    <div id="search_area" style="display:none">
                    <div class="col-sm-12"><br></div>
                    <div class="col-sm-12 form-group" >
                        <div class="input-group">
                            <input type="text" 
                                   data-errormessage-value-missing="Search Here"
                                   class="form-control  text-input" 
                                   name="search_course" id="search_course"
                                   oninput ="getCourseSearchValue(this.value, course_type.value, '<?php echo base_url().'super-admin/search-course-type' ?>')"
                                   placeholder="Search Here.." aria-describedby="basic-addon1"
                                   value="<?php echo set_value('search_course'); ?>">
                            <span class="input-group-addon" id="basic-addon1" title="Type your Batch Name"><i class="fa fa-search"></i></span>
                        </div>
                        <span id="search_course_message" style="color: red"><?php //echo form_error('course_batch_name');  ?></span>
                    </div>
                    </div>
<!------------------------------------- end search ------------------------------------------>
                  <div class="col-sm-12"><br></div>
                    <div class="col-sm-12 form-group" id="course_area">
                        <select data-errormessage-value-missing="Course is required"
                                class="form-control validate[required]" 
                                name="course" id="course"
                               onchange="getCourseInfo(this.value, '<?php echo base_url() . 'super-admin/batch-course-info' ?>')">               
                            <option value=""> --Select Course-- </option>
                            <?php 
                            foreach ($course_data as $v_courses) { ?>
                                <option value="<?php echo $v_courses->course_id; ?>"><?php echo $v_courses->course_name; ?></option>
                            <?php } ?>
                        </select>
                        <span id="course_message" style="color: red"><?php echo form_error('course'); ?></span>
                    </div>

                    <div id="course_info">
                        <div class="col-sm-12 form-group text-left">
                            <strong id="course_resource_person">          
                                Resource Person Name : <?php echo $resourse_person_info->person_first_name; ?>
                            </strong>
                        </div>

                        <!--<input type="hidden" name="course_start_date" id="course_start_date" value="<?php //echo $course_info->course_start_date; ?>">-->
                        <div class="col-sm-6 form-group">
                            <div class="input-group " id="datetimepicker1">
                                <input type="text" 
                                       data-errormessage-value-missing="Class start Date is Required!"
                                       class="form-control validate[required,<?php if($this->session->batch_tab != 'running' && $this->session->batch_tab != 'finished'){echo 'custom[mindate]';} ?>,custom[batchFinishedDate]] text-input"
                                       name="course_batch_start_date" id="course_batch_start_date" 
                                       placeholder="Please Select  Start Date"
                                       value="<?php
                                       if (set_value('course_batch_start_date')) {
                                           echo set_value('course_batch_start_date');
                                       } else {
                                           echo $batch_info->course_batch_start_date;
                                       }
                                       ?>">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar" title="Please Select  Start Date"></span>
                                </span>
                            </div>
                            <span id="course_batch_start_date_message" style="color: red"><?php echo form_error('course_batch_start_date'); ?></span>
                        </div>

                        <div class="col-sm-6 form-group">
                            <div class="input-group " id="datetimepicker5">
                                <input type="text" 
                                       data-errormessage-value-missing="Class finish Date is Required!"
                                       class="form-control validate[required,<?php if($this->session->batch_tab != 'running' && $this->session->batch_tab != 'finished'){echo 'custom[mindate]';} ?>,custom[batchFinishedDate]] text-input"
                                       name="course_batch_finish_date" id="course_batch_finish_date" 
                                       placeholder="Please Select Finish Date"
                                       value="<?php
                                       if (set_value('course_batch_finish_date')) {
                                           echo set_value('course_batch_finish_date');
                                       } else {
                                           echo $batch_info->course_batch_finish_date;
                                       }
                                       ?>">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar" title="Please Select Finish Date"></span>
                                </span>
                            </div>
                            <span id="course_batch_finish_date_message" style="color: red"><?php echo form_error('course_batch_finish_date'); ?></span>                        
                        </div>
                        <div class="col-sm-12 form-group text-left">
                            <strong>Batch Status: </strong> 
                            <?php
                            $course_batch_status = array('', 'Running', 'Finished', 'Cancel', 'Create');
                            echo $course_batch_status[$batch_info->course_batch_status];
                            ?>
                        </div>
                    </div>
                    <div class="col-sm-12"><br><br></div>

                    <div class="form-group col-sm-4 col-sm-offset-4">
                        <input type="submit" class="green-btn btn btn-default" value=" Update ">
                    </div>
                    <div class="form-group col-sm-2"></div>
                    <div class="col-sm-12"><br><br></div>
                </div>
                <?php echo form_close(); ?>
            </div>
        </div>
    </div>
</div>

<script>
    document.forms['editBatchForm'].elements['course'].value = 
            '<?php
                if (set_value('course')) {
                    echo set_value('course');
                } else {
                    echo $batch_info->course_id; 
                }
            ?>';
            
    document.forms['editBatchForm'].elements['course_type'].value = 
            '<?php
                if (set_value('course_type')) {
                    echo set_value('course_type');
                } else {
                    if($course_creator_info->person_role == 6){ //creator talhatraining
                        echo '1'; //tt course
                    }else if($course_creator_info->person_role == 3){//creator individual teacher
                     echo '4'; //teacher course
                    }
                    else if($course_creator_info->person_role == 4){//course creator organizatio
                     echo '3';   //org course
                    }                   
                }
            ?>';
</script>

<script type="text/javascript" src="<?php echo base_url()?>front_end_resource/batch/batch.js"></script>

