<?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-10">
                <?php //echo $course_url;  ?>
                <div class="input-group date" id="search_name">
                    <input type="text" 
                           class="form-control text-input" 
                           name="not_eligible_search" id="not_eligible_search"
                           oninput="NotEligibleBySearch(this.value , '<?php echo base_url().'user/not-eligible-search'?>')"
                           aria-describedby="basic-addon1"
                           value=""
                           placeholder="Search here" >
                    <span class="input-group-addon">
                        <!--<span class="glyphicon glyphicon-calendar"></span>-->
                    </span>
                </div>
            </div>
         
            <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_not_eligible_student">
                <?php
                if ($not_eligible_student) {
                    foreach ($not_eligible_student 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
                                    if ($course_info->course_type == 1) {
                                        echo 'Paid';
                                    }
                                    if ($course_info->course_type == 2) {
                                        echo 'Free';
                                    }
                                    ?>
                                </div>
                                <!----------- action start here ------------>
                                <div class="col-sm-2">                                 
                                    <span id="remove<?php echo $student_value->student_id; ?>" style="display: block">
                                        <a href="javascript:void(0);" data-toggle="modal" data-target="#eligible<?php echo $student_value->student_id; ?>"> 
                                            <i class="fa fa-remove" title="Remove Student"></i> 
                                        </a> 
                                    </span>       
                                    <input type="hidden" id="not_eligible_pagination" value="<?php echo base_url('user/not-eligible-pagination'); ?>">
                                    <input type="hidden" value="<?php echo $course_url; ?>" id="course_url" name="course_url">      
                                </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---------------------------->         

<!--                        <div class="modal" style="" id="eligible<?php echo $student_value->student_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                            <div class="modal-dialog">
                                <div class="modal-content" style="top: 180px;border: 5px solid #80c12c;border-top: 20px solid #80c12c !important;margin: 0 auto;width: 450px">           
                                    <div class="modal-body">
                                        <h4 class="text-center" style="text-align: center">Want to make this student eligible?</h4>
                                    </div>
                                    <div class="modal-footer">
                                        <div  class="col-sm-12">               
                                            <button onclick="makeEligible('<?php echo base_url(); ?>eligible', '<?php echo $student_value->student_id; ?>', '<?php echo $course_info->course_id; ?>')" style="margin-left: 90px" type="button" class="btn btn-success  col-sm-2" data-dismiss="modal">Yes</button>
                                            <button type="button" style="margin-left: 20px" class="btn btn-danger col-sm-2 col-sm-offset-4" data-dismiss="modal">No</button>
                                        </div>
                                    </div>            
                                </div>
                            </div>
                        </div>-->
                        
                   <div class="modal" style="" id="eligible<?php echo $student_value->student_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                        <div class='modal-dialog'>
                             <div class='modal-content' style='top: 180px;border: 5px solid #80c12c;border-top: 20px solid #80c12c !important;margin: 0 auto;max-width: 400px'>           
                                    <div class='modal-body text-center' style='padding-bottom: 0px;'>
                                        <span class='text-center'>Want to make this student eligible?</span>
                                    </div>
                             <div class='modal-footer'>
                                    <div  class='col-sm-12 text-center'>  
                                            <span class='col-sm-3 col-sm-offset-3'>
                                                <button  type='button' class='btn btn-danger  col-sm-12' data-dismiss='modal' style='font-size: 14px;'>No</button>
                                            </span>		
                                            <span class='col-sm-3'>
                                                <button onclick="makeEligible('<?php echo base_url(); ?>eligible', '<?php echo $student_value->student_id; ?>', '<?php echo $course_info->course_id; ?>')" class='btn btn-success  col-sm-12' data-dismiss='modal'>Yes</button>
                                            </span>										

                                    </div>
                                </div>            
                            </div>
                        </div>
                    </div>                             
                        
                     <?php
                    }
                    echo $not_eligible_student_paginzation_link;
                } else {
                    echo get_message('course_not_eligible_msg');
                }
                echo '</div>';
                ?>
            </div>
        </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>
