<div class="content-wrapper">

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

        <h1 class="pull-right">
            <a href="<?=$this->url('goods');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?=$this->translate('返回商品列表')?></a>
            <?=$this->HelpUrl('goodsWarehouse')?>
        </h1>

    </section>

    <section class="content">
        <?=$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"><?=$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%"><?=$this->translate('所在仓库')?></th>
                                    <th width="70%"><?=$this->translate('商品数量').'('.$this->escapeHtml($this->goodsInfo->getOneUnit()->getUnitName()).')'?></th>
                                </tr>
                                <?php if($this->warehouseGoods) foreach ($this->warehouseGoods as $goods) { ?>
                                    <tr>
                                        <td><?=$this->escapeHtml($goods->getOneWarehouse()->getWarehouseName())?></td>
                                        <td><?= $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: '<?=$this->translate('仓库商品分布')?>',
            x:'center'
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data: [<?=implode(',', $this->warehouseArray['title'])?>]
        },
        series : [
            {
                name: '<?=$this->translate('产品分布')?>',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data:[<?=implode(',', $this->warehouseArray['value'])?>],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    });
</script>