<div class="content-wrapper">

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

        <h1 class="pull-right">
            <a href="<?=$this->url('erp-stock', ['action'=> 'add']);?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> <?=$this->translate('添加入库')?></a>
            <?=$this->HelpUrl('otherWarehouseOrderList')?>
        </h1>

    </section>

    <section class="content">
        <?=$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><?=$this->translate('入库单号')?>-<?=$this->translate('单数：').$this->orderList->getTotalItemCount()?></th>
                                <th><?=$this->translate('金额')?></th>
                                <th><?=$this->translate('仓库')?></th>
                                <th width="18%"><?=$this->translate('备注')?></th>
                                <th><?=$this->translate('时间')?></th>
                                <th width="12%"><?=$this->translate('操作')?></th>
                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            ?>
                            <?= $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <?= $this->formElement($sForm->get('warehouse_order_sn')); ?>
                                    <?=$this->formElementErrors($sForm->get('warehouse_order_sn'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?= $this->formElement($sForm->get('start_amount')); ?>
                                    </p>
                                    <div>
                                        <?= $this->formElement($sForm->get('end_amount')); ?>
                                    </div>
                                    <?=$this->formElementErrors($sForm->get('start_amount'), ['class'=>'error-message']);?>
                                    <?=$this->formElementErrors($sForm->get('end_amount'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?= $this->formElement($sForm->get('warehouse_id')); ?>
                                    <?=$this->formElementErrors($sForm->get('warehouse_id'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?= $this->formElement($sForm->get('warehouse_order_info')); ?>
                                    <?=$this->formElementErrors($sForm->get('warehouse_order_info'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?= $this->formElement($sForm->get('start_time')); ?>
                                    </p>
                                    <div>
                                        <?= $this->formElement($sForm->get('end_time')); ?>
                                    </div>
                                    <?=$this->formElementErrors($sForm->get('start_time'), ['class'=>'error-message']);?>
                                    <?=$this->formElementErrors($sForm->get('end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
                                    <?php
                                    $formData = $sForm->getData();
                                    if(!empty(array_filter($formData))
                                        || $formData['warehouse_id'] != '') { ?>
                                        <a href="<?=$this->url('erp-stock');?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <?= $this->form()->closeTag(); ?>
                            </thead>

                            <?php if(isset($this->orderList) && $this->orderList->getTotalItemCount() > 0) { foreach ($this->orderList as $order) { ?>
                                <tr>
                                    <td><?=$this->escapeHtml($order->getWarehouseOrderSn())?></td>
                                    <td><?=$this->erpCurrencyFormat($order->getWarehouseOrderAmount())?></td>
                                    <td><?=$this->escapeHtml($order->getOneWarehouse()->getWarehouseName())?></td>
                                    <td><?=$this->escapeHtml($order->getWarehouseOrderInfo())?></td>
                                    <td><?=date("Y-m-d H:i", $order->getOtherAddTime())?></td>
                                    <td>
                                        <a href="<?= $this->url('erp-stock',
                                            ['action'=>'view', 'id'=>$order->getOtherWarehouseOrderId()]); ?>"
                                           class="btn btn-xs btn-info"><i class="fa fa-info-circle"></i> <?=$this->translate('查看')?>
                                        </a>
                                    </td>
                                </tr>
                            <?php } } else { ?>
                                <tfoot>
                                <tr>
                                    <td colspan="6"><?=$this->translate('暂无入库信息')?></td>
                                </tr>
                                </tfoot>
                            <?php } ?>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?=$this->paginationControl($this->orderList, 'Sliding', 'layout/page', ['route' => 'erp-stock']); ?>
                    </div>
                </div>

            </div>
        </div>

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