<?php
if ($person_info->person_role == 4) {
    $url = 'view-organization-batch/' . $course_url->url;
} else if ($person_info->person_role == 3) {
    $url = 'view-teacher-batch/' . $course_url->url;
}
?>
<input type="hidden" id="baseUrl" value="<?php echo base_url(); ?>">
<input type="hidden" id="courseBatchId" value="<?php echo $course_batch_id; ?>">
<div class="col-sm-8">
    <div class="row ">
        <!--        <div class="col-sm-12 ">
                    <span class="col-sm-6 text-left"><h3> Student List</h3></span>
                </div>-->       
        <div class="col-sm-12"><hr></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-3">Mobile</div>
                <div class="col-sm-4">Email</div>
                <?php if ($batch_info->course_batch_status == 2) { ?>
                    <div class="col-sm-2">Certification</div>
                <?php } ?>
            </div>
            <?php //$this->cf->dd($assigned_student_info) ?>

            <?php foreach ($assigned_student_info as $student_info) { ?>
                <div>
                    <div class="col-sm-12 text-left " style="padding: 10px;background-color:#F2F9EA;border: 1px solid #ededed" >
                        <div class="col-sm-3">
                            <?php
                                //echo $student_info->person_first_name; 
                                if(strlen($student_info->person_first_name) < 40){
                                echo $student_info->person_first_name;
                                }else{
                                echo substr($student_info->person_first_name, 0, 30).'...';
                                }
                            ?>
                        </div>
                        <div class="col-sm-3"><?php echo $student_info->person_contact_number; ?></div>
                        <div class="col-sm-4"> 
                            <?php if (strlen($student_info->person_email) < 50) {
                                echo $student_info->person_email;
                                } else {
                                echo substr($student_info->person_email, 0, 45). '...';
                                } ?> 
                            </div>
                        <?php if ($batch_info->course_batch_status != 2) { ?>
                            <div class="col-sm-2">
                                <a href="javascript:void(0);" data-toggle="modal" data-target="#removeStudentalert<?php echo $student_info->student_id; ?>"> 
                                    <i class="fa fa-remove" title="Remove Student"></i> 
                                </a>    
                            </div>
                        <?php } elseif ($batch_info->course_batch_status = 2) { ?>
                            <div class="col-sm-2">
                                <div class="checkbox checkbox-success" style="margin-top: -5px">
                                    <input class="styled" id="student_roll<?= $student_info->student_roll_number; ?>" onchange="assignGradCertificate(this)" type="checkbox" <?php if (isset($student_info->student_certificate_id)) echo 'checked' ?>>
                                    <label for="student_id<?= $student_info->student_roll_number; ?>"></label>&nbsp;&nbsp;&nbsp;                                                                        
                                    <?php $display = isset($student_info->student_certificate_id) ? '' : 'display:none;'; ?>                                    
                                    <span style="margin-top: -5px;<?php echo $display; ?>" id="graduationCap<?php echo $student_info->student_roll_number; ?>">                                       
                                        <a href="<?php echo base_url() . 'view-certificate/' . $student_info->student_roll_number; ?>" target="_blank">
                                            <i class="fa fa-graduation-cap" title="View Certificate"></i>
                                        </a>
                                    </span>                                    

                                </div>                                
                            </div>

                            <div class="modal fade" style="" id="cancelCertificateModal<?php echo $student_info->student_roll_number; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                <?php
                                $id = 'sr' . $student_info->student_roll_number;
                                $message = 'Are you sure to cancel this student\'s Certificate ?';
                                $this->cf->view_modal($id, $message);
                                ?>
                            </div>
                        <?php } ?>
                    </div>
                    <div class="col-sm-12 form-group" id=""></div>
                </div>



<!--                <div class="modal" style="" id="removeStudentalert<?php //echo $student_info->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 style="text-align: center !important">Are you really want to remove this student?</h4>
                            </div>
                            <div class="modal-footer">
                                <div  class="col-sm-12">               
                                    <button 
                                        onclick="removeAssignStudent('<?php //echo $student_info->student_id; ?>', '<?php //echo $course_batch_id; ?>', '<?php// echo $student_number; ?>', '<?php //echo base_url(); ?>remove-assignd-student', '<?php //echo base_url() . $url ?>')" 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="removeStudentalert<?php echo $student_info->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'>Are you really want to remove this student? </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="removeAssignStudent('<?php echo $student_info->student_id; ?>', '<?php echo $course_batch_id; ?>', '<?php echo $student_number; ?>', '<?php echo base_url(); ?>remove-assignd-student', '<?php echo base_url() . $url ?>')" class='btn btn-success col-sm-12' data-dismiss='modal'>Yes</button>
                                                </span>

                                            </div>
                                        </div>            
                                    </div>
                                </div>
                            </div>

            <?php } ?>
            <div class="col-sm-12 form-group" style="" id=''> </div>      
        </div>
    </div>
    <div class="modal fade" style="" id="noCertificateData" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
        <?php
        $id = 'noCertificateData';
        $message = 'Please Create Certificate for This Course First !!';
        $this->cf->view_single_modal($id, $message);
        ?>
    </div>
</div>
<script src="<?php echo base_url() ?>front_end_resource/batch/batch.js" type="text/javascript"></script>
<script src="<?php echo base_url() ?>front_end_resource/certificate/certificate.js" type="text/javascript"></script>

