view.php 4.37 KB
<?php
    
    use artweb\artbox\ecommerce\models\Order;
    use kartik\grid\GridView;
    use yii\data\ActiveDataProvider;
    use yii\grid\SerialColumn;
    use yii\helpers\Html;
    use yii\web\View;
    use yii\widgets\DetailView;
    use yii\widgets\ListView;
    
    /**
     * @var View               $this
     * @var Order              $model
     * @var ActiveDataProvider $products
     * @var ActiveDataProvider $historyData
     */
    
    $this->title = 'Заказ #' . $model->id;
    $this->params[ 'breadcrumbs' ][] = [
        'label' => \Yii::t('app', 'Заказы'),
        'url'   => [ 'index' ],
    ];
    $this->params[ 'breadcrumbs' ][] = $this->title;
?>
<div class="order-view">

  <h1><?= Html::encode($this->title) ?></h1>

  <p>
      <?= Html::a(
          'Обновить',
          [
              'update',
              'id' => $model->id,
          ],
          [ 'class' => 'btn btn-primary' ]
      ) ?>

  </p>

  <div class="box box-default">
    <div class="box-header with-border">
      <h3 class="box-title">Данные заказа</h3>
      <div class="box-tools pull-right">
        <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
      </div><!-- /.box-tools -->
    </div><!-- /.box-header -->
    <div class="box-body">
        <?= DetailView::widget(
            [
                'model'      => $model,
                'attributes' => [
                    'id',
                    'deadline',
                    'pay',
                    'reason',
                    [
                        'label' => 'Статус',
                        'value' => $model->orderLabel->lang->title,
                    ],
                    'name',
                    'phone',
                    'email',
                    'comment',
                    [
                        'label' => 'Способ доставки',
                        'value' => $model->orderDelivery->lang->title,
                    ],
                    'declaration',
                    'stock',
                    [
                        'label' => 'Способ оплаты',
                        'value' => $model->orderPayment->lang->title,
                    ],
                    'insurance',
                    'city',
                    'adress',
                    'body',
                    'check',
                    'sms',
                ],
            ]
        ) ?>
    </div><!-- /.box-body -->
  </div><!-- /.box -->


  <div class="box box-default">
    <div class="box-header with-border">
      <h3 class="box-title">Товары</h3>
      <div class="box-tools pull-right">
        <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
      </div><!-- /.box-tools -->
    </div><!-- /.box-header -->
    <div class="box-body">
        <?php
            echo GridView::widget(
                [
                    'dataProvider' => $products,
                    'columns'      => [
                        [
                            'class' => SerialColumn::className(),
                        ],
                        'product_name',
                        'name',
                        'sku',
                        'price',
                        'count',
                        'sum_cost',
                    ],
                ]
            );
        ?>
    </div><!-- /.box-body -->
  </div><!-- /.box -->

  <div class="box box-default">
    <div class="box-header with-border">
      <h3 class="box-title">История</h3>
      <div class="box-tools pull-right">
        <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
      </div><!-- /.box-tools -->
    </div><!-- /.box-header -->
    <div class="box-body">

          
          <?php
              echo ListView::widget(
                  [
                      'dataProvider' => $historyData,
                      'layout'       => '{items}',
                      'itemView'     => '_timeline_item',
                      'itemOptions' => [
                        'tag' => false,
                      ],
                      'options' => [
                        'tag' => 'ul',
                        'class' => 'list-view timeline',
                      ],
                  ]
              );
          ?>


    </div><!-- /.box-body -->
  </div><!-- /.box -->

</div>