 <?php if($person_info->person_role == 4) {
     $url = 'course/organization';
    }else if($person_info->person_role == 3){
     $url = 'course/teacher';    
    }
?>
<style>
    #loading_image{
        padding: 0px;
        height: 300px;
        position: absolute;
        z-index: 1;
        width: 100%;
        line-height: 300px;
    }
</style>
<link href="<?php echo base_url()?>front_end_resource/batch/alert_select_batch.css" rel="stylesheet" type="text/css"/>
<div class="col-sm-8">
    <div class="row ">
        <div class="col-sm-12"><hr></div>
        <div style="padding: 0px;opacity: 1; display: none" id="loading_image">
            <img src="<?php echo base_url() ?>image/course-loader.gif" 
                 height="60" width="60" style="margin: 20% 45%;">
        </div>
             <div class="form-group col-sm-12">
            <div class="form-group col-sm-5">
                <div class="input-group date" id="datetimepicker1">
                    <input type="text" 
                           class="form-control text-input" 
                           name="start_date" id="start_date"
                           onblur="viewUnassignedStudentBYDate(this.value, end_date.value)"
                           aria-describedby="basic-addon1"
                           value=""
                           placeholder="Start Date" >
                    <span class="input-group-addon">
                        <span class="glyphicon glyphicon-calendar"></span>
                    </span>
                </div>
            </div>
            <div class="form-group col-sm-5">
                <div class="input-group date" id="datetimepicker2">
                    <input type="text" 
                           class="form-control text-input" 
                           name="end_date" id="end_date"
                           onblur="viewUnassignedStudentBYDate(start_date.value, this.value)"
                           aria-describedby="basic-addon1"
                           value=""
                           placeholder="End Date" >
                    <span class="input-group-addon">
                        <span class="glyphicon glyphicon-calendar"></span>
                    </span>
                </div>
            </div>

            <script type="text/javascript">
                //for Date   #datetimepicker1 is ID for Date Input Field     
                $(function () {
                    $('#datetimepicker1').datetimepicker({
                        viewMode: 'years',
                        format: 'YYYY-MM-DD'
                    });
                    $('#datetimepicker2').datetimepicker({
                        viewMode: 'years',
                        format: 'YYYY-MM-DD'
                    });
                });
            </script>
            <div class="form-group col-sm-12 text-left" id="errorMessage"></div>
        </div>
        
        
        <div class="col-sm-12">
            <div class="col-sm-12  text-left  "style="margin-bottom: 5px;font-weight: bold; border-bottom: 2px solid #80c12c">
                <div class="col-sm-3">Name</div>
                <div class="col-sm-2">Mobile</div>
                <div class="col-sm-3">Email</div>
                <div class="col-sm-2 text-center">Status</div>
                <div class="col-sm-2">Action</div>
            </div>
            <div id="view_unassigned_student">
                <?php
                if ($unassigned_student_info) {
                    count($unassigned_student_info);
                    foreach ($unassigned_student_info as $student_value) {
                        ?>
                        <div>
                            <div class="col-sm-12 text-left " style="padding: 10px;background-color:#F2F9EA;border: 1px solid #ededed" >
                                <div class="col-sm-3">
                                    <a href="<?php echo base_url() . $student_value->url . '/profile'; ?>" target="_blank">
                                        <?php
                                            //echo $student_value->person_first_name . ' ' . $student_value->person_last_name;
                                            if(strlen($student_value->person_first_name) && strlen($student_value->person_last_name) < 30){
                                                echo $student_value->person_first_name . ' ' . $student_value->person_last_name;
                                            }else{
                                                echo substr($student_value->person_first_name,0 ,30).' '.substr($student_value->person_last_name, 0, 20).'...';
                                            }
                                        ?>                                       
                                    </a>
                                </div>
                                <div class="col-sm-2"><?php echo $student_value->person_contact_number; ?></div>
                                <div class="col-sm-3">
                                    <?php 
                                        //echo $student_value->person_email;
                                        if(strlen($student_value->person_email) < 30){
                                            echo $student_value->person_email;
                                        }else{
                                            echo substr($student_value->person_email,0 ,30).'...';
                                        }
                                    ?>
                                </div>
                                <div class="col-sm-2 text-center">
                                    <?php
//                            $status_array = Array('', 'Paid', 'Partial Paid', 'unpaid', 'Drop', 'Cancel', 'Pending');
                                    if ($course_info->course_type == 1) {
                                        echo 'Paid';
//                                echo $status_array[$student_value->payment_status];
                                    }
                                    if ($course_info->course_type == 2) {
                                        echo 'Free';
                                    }
                                    ?>
                                </div>
                                <!----------- action start here ------------>
                                <div class="col-sm-2">                                 
                                <span id="addBatch<?php echo $student_value->student_id; ?>" style="display: block">
                                    <a href="javascript:void(0);" onclick="assignBatch('<?php echo base_url(); ?>assign-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo '0'?>', '<?php echo $batch; ?>')" id="addBatch">  
                                    <i class="fa fa-ge" title="Add Batch">&nbsp;&nbsp;</i>
                                    </a>
                                </span>
                                 <input type="hidden" id="pagination_url" value="<?php echo base_url('unassigned-student-pagination'); ?>">
                                  <input type="hidden" id="paginationUrl" value="<?php echo base_url('unassigned-student-pagination'); ?>">
                                <!--<input type="hidden" id="paginationUrl" value="<?php //echo base_url('user/register-course-student-pagination'); ?>">-->
                                 <input type="hidden" value="<?php echo base_url() . 'assign-unassigned-student/' . $course_url; ?>" id="unassigned_url" name="">
                                 <input type="hidden" value="<?php echo $course_url; ?>" id="course_url" name="course_url">
                                 <input type="hidden" value="<?php echo $url;?>" id="redirect_url" name="redirect_url">
                                 <input type="hidden" value="<?php echo base_url();?>" id="baseUrl" name="baseUrl">
                                 <input type="hidden" value="<?php echo $count_student;?>" id="unassign_student_count" name="unassign_student_count">   
                                </div>
                                <!----------- action start here ----------->
                               <div class="col-sm-12"><br></div>
                            </div>
                            <div class="col-sm-12 form-group" id=""></div>
                        </div>
                        <!--------------------Select Batch Area---------------------------->
                        <div class="col-sm-12 form-group" style="" id='batch<?php echo $student_value->student_id; ?>'> </div>
                        <!--------------------end Select Batch Area---------------------------->         
                        <?php
                    }
                    echo $unassigned_student_paginzation_link;
                } else {
                    echo get_message('course_unassign_msg');
                }
                echo '</div>';
                ?>
            </div>
            <!--<input type="hidden" id="courseID" value="<?php echo $course_info->course_id ?>">-->
            <input type="hidden" id="course_url" value="<?php echo $course_url; ?>">
            <!--<input type="hidden" id="paginationUrl" value="<?php //echo base_url('user/register-course-student-pagination'); ?>">-->
            <input type="hidden" id="pagination_url" value="<?php echo base_url('unassigned-student-pagination'); ?>">
            <input type="hidden" id="unassign_student_url" value="<?php echo base_url('view-unassigned-student'); ?>">
        </div>
    </div>
    <script type="text/javascript" src="<?php echo base_url() ?>front_end_resource/batch/batch.js"></script>
    <script type="text/javascript" src="<?php echo base_url() ?>front_end_resource/batch/alert_select_batch.js"></script>
