<div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
    <div class="col-sm-9 text-left"> Batch Details </div>
    <div class="col-sm-3">Action</div>
</div>
<div class="col-sm-12"><br></div>

<?php
if ($batch) {
    $i = 1;
    $security_salt = '#' . rand(1, 99999);

    foreach ($batch as $value) {
        $s_id = $value->course_batch_id . $security_salt;
        $e_id = $this->encrypt->encode($s_id);
        $e_id = str_replace("/", "%F2", $e_id);
        ?>
        <div id="actions_for<?php echo $value->course_batch_id; ?>">
            <div class="col-sm-12 <?php
            if ($i % 2 == 0) {
                echo 'gray';
            } else {
                echo 'white';
            }
            ?>" >
                <div class="col-sm-12 gray text-center" >
                    <div class="col-sm-9 text-left" style="padding: 20px">
                        <address>
                            <span style="font-weight: bold;margin-right: 50px">Batch Name : </span>
                            <?php echo $value->course_batch_name; ?><br>

                            <span style="font-weight: bold;margin-right: 53px">Course Tile : </span>
                            <a href="<?php echo base_url() . $value->url; ?>"  target="_blank">
                                <?php echo $value->course_name; ?>
                            </a><br>

                            <?php
                            $student_id = explode(',', $value->student_id);
                            ?>
                            <span style="font-weight: bold;margin-right: 6px">Number of student : </span>
                            <a href="<?php echo base_url() . 'super-admin/batch-assigned-student/' . $value->url . '/' . $e_id; ?>">
                                <?php
                                if ($value->student_id) {
                                    echo count($student_id);
                                } else {
                                    echo 0;
                                }
                                ?>
                            </a><br>

                            <span style="font-weight: bold;margin-right: 68px">Start date : </span>
                            <?php
                            if ($value->course_start_date != '') {
                                echo date('d F, Y', strtotime($value->course_batch_start_date));
                            }
                            ?><br>

                            <span style="font-weight: bold;margin-right: 58px">Finish date : </span>
                            <?php
                            if ($value->course_start_date != '') {
                                echo date('d F, Y', strtotime($value->course_batch_finish_date));
                            }
                            ?><br>

                            <span style="font-weight: bold;margin-right: 115px">By : </span>
                            <a href="<?php echo base_url() . $resource_person_info[$value->course_batch_id]->url . '/profile'; ?>" target="_blank">
                                <?php echo $resource_person_info[$value->course_batch_id]->person_first_name . ' ' . $resource_person_info[$value->course_batch_id]->person_last_name; ?>
                            </a>
                            <br>
                        </address>
                    </div>

                    <div class="col-sm-3" style="padding-top: 10px">

                        <a href="<?php echo base_url() . 'super-admin/edit-batch/' . $value->course_batch_id; ?>">
                            <i class="fa fa-edit" title="Edit"></i>
                        </a>&nbsp;&nbsp;&nbsp;

                        <a href="javascript:;" 
                           onclick="return checkForAction('<?php echo base_url() . 'super-admin/delete-course-batch/' . $value->course_batch_id; ?>', 'Delete', <?php echo $value->course_batch_id; ?>)">
                            <i class="fa fa-trash-o" title="Delete"></i> 
                        </a>&nbsp;&nbsp;&nbsp;

                        <a href="javascript:;" 
                           onclick="return checkForAction('<?php echo base_url() . 'super-admin/cancel-course-batch/' . $value->course_batch_id; ?>', 'Cancel', <?php echo $value->course_batch_id; ?>)">
                            <i class="fa  fa-remove" title="Cancel Class"></i>
                        </a>&nbsp;&nbsp;&nbsp;

                        <a href="<?php echo base_url() . 'super-admin/course-registered-student/' . $value->url . '/1/' . $e_id; ?>" >
                            <i class="fa fa-user-plus" title="Manage batch student"></i>
                        </a>&nbsp;&nbsp;&nbsp;

                        <a href="<?php echo base_url() . 'super-admin/batch-assigned-student/' . $value->url . '/' . $e_id; ?>" >
                            <i class="fa fa-users" title="Batch student"></i>
                        </a>&nbsp;&nbsp;&nbsp;

                    </div>

                </div>
                <div class="col-sm-12"><br></div>
            </div>
        </div>
        <?php
        $i++;
    }
} else {
    echo 'Created batch not foud';
}
?>
<!--------------------Created batch start Pagination---------------------------->
<div class="col-sm-12">
    <?php $total_page = ceil($total_batch / $per_page_view); ?>
    <div class="col-sm-12 form-group">
        <?php
        if ($total_page > 1) {
            ?>
            <nav class="course-pagination">
                <ul class="pagination">
                    <?php
                    if ($page > 2) {
                        ?>
                        <li>
                            <a href='javascript:;' onclick="pagination('<?php echo base_url() . 'super-admin/manage-batch/created-batch/1'; ?>', 'created')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href='javascript:;' onclick="pagination('<?php echo base_url() . 'super-admin/manage-batch/created-batch' . '/' . ($page - 1); ?>', 'created')" 
                               aria-label="Previous">
                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                            </a>
                        </li>
                    <?php } elseif ($page > 1) { ?>
                        <li>
                            <a href='javascript:;' onclick="pagination('<?php echo base_url() . 'super-admin/manage-batch/created-batch' . '/' . ($page - 1); ?>', 'created')"  
                               aria-label="Previous">
                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                            </a>
                        </li>
                        <?php
                    }
                    $count_page = 0;
                    if ($total_page < 10) {
                        for ($i = $page; $total_page >= $i; $i++) {
                            ?>
                            <li>
                                <a <?php
                                if ($page == $i) {
                                    echo 'style="background-color:#80c12c; color:#fff;"';
                                }
                                ?>
                                    href='javascript:;' onclick="pagination('<?php echo base_url() . 'super-admin/manage-batch/created-batch' . '/' . $i; ?>', 'created')">
                                        <?php echo $i ?>
                                </a>
                            </li>
                            <?php
                        }
                    } else if ($page + 10 <= $total_page) {
                        $count_page = $page + 10;
                        for ($i = $page; $count_page > $i; $i++) {
                            ?>
                            <li>
                                <a <?php
                                if ($page == $i) {
                                    echo 'style="background-color:#80c12c; color:#fff;"';
                                }
                                ?>
                                    href='javascript:;' onclick="pagination('<?php echo base_url() . 'super-admin/manage-batch/created-batch' . '/' . $i; ?>', 'created')" >
                                        <?php echo $i ?>
                                </a>
                            </li>
                            <?php
                        }
                    } else {
                        for ($i = $total_page - 10; $total_page > $i; $i++) {
                            ?>
                            <li>
                                <a <?php
                                if ($page == $i + 1) {
                                    echo 'style="background-color:#80c12c; color:#fff;"';
                                }
                                ?>
                                    href="javascript:;"  onclick="pagination('<?php echo base_url() . 'super-admin/manage-batch/created-batch' . '/' . ($i + 1); ?>', 'created')" > 
                                        <?php echo ($i + 1) ?>
                                </a>
                            </li>
                            <?php
                        }
                    }

                    if ($total_page > $page + 10) {
                        ?>
                        <li>
                            <a href="javascript:;" onclick="pagination('<?php echo base_url() . 'super-admin/manage-batch/created-batch' . '/' . ($page + 1); ?>', 'created')" aria-label="Next">
                                <span aria-hidden="true" title="Next Page">&raquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href="javascript:;" onclick="pagination('<?php echo base_url() . 'super-admin/manage-batch/created-batch' . '/' . $total_page; ?>', 'created')" aria-label="Next">
                                <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                            </a>
                        </li>
                    <?php } ?>
                </ul>
            </nav>
        <?php } ?>
    </div>
</div>