<div class="col-sm-10">
    <div class="row ">
        <div class="col-sm-12 ">
            <div class="col-sm-12 ">
                <div class="col-sm-12 gray">
                    <div class="col-sm-4 h4">
                        All Menu Information
                    </div>
                    <div class="col-sm-4 col-sm-offset-4 ">
                        <form action="javascript:void(0)" method="post">
                            <div class="input-group">
                                <input type="text" 
                                       class="form-control"
                                       placeholder="Search here..." 
                                       aria-describedby="basic-addon1">
                                <span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

            <div class="col-sm-12" ><br>  <hr></div>
            <div class="col-sm-12" >
                <div class="col-sm-12 gray_ttc" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                    <div class="col-sm-2 padding-zero">Menu Name</div>
                    <div class="col-sm-2 padding-zero">Menu URL</div>
                    <div class="col-sm-2 padding-zero">Parent Menu</div>
                    <div class="col-sm-2 padding-zero">Menu Type</div>
                    <div class="col-sm-2 padding-zero ">Order</div>
                    <div class="col-sm-2 padding-zero">Action</div>
                </div>
                <div class="col-sm-12"><br></div> 

                <?php
                foreach ($all_menu as $menu_value) {
                    ?>
                    <div class="col-sm-12 gray_ttc " style="padding-top: 10px;padding-bottom: 10px;">
                        <div class="col-sm-2 padding-zero"><?php echo $menu_value->menu_name; ?></div>
                        <div class="col-sm-2 padding-zero"><?php echo $menu_value->url; ?></div>
                        <div class="col-sm-2 padding-zero"><?php
                            if (isset($manu_parent_name[$menu_value->menu_id]->menu_name)) {
                                echo $manu_parent_name[$menu_value->menu_id]->menu_name;
                            } else {
                                echo 'None';
                            }
                            ?></div>
                        <div class="col-sm-2 padding-zero">
                            <?php
                            if ($menu_value->menu_type == 1) {
                                echo 'Header';
                            } elseif ($menu_value->menu_type == 2) {
                                echo 'Footer';
                            }
                            ?>
                        </div>
                        <div class="col-sm-2 padding-zero">
                            <span class="col-sm-4"><?php echo $menu_value->menu_order; ?></span>
                            <?php
                            //------------------------Start menu value without parent id and menu section---------------------------
                            if ($menu_value->menu_type == '1' && $menu_value->parent_menu_id == '0' && $menu_value->menu_section == '0') {
                                if (count($header_type1) > 1) {
                                    ?>
                                    <span class="col-sm-8" style="margin-top: -5px">
                                        <?php
                                        if ($header_type1[0] == $menu_value->menu_id) {
                                            if ($menu_value->menu_order != '1') {
                                                ?>
                                                <a class="col-sm-12 padding-zero"
                                                   onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                   href=javascript:void(0)>
                                                    <i class="fa fa-angle-up"></i>
                                                </a> 
                                                <?php
                                            } else {
                                                echo '<span class="col-sm-12" style="margin-top: 10px;"></span>';
                                            }
                                            ?>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                               href="javascript:void(0)">
                                                <i class="fa fa-angle-down"></i>
                                            </a>
                                            <?php
                                        } elseif ($header_type1[count($header_type1) - 1] == $menu_value->menu_id) {
                                            ?>
                                            <span class="col-sm-12" style="margin-top: 7px;"></span>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                               href=javascript:void(0)>
                                                <i class="fa fa-angle-up"></i>
                                            </a>                                                    
                                            <?php
                                        } else {
                                            ?>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                               href=javascript:void(0)>
                                                <i class="fa fa-angle-up"></i>
                                            </a> 
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                               href="javascript:void(0)">
                                                <i class="fa fa-angle-down"></i>
                                            </a>

                                        <?php }
                                        ?>
                                    </span>
                                    <?php
                                }
                            }
                            //------------------------END menu value without parent id and menu section---------------------------
                            //---------------------Start Menu Value whithout section------------------------------
                            if ($menu_value->menu_type == 1 && $menu_value->parent_menu_id != '0' && $menu_value->menu_section == '0') {
//                          
                                if (count($type2_menu_id[$menu_value->parent_menu_id]) > 1) {
                                    ?>
                                    <span class="col-sm-8" style="margin-top: -5px">
                                        <?php
                                        if ($type2_menu_id[$menu_value->parent_menu_id][0] == $menu_value->menu_id) {
                                            if ($menu_value->menu_order != '1') {
                                                ?>
                                                <a class="col-sm-12 padding-zero"
                                                   onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                   href=javascript:void(0)>
                                                    <i class="fa fa-angle-up"></i>
                                                </a> 
                                                <?php
                                            } else {
                                                echo '<span class="col-sm-12" style="margin-top: 10px;"></span>';
                                            }
                                            ?>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                               href="javascript:void(0)">
                                                <i class="fa fa-angle-down"></i>
                                            </a>
                                            <?php
                                        } elseif ($type2_menu_id[$menu_value->parent_menu_id][count($type2_menu_id[$menu_value->parent_menu_id]) - 1] == $menu_value->menu_id) {
                                            ?>
                                            <span class="col-sm-12" style="margin-top: 7px;"></span>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                               href=javascript:void(0)>
                                                <i class="fa fa-angle-up"></i>
                                            </a>                                                    
                                            <?php
                                        } else {
                                            ?>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                               href=javascript:void(0)>
                                                <i class="fa fa-angle-up"></i>
                                            </a> 
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                               href="javascript:void(0)">
                                                <i class="fa fa-angle-down"></i>
                                            </a>

                                        <?php }
                                        ?>
                                    </span>
                                    <?php
                                }
                            }
                            //---------------------End Menu Value whithout section------------------------------
                            //
                            //
                            //
                                //------------------------ Start Select all value---------------------
                            if ($menu_value->menu_type == '1' && $menu_value->parent_menu_id != '0' && $menu_value->menu_section != '0') {
                                foreach ($header_menu_section as $section_value) {
                                    if ($menu_value->menu_section == $section_value->menu_section && $menu_value->parent_menu_id == $section_value->parent_menu_id) {
                                        if (count($type3_menu_id[$section_value->parent_menu_id][$section_value->menu_section]) > 1) {
                                            ?>
                                            <span class="col-sm-8" style="margin-top: -5px">
                                                <?php
                                                if ($type3_menu_id[$section_value->parent_menu_id][$section_value->menu_section][0] == $menu_value->menu_id) {
                                                    if ($menu_value->menu_order != '1') {
                                                        ?>
                                                        <a class="col-sm-12 padding-zero"
                                                           onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                           href=javascript:void(0)>
                                                            <i class="fa fa-angle-up"></i>
                                                        </a> 
                                                        <?php
                                                    } else {
                                                        echo '<span class="col-sm-12" style="margin-top: 10px;"></span>';
                                                    }
                                                    ?>
                                                    <a class="col-sm-12 padding-zero"
                                                       onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                                       href="javascript:void(0)">
                                                        <i class="fa fa-angle-down"></i>
                                                    </a>
                                                    <?php
                                                } elseif ($type3_menu_id[$section_value->parent_menu_id][$section_value->menu_section][count($type3_menu_id[$section_value->parent_menu_id][$section_value->menu_section]) - 1] == $menu_value->menu_id) {
                                                    ?>
                                                    <span class="col-sm-12" style="margin-top: 7px;"></span>
                                                    <a class="col-sm-12 padding-zero"
                                                       onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                       href=javascript:void(0)>
                                                        <i class="fa fa-angle-up"></i>
                                                    </a>                                                    
                                                    <?php
                                                } else {
                                                    ?>
                                                    <a class="col-sm-12 padding-zero"
                                                       onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                       href=javascript:void(0)>
                                                        <i class="fa fa-angle-up"></i>
                                                    </a> 
                                                    <a class="col-sm-12 padding-zero"
                                                       onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                                       href="javascript:void(0)">
                                                        <i class="fa fa-angle-down"></i>
                                                    </a>

                                                <?php }
                                                ?>
                                            </span>
                                            <?php
                                        }
                                    }
                                }
                            }
                            //------------------------ Start Select all value---------------------
//------------------------Start menu footer value without parent id and menu section---------------------------
                            if ($menu_value->menu_type == '2' && $menu_value->parent_menu_id == '0' && $menu_value->menu_section == '0') {
                                if (count($footer_type1) > 1) {
                                    ?>
                                    <span class="col-sm-8" style="margin-top: -5px">
                                        <?php
                                        if ($footer_type1[0] == $menu_value->menu_id) {
                                            if ($menu_value->menu_order != '1') {
                                                ?>
                                                <a class="col-sm-12 padding-zero"
                                                   onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                   href=javascript:void(0)>
                                                    <i class="fa fa-angle-up"></i>
                                                </a> 
                                                <?php
                                            } else {
                                                echo '<span class="col-sm-12" style="margin-top: 10px;"></span>';
                                            }
                                            ?>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                               href="javascript:void(0)">
                                                <i class="fa fa-angle-down"></i>
                                            </a>
                                            <?php
                                        } elseif ($footer_type1[count($footer_type1) - 1] == $menu_value->menu_id) {
                                            ?>
                                            <span class="col-sm-12" style="margin-top: 7px;"></span>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                               href=javascript:void(0)>
                                                <i class="fa fa-angle-up"></i>
                                            </a>                                                    
                                            <?php
                                        } else {
                                            ?>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                               href=javascript:void(0)>
                                                <i class="fa fa-angle-up"></i>
                                            </a> 
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                               href="javascript:void(0)">
                                                <i class="fa fa-angle-down"></i>
                                            </a>

                                        <?php }
                                        ?>
                                    </span>
                                    <?php
                                }
                            }
                            //------------------------END menu footer value without parent id and menu section---------------------------
                            //---------------------Start Menu Value whithout section------------------------------
                            if ($menu_value->menu_type == 1 && $menu_value->parent_menu_id != '0' && $menu_value->menu_section == '0') {
                                if (count($footer_type2) > 1) {
                                    ?>
                                    <span class="col-sm-8" style="margin-top: -5px">
                                        <?php
                                        if ($footer_type2[0] == $menu_value->menu_id) {
                                            if ($menu_value->menu_order != '1') {
                                                ?>
                                                <a class="col-sm-12 padding-zero"
                                                   onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                   href=javascript:void(0)>
                                                    <i class="fa fa-angle-up"></i>
                                                </a> 
                                                <?php
                                            } else {
                                                echo '<span class="col-sm-12" style="margin-top: 10px;"></span>';
                                            }
                                            ?>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                               href="javascript:void(0)">
                                                <i class="fa fa-angle-down"></i>
                                            </a>
                                            <?php
                                        } elseif ($footer_type2[count($footer_type2) - 1] == $menu_value->menu_id) {
                                            ?>
                                            <span class="col-sm-12" style="margin-top: 7px;"></span>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                               href=javascript:void(0)>
                                                <i class="fa fa-angle-up"></i>
                                            </a>                                                    
                                            <?php
                                        } else {
                                            ?>
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                               href=javascript:void(0)>
                                                <i class="fa fa-angle-up"></i>
                                            </a> 
                                            <a class="col-sm-12 padding-zero"
                                               onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                               href="javascript:void(0)">
                                                <i class="fa fa-angle-down"></i>
                                            </a>

                                        <?php }
                                        ?>
                                    </span>
                                    <?php
                                }
                            }
                            //---------------------End Menu Value whithout section------------------------------
                            //------------------------ Start footer menu all value without parent---------------------
                            if ($menu_value->menu_type == '2' && $menu_value->parent_menu_id == '0' && $menu_value->menu_section != '0') {
                                foreach ($footer_section_without_parent as $section_value) {
//                                    
                                    if ($menu_value->menu_section == $section_value->menu_section) {

                                        if (count($footer_section_type[$section_value->menu_section]) > 1) {
                                            ?>
                                            <span class="col-sm-8" style="margin-top: -5px">
                                                <?php
                                                if ($footer_section_type[$section_value->menu_section][0] == $menu_value->menu_id) {
                                                    if ($menu_value->menu_order != '1') {
                                                        ?>
                                                        <a class="col-sm-12 padding-zero"
                                                           onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                           href=javascript:void(0)>
                                                            <i class="fa fa-angle-up"></i>
                                                        </a> 
                                                        <?php
                                                    } else {
                                                        echo '<span class="col-sm-12" style="margin-top: 10px;"></span>';
                                                    }
                                                    ?>

                                                    <a class="col-sm-12 padding-zero"
                                                       onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                                       href="javascript:void(0)">
                                                        <i class="fa fa-angle-down"></i>
                                                    </a>
                                                    <?php
                                                } elseif ($footer_section_type[$section_value->menu_section][count($footer_section_type[$section_value->menu_section]) - 1] == $menu_value->menu_id) {
                                                    ?>
                                                    <span class="col-sm-12" style="margin-top: 7px;"></span>
                                                    <a class="col-sm-12 padding-zero"
                                                       onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                       href=javascript:void(0)>
                                                        <i class="fa fa-angle-up"></i>
                                                    </a>                                                    
                                                    <?php
                                                } else {
                                                    ?>
                                                    <a class="col-sm-12 padding-zero"
                                                       onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'up')"
                                                       href=javascript:void(0)>
                                                        <i class="fa fa-angle-up"></i>
                                                    </a> 
                                                    <a class="col-sm-12 padding-zero"
                                                       onclick="changeOrder('<?php echo base_url() . 'super-admin/change-menu-order' ?>', '<?php echo $menu_value->menu_id ?>', 'down')"
                                                       href="javascript:void(0)">
                                                        <i class="fa fa-angle-down"></i>
                                                    </a>

                                                <?php }
                                                ?>
                                            </span>
                                            <?php
                                        }
                                    }
                                }
                            }
                            //------------------------ End footer menu all value without parent---------------------
                            ?>



                        </div>

                        <div class="col-sm-2 padding-zero" id="menu_action<?php echo $menu_value->menu_id; ?>">
                            <span>&nbsp;&nbsp;</span>
                            <?php
                            if ($menu_value->menu_status == 2) {
                                ?>
                                <a href="javascript:void(0)"
                                   onclick="checkChildID('<?php echo base_url() . 'super-admin/change-menu-status/' . $menu_value->menu_id; ?>', 'active', '<?php echo $menu_value->menu_id; ?>')" >
                                    <i class="fa fa-user-plus" title="Acitve"></i>
                                </a>
                                <span>&nbsp</span>
                                <?php
                            } else {
                                if ($menu_value->menu_status == 1) {
                                    ?>
                                    <a href="javascript:void(0)"
                                       onclick="checkChildID('<?php echo base_url() . 'super-admin/change-menu-status/' . $menu_value->menu_id; ?>', 'inactive', '<?php echo $menu_value->menu_id; ?>')" >
                                        <i class="fa fa-user-times" title="Inactive"></i>
                                    </a>
                                    <span>&nbsp</span>
                                    <a href="javascript:void(0)"
                                       onclick="checkChildID('<?php echo base_url() . 'super-admin/change-menu-status/' . $menu_value->menu_id; ?>', 'archive', '<?php echo $menu_value->menu_id; ?>')" >
                                        <i class="fa fa-archive" title="Archive"></i>
                                    </a>
                                    <span>&nbsp</span>
                                    <?php
                                } else if ($menu_value->menu_status == 3) {
                                    ?>
                                    <a href="javascript:void(0)"
                                       onclick="checkChildID('<?php echo base_url() . 'super-admin/change-menu-status/' . $menu_value->menu_id; ?>', 'active', '<?php echo $menu_value->menu_id; ?>')" >
                                        <i class="fa fa-user-plus" title="Acitve"></i>
                                    </a>
                                    <span>&nbsp</span>
                                    <a href="javascript:void(0)"
                                       onclick="checkChildID('<?php echo base_url() . 'super-admin/change-menu-status/' . $menu_value->menu_id; ?>', 'archive', '<?php echo $menu_value->menu_id; ?>')" >
                                        <i class="fa fa-archive" title="Archive"></i>
                                    </a>
                                    <span>&nbsp</span>
                                    <?php
                                }
                            }
                            ?>

                            <a href="javascript:void(0)"
                               onclick="checkChildID('<?php echo base_url() . 'super-admin/change-menu-status/' . $menu_value->menu_id; ?>', 'delete', '<?php echo $menu_value->menu_id; ?>')" >
                                <i class="fa fa-trash-o" title="Delete"></i>
                            </a>
                            <span>&nbsp</span>
                            <a href="<?php echo base_url() ?>super-admin/edit-menu/<?php echo $menu_value->url; ?>"><i class="fa fa-edit" title="Edit"></i></a>
                        </div>
                    </div>
                    <?php
                }
                ?>

                <?php
                $total_page = ceil($total_menu->total_menu / 10);
                if ($total_page > 1) {
                    ?>
                    <nav class="course-pagination">
                        <ul class="pagination">
                            <?php
                            if ($page > 2) {
                                ?>
                                <li>
                                    <a href="<?php echo base_url() . 'super-admin/manage-menu'; ?>" aria-label="Previous">
                                        <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="<?php echo base_url() . 'super-admin/manage-menu/' . ($page - 1); ?>" aria-label="Previous">
                                        <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                    </a>
                                </li>
                            <?php } elseif ($page > 1) { ?>
                                <li>
                                    <a href="<?php echo base_url() . 'super-admin/manage-menu/' . ($page - 1); ?>" aria-label="Previous">
                                        <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                    </a>
                                </li>
                                <?php
                            }
                            for ($i = 0; $total_page > $i; $i++) {
                                echo '<li><a href="' . base_url() . 'super-admin/manage-menu/' . ($i + 1) . '">' . ($i + 1) . '</a></li>';
                            }
                            if ($total_page != $page) {
                                ?>
                                <li>
                                    <a href="<?php echo base_url() . 'super-admin/manage-menu/' . ($page + 1); ?>" aria-label="Next">
                                        <span aria-hidden="true" title="Next Page">&raquo;</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="<?php echo base_url() . 'super-admin/manage-menu/' . $total_page; ?>" aria-label="Next">
                                        <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                                    </a>
                                </li>
                            <?php } ?>
                        </ul>
                    </nav>
                <?php } ?>


            </div>


            <div class="col-sm-12 "><br></div>
            <div class="col-sm-12 ">
                <div class="col-sm-12 gray" style="padding-left: 10px">
                    <a href="<?php echo base_url(); ?>super-admin">Dashboard</a>->> <span>Manage Menu </span>
                </div>
            </div>
            <div class="col-sm-12 "><br></div>
        </div>
    </div>
</div>

<script type="text/javascript" src="<?php echo base_url() ?>back_end_resource/menu/menu.js">
</script>

<script>
    checkChildIDURL = '<?php echo base_url(); ?>super_admin/check_child_id/';
</script>