<div class="content-wrapper">
    <?php
    $form = $this->form;
    $form->prepare();
    ?>
    <?php echo $this->form()->openTag($form); ?>
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right" id="dbshop-menu-top">
            <a href="<?php echo $this->url('cms-class');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?php echo $this->translate('返回分类列表'); ?></a>
            <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('保存分类'); ?></button>
            <?php echo $this->HelpUrl('cmsClass'); ?>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-md-12">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab"><?php echo $this->translate('基本信息'); ?></a></li>
                        <li><a href="#tab_2" data-toggle="tab"><?php echo $this->translate('SEO优化'); ?></a></li>
                    </ul>
                    <div class="tab-content">
                        <?php echo $this->partial('layout/messages'); ?>
                        <div class="tab-pane active" id="tab_1">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('分类名称'); ?><span class="must_add_value">*</span></label>
                                    <div class="col-sm-6">
                                        <?php echo $this->formElement($form->get('cmsClassName')); ?>
                                        <?php echo $this->formElementErrors($form->get('cmsClassName'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('上级分类'); ?></label>
                                    <div class="col-sm-3">
                                        <?php echo $this->formElement($form->get('cmsClassTopId')); ?>
                                        <?php echo $this->formElementErrors($form->get('cmsClassTopId'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('排序'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('cmsClassSort')); ?>
                                        <?php echo $this->formElementErrors($form->get('cmsClassSort'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('首页新闻'); ?></label>
                                    <div class="col-sm-4">
                                        <div class="checkbox">
                                            <label>
                                                <?php echo $this->formElement($form->get('indexNews')); ?><?php echo $this->translate('启用'); ?>
                                                <?php echo $this->formElementErrors($form->get('indexNews'), ['class'=>'error-message']); ?>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('状态'); ?></label>
                                    <div class="col-sm-4">
                                        <div class="checkbox">
                                            <label>
                                                <?php echo $this->formElement($form->get('cmsClassState')); ?><?php echo $this->translate('启用'); ?>
                                                <?php echo $this->formElementErrors($form->get('cmsClassState'), ['class'=>'error-message']); ?>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane" id="tab_2">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('扩展名称'); ?></label>
                                    <div class="col-sm-8">
                                        <?php echo $this->formElement($form->get('cmsClassExtendName')); ?>
                                        <?php echo $this->formElementErrors($form->get('cmsClassExtendName'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('分类关键字'); ?></label>
                                    <div class="col-sm-8">
                                        <?php echo $this->formElement($form->get('cmsClassKeywords')); ?>
                                        <?php echo $this->formElementErrors($form->get('cmsClassKeywords'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('分类描述'); ?></label>
                                    <div class="col-sm-8">
                                        <?php echo $this->formElement($form->get('cmsClassDescription')); ?>
                                        <?php echo $this->formElementErrors($form->get('cmsClassDescription'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>

    </section>
    <?php echo $this->form()->closeTag(); ?>
</div>
<script>
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                cmsClassName: {
                    required: true
                },
                cmsClassSort: {
                    required: true,
                    number: true,
                    min: 1
                }
            },
            messages: {
                cmsClassName: {
                    required: "<?php echo $this->translate('分类名称不能为空!'); ?>"
                },
                cmsClassSort: {
                    required: "<?php echo $this->translate('排序不能为空!'); ?>",
                    number: "<?php echo $this->translate('排序必须为数字!'); ?>",
                    min: "<?php echo $this->translate('排序最小为1!'); ?>"
                }
            }
        });
    });
</script>
