<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-common', ['action'=> 'add']);?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> <?php echo $this->translate('添加通用内容'); ?></a>
            <?php echo $this->HelpUrl('goodsCommonList'); ?>
        </h1>
    </section>

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

        <div class="row">
            <div class="col-xs-12">
                    <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="58%"><?php echo $this->translate('应用商品分类'); ?></th>
                                    <th width="5%"><?php echo $this->translate('排序'); ?></th>
                                    <th width="5%"><?php echo $this->translate('状态'); ?></th>
                                    <th width="12%"><?php echo $this->translate('操作'); ?></th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $classArray = $this->goodsClassArray; if($this->contentList) foreach ($this->contentList as $value) { ?>
                                    <tr>
                                        <td><?php echo $this->escapeHtml($value->getContentTitle()); ?></td>
                                        <td>
                                            <?php
                                                $idArray = explode(',', trim($value->getClassIdStr(), ','));
                                                $classNameArray = [];
                                                foreach ($idArray as $idValue) {
                                                    if(isset($this->goodsClassArray[$idValue])) $classNameArray[] = $this->goodsClassArray[$idValue];
                                                }
                                                if(!empty($classNameArray)) echo $this->escapeHtml(implode('，', $classNameArray));
                                            ?>
                                         </td>
                                        <td><?php echo $this->escapeHtml($value->getContentSort()); ?></td>
                                        <td><?php echo $this->goodsHelper()->goodsCommonContentState($value->getContentState()); ?></td>
                                        <td>
                                            <a href="<?php echo $this->url('goods-common',
                                                ['action'=>'edit', 'id'=>$value->getContentId()]); ?>"
                                               class="btn btn-xs btn-success"><i class="fa fa-pencil"></i> <?php echo $this->translate('编辑'); ?></a>

                                            <a href="javascript:;" onclick="deleteConfirm('<?php echo $this->translate('您确实要删除该通用内容吗?'); ?>', '<?php echo $this->url('goods-common', ['action'=>'delete', 'id'=>$value->getContentId()], ['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>
            </div>
        </div>

    </section>
</div>