<div class="col-sm-10 ">
    <div class="col-sm-12 gray" >
        <h4 class="text-center">Add Menu Information</h4><hr><br>
        <div class="table-responsive col-sm-12">
            <?php
//            echo validation_errors();
            $url = 'super-admin/add-menu';
            echo form_open($url, 'class="" id="formID1" name="add_menu"');
            ?>

            <div class="form-group col-sm-10">
                <div class="form-group col-sm-5">
                    <select name="menu_type" 
                            id="menu_type"
                            onchange="getMenuType(this.value, '<?php echo base_url() ?>super-admin/get-parent-menu/');"
                            class="form-control validate[required] text-input"
                            data-errormessage-value-missing="Manu Type is required!">
                        <option value="">--Select Menu Type--</option>
                        <option value="1">Header Menu </option>
                        <option value="2">Footer Menu</option>
                    </select>
                </div>



                <div class="form-group col-sm-5">
                    <input data-errormessage-value-missing="Type Menu order!" type="number" 
                           class="form-control text-input" 
                           id="menu_order" 
                           name="menu_order"
                           oninput="getInputMenuOrder(this.value)"
                           placeholder="Please type Menu order"  
                           value="<?php echo set_value('menu_order'); ?>">
                </div>
            </div>




            <div class="form-group col-sm-10">
                <div class="form-group col-sm-5">
                    <select class="form-control"
                            name="parent_menu"
                            id="parent_menu"
                            onchange="getParentMenu(this.value);" >
                        <option value="">--Select Parent Menu --</option>

                    </select>
                </div>



                <div class="form-group col-sm-5">
                    <input type="text" 
                           data-errormessage-value-missing="Menu Name!"
                           class="form-control validate[required, custom[manuNameExistence]] text-input" 
                           id="menu_name" 
                           name="menu_name" 
                           oninput="checkManuExists(this.value,'<?php echo base_url() . 'super_admin/manu_name_existance' ?>')"
                           value="<?php echo set_value('menu_name'); ?>"
                           placeholder="Please type Menu Name" >
                    <input name="manu_name_exist" id="manu_name_exist" type="hidden" value="">
                </div>
            </div>









            <div class="form-group col-sm-10">
                <div class="form-group col-sm-5" id="div_menu_url" >
                    <input type="text" 
                           name="menu_url"
                           id="menu_url"
                           data-errormessage-value-missing="Menu URL is Required!"
                           class="form-control validate[required, custom[urlSpecialCaracter], custom[spaceFunction], custom[urlExistence], custom[noCapital]] text-input" 
                           class="form-control col-sm-8" 
                           value="<?php echo set_value('menu_url'); ?>"
                           oninput="checkProfileUrl(this.value)"
                           placeholder="Please Type Menu URL">
                    <input name="url_exist" id="url_exist" type="hidden" value="">
                </div>



                <div class="form-group col-sm-5">
                    <select name="menu_section_name" 
                            id="menu_section_name"
                            class="form-control text-input"
                            onchange="getSectionTextField(this.value)"
                            data-errormessage-value-missing="Manu Type is required!">
                        <option value="">--Select Menu Section--</option>
                        <option value="1">Other</option>
                    </select>
                    <script>
                        document.forms['add_menu'].elements['menu_section_name'].value = '<?php echo set_value('menu_section_name'); ?>';
                    </script>
                </div>

                
                
                
                <div class="form-group col-sm-5" id="section_text" style="display: none;">
                    <input type="text" 
                           data-errormessage-value-missing="Menu Secttion Name!"
                           class="form-control validate[required] text-input" 
                           id="new_menu_section_name"
                           name="new_menu_section_name" 
                           value="<?php echo set_value('new_menu_section_name'); ?>" 
                           placeholder="Please type Menu Section Name" >
                </div>






                <div class="form-group col-sm-5" id="div_menu_status" style="margin-top:15px;">
                    <label for="person_status"> Status  : </label>
                    <div class="radio radio-success col-sm-9 pull-right margin-zero" >
                        <input type="radio" 
                               name="manu_status" 
                               class="manu_status validate[required]" 
                               id="published" value="1">
                        <label for="published">Active</label>
                        <span style="margin-right: 30px"></span>
                        <input type="radio" 
                               name="manu_status" 
                               class="manu_status validate[required]" 
                               id="unpublished" value="3">
                        <label for="unpublishded">Inactive</label>
                    </div>
                </div>



            </div>
            <div class=" col-sm-10" >
                <div class=" col-sm-10 " >
                    <center>
                        <button class="btn btn-success" id="submit" type="submit">Add Menu</button>
                        <a href="<?php echo base_url() ?>super-admin/add-menu" class="btn btn-success">Cancel</a>
                    </center>

                </div>
                <div class=" col-sm-10 " ><br></div>
            </div>
            <?php echo form_close(); ?>
        </div>  
        <input type="hidden" value="<?php echo base_url(); ?>super-admin/get-menu-order/" id="menuOrderURL">
    </div>

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

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

<script>
                    menuURLExists = '<?php echo base_url(); ?>super_admin/check_menu_url_existance/';
                    menuOrderURL = '<?php echo base_url(); ?>super-admin/get-menu-order/';
                    menuSectionURL = '<?php echo base_url() ?>super-admin/get-section-menu/';
</script>

<script>
    document.forms['add_menu'].elements['menu_type'].value = '<?php echo set_value('menu_type'); ?>';
    document.forms['add_menu'].elements['parent_menu'].value = '<?php echo set_value('parent_menu'); ?>';
    document.forms['add_menu'].elements['manu_status'].value = '<?php echo set_value('manu_status'); ?>';
    getSectionTextField('<?php echo set_value('menu_section_name') ?>');
</script>