<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');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?php echo $this->translate('返回商品列表'); ?></a>
            <?php echo $this->HelpUrl('goodsWarehouse'); ?>
        </h1>

    </section>

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

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title"><?php echo $this->translate('商品名称').'：'.$this->escapeHtml($this->goodsInfo->getGoodsName()).(empty($this->goodsInfo->getGoodsSpec()) ? '' : '('.$this->escapeHtml($this->goodsInfo->getGoodsSpec()).')'); ?></h3>
                    </div>

                    <div id="main" style="width: 100%;height: 400px;margin-top: 20px;"></div>

                    <div class="box-body table-responsive">
                            <table class="table table-striped table-bordered">
                                <tr>
                                    <th width="30%"><?php echo $this->translate('所在仓库'); ?></th>
                                    <th width="70%"><?php echo $this->translate('商品数量').'('.$this->escapeHtml($this->goodsInfo->getOneUnit()->getUnitName()).')'?></th>
                                </tr>
                                <?php if($this->warehouseGoods) foreach ($this->warehouseGoods as $goods) { ?>
                                    <tr>
                                        <td><?php echo $this->escapeHtml($goods->getOneWarehouse()->getWarehouseName()); ?></td>
                                        <td><?php echo $this->escapeHtml($goods->getWarehouseGoodsStock()); ?></td>
                                    </tr>
                                <?php } ?>
                            </table>
                    </div>

                </div>

            </div>
        </div>

    </section>
</div>
<script type="text/javascript">
    var myChart = echarts.init(document.getElementById('main'), 'shine');
    myChart.setOption({
        title : {
            text: '<?php echo $this->translate('仓库商品分布'); ?>',
            x:'center'
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data: [<?php echo implode(',', $this->warehouseArray['title']); ?>]
        },
        series : [
            {
                name: '<?php echo $this->translate('产品分布'); ?>',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data:[<?php echo implode(',', $this->warehouseArray['value']); ?>],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    });
</script>