<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>
        <h1 class="pull-right">
            <a href="<?php echo $this->url('operation-coupon', ['action' => 'add']);?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> <?php echo $this->translate('添加优惠券'); ?></a>
            <?php echo $this->HelpUrl('coupon'); ?>
        </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 table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="16%"><?php echo $this->translate('优惠券名称'); ?></th>
                                <th width="20%"><?php echo $this->translate('优惠券描述'); ?></th>
                                <th width="15%"><?php echo $this->translate('获取方式'); ?></th>
                                <th width="20%"><?php echo $this->translate('有效时间'); ?></th>
                                <th width="6%"><?php echo $this->translate('已发放'); ?></th>
                                <th width="6%"><?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 if($this->couponList) foreach ($this->couponList as $couponValue) { ?>
                                <tr>
                                    <td><?php echo $this->escapeHtml($couponValue[0]->getCouponTitle()); ?></td>
                                    <td><?php echo $this->escapeHtml($couponValue[0]->getCouponInfo()); ?></td>
                                    <td><?php echo $this->couponGetType[$couponValue[0]->getGetCouponType()]; ?></td>
                                    <td><?php echo $this->adminHelper()->effectiveTime($couponValue[0]->getCouponStartTime(), $couponValue[0]->getCouponEndTime()); ?></td>
                                    <td><a href="<?php echo $this->url('operation-coupon', ['action' => 'userCouponList', 'id' => $couponValue[0]->getCouponId()]); ?>"><?php echo $couponValue['userCouponNum']; ?></a></td>
                                    <td><a href="<?php echo $this->url('operation-coupon', ['action' => 'userCouponList', 'id' => $couponValue[0]->getCouponId()]); ?>"><?php echo $couponValue['usedCouponNum']; ?></a></td>
                                    <td><?php echo $this->operationHelper()->couponState($couponValue[0]->getCouponState()); ?></td>
                                    <td>
                                        <a href="<?php echo $this->url('operation-coupon',
                                            ['action'=>'edit', 'id'=>$couponValue[0]->getCouponId()]); ?>"
                                           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('operation-coupon', ['action' => 'delete', 'id' => $couponValue[0]->getCouponId()], ['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>