<div class="content-wrapper">

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

        <h1 class="pull-right">
            <a href="<?php echo $this->url('stock-check', ['action'=> 'add']);?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> <?php echo $this->translate('添加盘点'); ?></a>
            <?php echo $this->HelpUrl('stockCheck'); ?>
        </h1>

    </section>

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

        <div class="row">
            <div class="col-xs-12">
                <div class="box erp-box">

                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <thead>
                            <tr class="erp-bg-thead">
                                <th><?php echo $this->translate('盘点单号'); ?>-<?php echo $this->translate('单数：') . $this->stockCheckList->getTotalItemCount(); ?></th>
                                <th><?php echo $this->translate('盘点仓库'); ?></th>
                                <th><?php echo $this->translate('盘点人'); ?></th>
                                <th width="18%"><?php echo $this->translate('备注'); ?></th>
                                <th width="10%"><?php echo $this->translate('盘点时间'); ?></th>
                                <th width="8%"><?php echo $this->translate('盘点状态'); ?></th>
                                <th width="18%"><?php echo $this->translate('操作'); ?></th>
                            </tr>

                            </thead>

                            <?php if(isset($this->stockCheckList) && $this->stockCheckList->getTotalItemCount() > 0) { foreach ($this->stockCheckList as $value) { ?>
                                <tr>
                                    <td><?php echo $this->escapeHtml($value->getStockCheckSn()); ?></td>
                                    <td><?php echo $this->escapeHtml($value->getOneWarehouse()->getWarehouseName()); ?></td>
                                    <td><?php echo $this->escapeHtml($value->getStockCheckUser()); ?></td>
                                    <td><?php echo $this->escapeHtml($value->getStockCheckInfo()); ?></td>
                                    <td><?php echo date("Y-m-d", $value->getStockCheckTime()); ?></td>
                                    <td><?php echo $this->stockHelper()->stockCheckState($value->getStockCheckState()); ?></td>
                                    <td>
                                        <a href="<?php echo $this->url('stock-check',
                                            ['action'=>'view', 'id'=>$value->getStockCheckId()]); ?>"
                                           class="btn btn-xs btn-info"><i class="fa fa-info-circle"></i> <?php echo $this->translate('查看'); ?>
                                        </a>
                                        <?php if($value->getStockCheckState() == 2) { ?>
                                            <a href="<?php echo $this->url('stock-check',
                                                ['action'=>'confirm', 'id'=>$value->getStockCheckId()]); ?>" class="btn btn-xs btn-success"><i class="fa fa-check"></i> <?php echo $this->translate('确认'); ?></a>
                                            <a href="<?php echo $this->url('stock-check',
                                                ['action'=>'edit', 'id'=>$value->getStockCheckId()]); ?>"
                                               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('stock-check', ['action'=>'delete', 'id'=>$value->getStockCheckId()], ['query' => ['qToken' => $this->common()->getCsrfValue()]]); ?>');" class="btn btn-xs btn-danger">
                                                <i class="fa fa-trash"></i> <?php echo $this->translate('删除'); ?>
                                            </a>
                                        <?php } ?>
                                    </td>
                                </tr>
                            <?php } } else { ?>
                                <tfoot>
                                <tr>
                                    <td colspan="6"><?php echo $this->translate('暂无盘点信息'); ?></td>
                                </tr>
                                </tfoot>
                            <?php } ?>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?php echo $this->paginationControl($this->stockCheckList, 'Sliding', 'layout/page', ['route' => 'stock-check']); ?>
                    </div>
                </div>

            </div>
        </div>

    </section>
</div>
<script type="text/javascript">
    laydate.render({elem: '#start_time'});
    laydate.render({elem: '#end_time'});
</script>