<!-- **********************************************************************************************************************************************************
    MAIN CONTENT
    *********************************************************************************************************************************************************** -->
<!--main content start-->
<section id="main-content">
    <section class="wrapper">
        <div class="row mt">
            <div class="col-lg-12">
                <div class="content-panel">
                    <h4 class="pull-left"><i class="fa fa-angle-right"></i> Data Sub Menu</h4>
                    <div class="pull-right" style="padding-right: 10px;">
                        <a href="<?= base_url() ?>admin/sub_menu/tambah_data">
                            <button type="button" class="btn btn-primary btn-xs">Insert Data</button>
                        </a>
                        <a href="<?= base_url() ?>admin/sub_menu/changeorder">
                            <button type="button" class="btn btn-info btn-xs">Change Order</button>
                        </a>
                    </div>
                    <section id="unseen">
                        <table id="example" class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>Main Menu</th>
                                    <th>Menu Name</th>
                                    <th>No Urut</th>
                                    <th style="width: 10%">Active</th>
                                    <th style="width: 10%">&nbsp;</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                if ($data_sub_menu->num_rows == 0) {
                                    echo "<tr><td colspan='5'>Data Belum Ada</td></tr>";
                                } else {
                                    foreach ($data_sub_menu->result() as $sub) {
                                        ?>
                                        <tr>
                                            <td><?= $sub->menu_name ?></td>
                                            <td><?= $sub->title ?></td>
                                            <td class="numeric"><?= $sub->order ?></td>
                                            <td><?= $sub->active ?></td>
                                            <td>
                                                <div class="btn-group">
                                                    <button type="button" class="btn btn-theme dropdown-toggle" data-toggle="dropdown">
                                                        Action <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu" role="menu">
                                                        <li><a href="<?= base_url() ?>admin/sub_menu/edit_data/<?= $sub->id_sub_menu ?>">Edit Data</a></li>
                                                        <li><a href="<?= base_url() ?>admin/sub_menu/add_banner/<?= $sub->id_sub_menu ?>">Add Banner</a></li>
                                                        <li>
                                                            <?php
                                                            if ($sub->active == "Yes") {
                                                                ?>
                                                                <a href="<?= base_url() ?>admin/sub_menu/changeNonActive/<?= $sub->id_sub_menu ?>">Change NonActive</a>
                                                                <?php
                                                            } else {
                                                                ?>
                                                                <a href="<?= base_url() ?>admin/sub_menu/changeActive/<?= $sub->id_sub_menu ?>">Change Active</a>
                                                                <?php
                                                            }
                                                            ?>
                                                        </li>
                                                        <li><a href="<?= base_url() ?>admin/sub_menu/deleteData/<?= $sub->id_sub_menu ?>" onclick="return confirm('Yakin Menghapus?')">Delete</a></li>
                                                    </ul>
                                                </div>
                                            </td>
                                        </tr>
                                        <?php
                                    }
                                }
                                ?>

                            </tbody>
                        </table>
                    </section>
                    <div style="clear: both"></div>
                </div>
            </div>
        </div><!--row -->
    </section>
</section>
