<?php
if ($course_register_student) {
    foreach ($course_register_student as $student_value) {
        if($course_info->course_type == 1){
            //foreach($random_number as $random_num){
                if($student_value->person_id){
                    //if($random_num['payment_status'] == 1 || $random_num['payment_status'] == 2 || $random_num['payment_status'] == 6 || $random_num['payment_status'] == 3 || $random_num['payment_status'] == 4 || $random_num['payment_status'] == 5 || $random_num['payment_status'] == 7){
                    ?>
                    <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; ?>
                                </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; ?></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];
                                //}
                                ?>
                            </div>
                            <div class="col-sm-2">
                                <?php
                                if ($course_info->course_type == 1) {
                                    $total_checked_box = $total_checked_boxes[$student_value->student_id]->total_checked;  //tania
                                    $person_id = $this->encryption->encrypt($student_value->person_id);
                                    $person_id = strtr($person_id,array('+' => '.', '=' => '-', '/' => '~'));
                                ?>
                                    <a href="<?php echo base_url('student/partial-invoice/'.$course_info->url.'/'.$person_id); ?>" target="_blank">  
                                        <i class="fa fa-dollar" title="Invoice">&nbsp;&nbsp;</i>
                                    </a>
                                    <?php if ($total_checked_box == 0) { ?>
                                    <span class="padding-zero" 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 $total_checked_box; ?>')" id="addBatch">  
                                            <i class="fa fa-ge" title="Add Batch">&nbsp;&nbsp;</i>
                                        </a>
                                    </span>
                                    <span class="padding-zero" id="deleteIcon<?php echo $student_value->student_id; ?>" style="display:block">
                                        <a href="javascript:void(0);" data-toggle="modal" data-target="#removeStuddent<?php echo $student_value->student_id; ?>" >  
                                            <i id="deleteicon" class="fa fa-trash-o" title="Remove"></i>
                                        </a>
                                    </span>
                                    <span class="padding-zero" id="viewIcon<?php echo $student_value->student_id; ?>" style="display:none"> 
                                        <a href="javascript:void(0);" onclick="viewBatch('<?php echo base_url(); ?>view-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo $course_info->course_id; ?>')" >  
                                            <i class="fa fa-th" title="View batch"></i>
                                        </a>
                                    </span>
                                <?php } else if ($total_checked_box == 1) { ?>
                                    <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 $total_checked_box; ?>')" id="addBatch">  
                                            <i class="fa fa-ge" title="Add Batch">&nbsp;&nbsp;</i>
                                        </a>
                                    </span>
                                    <span id="deleteIcon<?php echo $student_value->student_id; ?>" style="display: none">
                                        <a href="javascript:void(0);" data-toggle="modal" data-target="#removeStuddent<?php echo $student_value->student_id; ?>" >  
                                            <i id="deleteicon" class="fa fa-trash-o" title="Remove"></i>
                                        </a>
                                    </span>
                                    <span id="viewIcon<?php echo $student_value->student_id; ?>" style="display: block"> 
                                        <a href="javascript:void(0);" onclick="viewBatch('<?php echo base_url(); ?>view-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo $course_info->course_id; ?>')" >  
                                            <i class="fa fa-th" title="View batch"></i>
                                        </a>
                                    </span>
                                <?php } else if ($total_checked_box == 2) { ?>
                                    <span id="addBatch<?php echo $student_value->student_id; ?>" style="display: none">
                                        <a href="javascript:void(0);" onclick="assignBatch('<?php echo base_url(); ?>assign-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo $total_checked_box; ?>')" id="addBatch">  
                                            <i class="fa fa-ge" title="Add Batch">&nbsp;&nbsp;</i>
                                        </a>
                                    </span>
                                    <span id="deleteIcon<?php echo $student_value->student_id; ?>" style="display: none">
                                        <a href="javascript:void(0);" data-toggle="modal" data-target="#removeStuddent<?php echo $student_value->student_id; ?>" >  
                                            <i id="deleteicon" class="fa fa-trash-o" title="Remove"></i>
                                        </a>
                                    </span>
                                    <span id="viewIcon<?php echo $student_value->student_id; ?>" style="display: block"> 
                                        <a href="javascript:void(0);" onclick="viewBatch('<?php echo base_url(); ?>view-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo $course_info->course_id; ?>')" >  
                                            <i class="fa fa-th" title="View batch"></i>
                                        </a>
                                    </span>                           
                                <?php } ?>

                                    <div class="modal" style="" id="removeStuddent<?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">Are you sure you want to Remove this Student?</h4>
                                                </div>
                                                <div class="modal-footer">
                                                    <div  class="col-sm-12">               
                                                        <button onclick="removeRegisterStudent('<?php echo base_url() . 'user/remove-registered-student' ?>', '<?php echo $student_value->student_roll_number; ?>')" 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>
                                    <?php
                                }
                                ?>

                            </div>
                            <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
                    //break;
                    }
                //}
            }
        //}
        if($course_info->course_type == 2){ 
        ?>
            <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; ?>
                    </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; ?></div>
                <div class="col-sm-2 text-center">
                    <?php
                    if ($course_info->course_type == 2) {
                        echo 'Free';
                    }
                    ?>
                </div>
                <div class="col-sm-2">
                <?php
                    if ($course_info->course_type == 2) {
                        $total_checked_box = $total_checked_boxes[$student_value->student_id]->total_checked;  //tania
                        ?>
                        <?php if ($total_checked_box == 0) { ?>
                            <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 $total_checked_box; ?>')" id="addBatch">  
                                    <i class="fa fa-ge" title="Add Batch">&nbsp;&nbsp;</i>
                                </a>
                            </span>
                            <span id="deleteIcon<?php echo $student_value->student_id; ?>" style="display:block">
                                <a href="javascript:void(0);" data-toggle="modal" data-target="#removeStuddent<?php echo $student_value->student_id; ?>" >  
                                    <i id="deleteicon" class="fa fa-trash-o" title="Remove"></i>
                                </a>
                            </span>
                            <span id="viewIcon<?php echo $student_value->student_id; ?>" style="display:none"> 
                                <a href="javascript:void(0);" onclick="viewBatch('<?php echo base_url(); ?>view-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo $course_info->course_id; ?>')" >  
                                    <i class="fa fa-th" title="View batch"></i>
                                </a>
                            </span>
                        <?php } else if ($total_checked_box == 1) { ?>
                            <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 $total_checked_box; ?>')" id="addBatch">  
                                    <i class="fa fa-ge" title="Add Batch">&nbsp;&nbsp;</i>
                                </a>
                            </span>
                            <span id="deleteIcon<?php echo $student_value->student_id; ?>" style="display: none">
                                <a href="javascript:void(0);" data-toggle="modal" data-target="#removeStuddent<?php echo $student_value->student_id; ?>" >  
                                    <i id="deleteicon" class="fa fa-trash-o" title="Remove"></i>
                                </a>
                            </span>
                            <span id="viewIcon<?php echo $student_value->student_id; ?>" style="display: block"> 
                                <a href="javascript:void(0);" onclick="viewBatch('<?php echo base_url(); ?>view-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo $course_info->course_id; ?>')" >  
                                    <i class="fa fa-th" title="View batch"></i>
                                </a>
                            </span>
                        <?php } else if ($total_checked_box == 2) { ?>
                            <span id="addBatch<?php echo $student_value->student_id; ?>" style="display: none">
                                <a href="javascript:void(0);" onclick="assignBatch('<?php echo base_url(); ?>assign-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo $total_checked_box; ?>')" id="addBatch">  
                                    <i class="fa fa-ge" title="Add Batch">&nbsp;&nbsp;</i>
                                </a>
                            </span>
                            <span id="deleteIcon<?php echo $student_value->student_id; ?>" style="display: none">
                                <a href="javascript:void(0);" data-toggle="modal" data-target="#removeStuddent<?php echo $student_value->student_id; ?>" >  
                                    <i id="deleteicon" class="fa fa-trash-o" title="Remove"></i>
                                </a>
                            </span>
                            <span id="viewIcon<?php echo $student_value->student_id; ?>" style="display: block"> 
                                <a href="javascript:void(0);" onclick="viewBatch('<?php echo base_url(); ?>view-student-batch', '<?php echo $student_value->student_id; ?>', '<?php echo $course_info->course_id; ?>')" >  
                                    <i class="fa fa-th" title="View batch"></i>
                                </a>
                            </span>
                        <?php } ?>


                        <div class="modal" style="" id="removeStuddent<?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">Are you sure you want to Remove this Student?</h4>
                                    </div>
                                    <div class="modal-footer">
                                        <div  class="col-sm-12">               
                                            <button onclick="removeRegisterStudent('<?php echo base_url() . 'user/remove-registered-student' ?>', '<?php echo $student_value->student_roll_number; ?>')" 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>
                        <?php
                    }
                    ?>
                    </div>
                    <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 $register_course_student_paginzation_link;
} else {
    echo get_message('course_register_msg');
}
