<div class="submenu">
    <center><?php echo $this->element('menus/sessions/menu'); ?></center>
</div>

<div class="submenu">
    <center><?php echo $this->element('menus/menu/menu'); ?></center>
</div>
<div class="submenu">
    <center><?php echo $this->element('menus/menu/subsubmenu'); ?></center>
</div>
<hr class="separate-title" />



<div class="row section-sub-title">
    <div class="col-sm-12">
        <h3 align="center"><?= 'Edit ' . $pageSubTitle ?></h3>
    </div>
</div>

<?= $this->Form->create($menu, ['enctype' => 'multipart/form-data', 'class' => 'form-horizontal row-fluid']) ?>
<div class="row form-area">
    <div class="col-sm-12">

        <div class="row form-group" id="parent_sections">
            <div class="col-sm-3 col-xs-12 field-label">
                Category
            </div>
            <div class="col-sm-7 col-xs-12 select-input">
                <?= $this->Form->control('parent_menu_id', ['class' => 'form-control', 'options' => $parentMenus, 'label' => false, 'empty' => '-- Select --', 'required']); ?>

            </div>


        </div>
        <div class="row form-group">
            <div class="col-sm-3 col-xs-12 field-label">
                Name
            </div>
            <div class="col-sm-7 col-xs-12 text-input">
                <?= $this->Form->control('name', ['class' => 'form-control', 'label' => false, 'required']); ?>
            </div>
        </div>

        <div class="row form-group">
            <div class="col-sm-3 col-xs-12 field-label">
                Description
            </div>
            <div class="col-sm-7 col-xs-12 text-input">
                <?= $this->Form->control('description', ['class' => 'form-control', 'label' => false, 'required']); ?>
            </div>
        </div>

        <div class="row form-group">
            <div class="col-sm-3 col-xs-12 field-label">
                Show on Home
            </div>
            <div class="col-sm-7 col-xs-12 text-input">
                <?= $this->Form->control('show_on_home', ['class' => 'form-control', 'options' => [1 => 'Yes', 0 => 'No'], 'label' => false]); ?>
            </div>
        </div>

        <div class="row form-group">
            <div class="col-sm-3 col-xs-12 field-label">
                Content
            </div>
            <div class="col-sm-7 col-xs-12 text-input">
                <?= $this->Form->textarea('content', ['class' => 'form-control ckeditor', 'label' => false, '']); ?>
            </div>
        </div>

        <div class="row form-group">
            <div class="col-sm-3 col-xs-12 field-label">
                Icon Class
            </div>
            <div class="col-sm-7 col-xs-12 text-input">
                <?= $this->Form->control('fa_icon', ['class' => 'form-control', 'label' => false, '']); ?>
            </div>
        </div>

        <div class="row form-group">
            <div class="col-sm-3 col-xs-12 field-label">
                Image
            </div>
            <div class="col-sm-7 col-xs-12 text-input">
                <?= $this->Form->control('image_path', ['class' => 'form-control', 'label' => false, 'type' => 'file']); ?>
            </div>
        </div>

        <div class="row form-group">
            <div class="col-sm-3 col-xs-12 field-label">
                Image
            </div>
            <div class="col-sm-7 col-xs-12 text-input">
                <?= $this->Form->hidden('old_image', ['class' => 'form-control', 'label' => false, 'value' => $menu->image_path]); ?>
            </div>
        </div>


        <?php if (!empty($menu->image_path)) { ?>
            <div class="row form-group">
                <div class="col-md-2 col-sm-3 col-xs-12 field-label">
                    Old Images
                </div>
                <div class="col-md-10 col-sm-7">
                    <div class="row">
                        <div class="col-sm-7 col-md-2 images_edit" id="image_div<?= $menu->id ?>">
                            <?= $this->Html->image(Cake\Core\Configure::read('IMAGE_PREPATH') . $menu->image_path, ['class' => 'image_edit img-responsive']) ?>
                            <br>
                            <!-- <a href="javascript:removeImage(<?= $menu->id ?>);" class="remove_image">remove</a> -->
                        </div>
                    </div>
                </div>
            </div>
        <?php } ?>




        <div class="row form-group">

            <div class="col-sm-9 col-xs-12 col-sm-offset-3">
                <?= $this->Form->button('Save', ['class' => 'btn btn-primary']); ?>
            </div>
        </div>
    </div>
</div>
<?= $this->Form->end() ?>