/**
  * Lists all Order models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModelConfig = ['defaultOrder' => ['id' => SORT_DESC], 'model' => Order::className(), 'relations' => ['user' => ['username']], 'partialMatchAttributes' => ['start_date', 'end_date', 'user_username'], 'additionalConditions' => []];
     if (intval($this->module->showDeletedOrders) === 0) {
         $searchModelConfig['additionalConditions'] = [['is_deleted' => 0]];
     }
     /** @var SearchModel $searchModel */
     $searchModel = new SearchModel($searchModelConfig);
     if (intval($this->module->defaultOrderStageFilterBackend) > 0) {
         $searchModel->order_stage_id = intval($this->module->defaultOrderStageFilterBackend);
     }
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['dataProvider' => $dataProvider, 'managers' => $this->getManagersList(), 'orderStages' => Helper::getModelMap(OrderStage::className(), 'id', 'name_short'), 'paymentTypes' => Helper::getModelMap(PaymentType::className(), 'id', 'name'), 'searchModel' => $searchModel, 'shippingOptions' => Helper::getModelMap(ShippingOption::className(), 'id', 'name')]);
 }
示例#2
0
 /**
  * getShippingOption
  * @return ShippingOption
  */
 public function getShippingOption()
 {
     return $this->hasOne(ShippingOption::className(), ['id' => 'shipping_option_id']);
 }
示例#3
0
    <h3><?php 
echo Yii::t('app', 'Delivery information');
?>
</h3>
    <?php 
echo $form->field($deliveryInformation, 'country_id')->dropDownList(\app\components\Helper::getModelMap(\app\models\Country::className(), 'id', 'name'), ['readonly' => $immutable]);
?>
    <?php 
echo $form->field($deliveryInformation, 'city_id')->dropDownList(\app\components\Helper::getModelMap(\app\models\City::className(), 'id', 'name'), ['readonly' => $immutable]);
?>
    <?php 
echo $form->field($deliveryInformation, 'zip_code')->textInput(['readonly' => $immutable]);
?>
    <?php 
echo $form->field($deliveryInformation, 'address')->textarea(['readonly' => $immutable]);
?>

    <?php 
echo $form->field($orderDeliveryInformation, 'shipping_option_id')->dropDownList(\app\components\Helper::getModelMap(\app\modules\shop\models\ShippingOption::className(), 'id', 'name'), ['readonly' => $immutable]);
?>

    <?php 
/** @var \app\properties\AbstractModel $abstractModel */
$abstractModel = $orderDeliveryInformation->getAbstractModel();
$abstractModel->setArrayMode(false);
foreach ($abstractModel->attributes() as $attr) {
    echo $form->field($abstractModel, $attr)->textInput(['readonly' => $immutable]);
}
?>

 /**
  * Lists all ShippingOption models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new SearchModel(['model' => ShippingOption::className(), 'partialMatchAttributes' => ['name']]);
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
示例#5
0
echo \kartik\dynagrid\DynaGrid::widget(['options' => ['id' => 'orders-grid'], 'theme' => 'panel-default', 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'panel' => ['heading' => Html::tag('h3', 'Customer orders', ['class' => 'panel-title'])], 'rowOptions' => function ($model, $key, $index, $grid) {
    if ($model->is_deleted) {
        return ['class' => 'danger'];
    }
    return [];
}], 'columns' => [['attribute' => 'id'], ['attribute' => 'user_username', 'label' => Yii::t('app', 'User'), 'value' => function ($model, $key, $index, $column) {
    if ($model === null || $model->user === null) {
        return null;
    }
    return $model->user->username;
}], 'start_date', 'end_date', ['attribute' => 'order_stage_id', 'filter' => Helper::getModelMap(\app\modules\shop\models\OrderStage::className(), 'id', 'name_short'), 'value' => function ($model, $key, $index, $column) {
    if ($model === null || $model->stage === null) {
        return null;
    }
    return $model->stage->name_short;
}], ['attribute' => 'shipping_option_id', 'filter' => Helper::getModelMap(\app\modules\shop\models\ShippingOption::className(), 'id', 'name'), 'value' => function ($model, $key, $index, $column) {
    if ($model === null || $model->shippingOption === null) {
        return null;
    }
    return $model->shippingOption->name;
}], ['attribute' => 'payment_type_id', 'filter' => Helper::getModelMap(\app\modules\shop\models\PaymentType::className(), 'id', 'name'), 'value' => function ($model, $key, $index, $column) {
    if ($model === null || $model->paymentType === null) {
        return null;
    }
    return $model->paymentType->name;
}], 'items_count', 'total_price', ['class' => 'app\\backend\\components\\ActionColumn', 'buttons' => function ($model, $key, $index, $parent) {
    $result = [['url' => '/shop/backend-order/view', 'icon' => 'eye', 'class' => 'btn-info', 'label' => Yii::t('app', 'View')]];
    return $result;
}]]]);
?>
        </div>