<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>
        <h1 class="pull-right">
            <a href="<?php echo $this->url('goods-attribute', ['action'=> 'add']);?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> <?php echo $this->translate('添加属性'); ?></a>
            <?php echo $this->HelpUrl('goodsAttribute'); ?>
        </h1>
    </section>

    <section class="content">
        <?php echo $this->partial('layout/messages'); ?>

        <div class="row">
            <div class="col-xs-12">
                <form method="post" action="<?php echo $this->url('goods-attribute', ['action' => 'updateAllSort']);?>" name="edit-all-form" id="edit-all-form">
                <div class="box shop-box">
                    <div class="box-body table-responsive no-padding">
                        <table class="table shop-table table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="20%"><?php echo $this->translate('属性名称'); ?></th>
                                <th width="10%"><?php echo $this->translate('属性分组'); ?></th>
                                <th width="10%"><?php echo $this->translate('属性类型'); ?></th>
                                <th width="5%"><?php echo $this->translate('排序'); ?></th>
                                <th width="10%"><?php echo $this->translate('操作'); ?></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if($this->attributeList) foreach ($this->attributeList as $value) { ?>
                                <tr>
                                    <td><?php echo $this->escapeHtml($value->getAttributeName()); ?></td>
                                    <td><?php echo $this->escapeHtml($value->getOneAttributeGroup()->getAttributeGroupName()); ?></td>
                                    <td><?php echo $this->goodsHelper()->goodsAttributeType($value->getAttributeType()); ?></td>
                                    <td><input type="number" name="attributeSort[<?php echo $value->getAttributeId(); ?>]" value="<?php echo $this->escapeHtml($value->getAttributeSort()); ?>" class="form-control input-sm"></td>
                                    <td>
                                        <a href="<?php echo $this->url('goods-attribute',
                                            ['action'=>'edit', 'id'=>$value->getAttributeId()]); ?>"
                                           class="btn btn-xs btn-success"><i class="fa fa-pencil"></i> <?php echo $this->translate('编辑'); ?></a>

                                        <?php if(in_array($value->getAttributeType(), ['select', 'radio', 'checkbox'])) { ?>
                                            <a href="<?php echo $this->url('goods-attribute',
                                                ['action'=>'attributeValue', 'id'=>$value->getAttributeId()]); ?>" class="btn btn-xs btn-success"><i class="fa fa-pencil"></i> <?php echo $this->translate('属性值'); ?></a>
                                        <?php } ?>

                                        <a href="javascript:;" onclick="deleteConfirm('<?php echo $this->translate('您确实要删除该属性吗?'); ?>', '<?php echo $this->url('goods-attribute', ['action'=>'delete', 'id'=>$value->getAttributeId()], ['query' => ['qToken' => $this->adminHelper()->getCsrfValue()]]); ?>');" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i> <?php echo $this->translate('删除'); ?></a>
                                    </td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('更新'); ?></button>
                    </div>
                </div>
                </form>
            </div>
        </div>

    </section>
</div>