<!-- **********************************************************************************************************************************************************
    MAIN CONTENT
    *********************************************************************************************************************************************************** -->
<!--main content start-->

<?php
if ($data_menu->num_rows() == 0) {
    $id = "";
    $name = "";
    $order = "";
    $active = "";
    $key_page = "";
} else {
    foreach ($data_menu->result() as $menu) {
        $id = $menu->id_menu;
        $name = $menu->menu_name;
        $order = $menu->order;
        $active = $menu->active;
        $key_page = $menu->key_page;
    }
}
?>
<section id="main-content">
    <section class="wrapper">
        <div class="row mt">
            <div class="col-lg-12">
                <div class="form-panel">
                    <h4 class="mb"><i class="fa fa-angle-right"></i> Main Menu</h4>
                    <form class="form-horizontal style-form" method="POST" action="<?= base_url() ?>admin/menu/simpanData" enctype="multipart/form-data">
                        <input type="hidden" name="id_menu" value="<?= $id ?>">
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">Main Menu</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" value="<?= $name ?>" name="menu_name">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">Order Number</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" value="<?= $order ?>" name="no_order">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">Picture</label>
                            <div class="col-sm-10">
                                <input type="file" class="form-control" name="userfile">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">Active</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="active">
                                    <option value="<?= $active ?>"><?= $active ?></option>
                                    <option>-Choose One-</option>
                                    <option value="Yes">Yes</option>
                                    <option value="No">No</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">Content</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="key_page">
                                    <option value="">-Choose One-</option>
                                    <?php
                                    foreach ($data_page as $pg) {
                                        if ($key_page == $pg->key_page) {
                                            $select = "selected";
                                        } else {
                                            $select = "";
                                        }
                                        ?>
                                        <option <?= $select ?> value="<?= $pg->key_page ?>"><?= $pg->title ?> (<?= $pg->key_page ?>)</option>
                                        <?php
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>

                        <hr/>
                        <a href="<?= base_url() ?>admin/menu">
                            <button type="button" class="btn btn-default"><i class="fa fa-arrow-left"></i> Cancel</button>
                        </a>
                        <button type="submit" class="btn btn-primary pull-right"><i class="fa fa-save"></i> Save Data</button>
                    </form>
                    <div style="clear: both"></div>
                </div>
            </div>
        </div><!--row -->
    </section>
</section>
