<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-evaluation', [], ['query' => $this->queryData]);?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?php echo $this->translate('返回'); ?></a>
            <?php echo $this->HelpUrl('evaluationList'); ?>
        </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="15%"><?php echo $this->translate('评价人'); ?></th>
                                <th width="35%"><?php echo $this->translate('评价内容'); ?></th>
                                <th width="10%"><?php echo $this->translate('评价等级'); ?></th>
                                <th width="15%"><?php echo $this->translate('评价时间'); ?></th>
                                <th width="10%"><?php echo $this->translate('前台显示'); ?></th>
                                <th width="15%"><?php echo $this->translate('操作'); ?></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if($this->evaluationList->getCurrentItemCount() > 0) foreach ($this->evaluationList as $evaluationValue) { ?>
                                <tr>
                                    <td><?php echo $this->escapeHtml($evaluationValue->getUserName()); ?></td>
                                    <td><?php echo nl2br($this->escapeHtml($evaluationValue->getEvaluationBody())); ?></td>
                                    <td><?php echo $evaluationValue->getEvaluationStar(); ?></td>
                                    <td><?php echo $this->shopDateFormat()->goodsEvaluationTime($evaluationValue->getEvaluationTime()); ?></td>
                                    <td>
                                        <?php if($evaluationValue->getEvaluationShowState() == 0) { ?>
                                            <i class="fa fa-times text-red"></i>
                                        <?php } else { ?>
                                            <i class="fa fa-check text-green"></i>
                                        <?php } ?>
                                    </td>
                                    <td>
                                        <a href="javascript:;" onclick="replyGoodsEvaluation(<?php echo $evaluationValue->getEvaluationId(); ?>);" class="btn btn-xs btn-success"><i class="fa fa-reply"></i> <?php echo $this->translate('评价回复'); ?></a>
                                        <a href="javascript:;" onclick="deleteConfirm('<?php echo $this->translate('您确实要删除该评价信息吗?'); ?>', '<?php echo $this->url('goods-evaluation', ['action'=>'deleteEvaluation', 'id' => $evaluationValue->getEvaluationId()], ['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">
                        <?php echo $this->paginationControl($this->evaluationList, 'Sliding', 'layout/page', ['route' => 'goods-evaluation', 'params' => ['action' => 'showEvaluation', 'id' => $this->goodsInfo->getGoodsId()]]); ?>
                    </div>
                </div>

            </div>
        </div>

    </section>
</div>

<div class="modal fade" id="modalDefault">
    <div class="modal-dialog" style="width: 800px;" id="replyEvaluation">

    </div>
</div>

<script>
    function replyGoodsEvaluation(evaluationId) {
        $.get('<?php echo $this->url('goods-evaluation', ['action' => 'replyEvaluation']); ?>/'+evaluationId, {}, function (html) {
            if(html.length > 0) {
                $('#replyEvaluation').html(html);
                $('#modalDefault').modal('show');
            }
        })
    }
</script>
