public function actionIndex()
 {
     $searchModel = new OrderSearch();
     $searchParams = yii::$app->request->queryParams;
     $dataProvider = $searchModel->search($searchParams);
     $paymentTypes = ArrayHelper::map(PaymentType::find()->all(), 'id', 'name');
     $shippingTypes = ArrayHelper::map(ShippingType::find()->all(), 'id', 'name');
     return $this->render('index', ['searchModel' => $searchModel, 'shippingTypes' => $shippingTypes, 'paymentTypes' => $paymentTypes, 'dataProvider' => $dataProvider]);
 }
示例#2
0
 public function run()
 {
     $searchModel = new OrderSearch();
     $params = Yii::$app->request->queryParams;
     if ($this->client->id && empty($params['OrderSearch'])) {
         $params['OrderSearch']['user_id'] = $this->client->id;
     }
     $dataProvider = $searchModel->search($params);
     return $this->render('client_orders', ['client' => $this->client, 'clientId' => (int) $this->client->id, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
示例#3
0
 public function actionIndex($tab = 'orders')
 {
     $searchModel = new OrderSearch();
     $searchParams = yii::$app->request->queryParams;
     //if(!yii::$app->user->can(current(yii::$app->getModule('order')->adminRoles))) {
     //    $searchParams['OrderSearch']['seller_user_id'] = yii::$app->user->id;
     //}
     $dataProvider = $searchModel->search($searchParams);
     if ($tab == 'assigments') {
         $dataProvider->query->andWhere(['order.is_assigment' => '1']);
     } else {
         $dataProvider->query->andWhere('(order.is_assigment IS NULL OR order.is_assigment = 0)');
     }
     if (yii::$app->request->get('time_start')) {
         $dataProvider->query->orderBy('order.timestamp ASC');
     }
     $dataProvider->pagination = ["pageSize" => 100];
     $paymentTypes = ArrayHelper::map(PaymentType::find()->all(), 'id', 'name');
     $shippingTypes = ArrayHelper::map(ShippingType::find()->all(), 'id', 'name');
     $this->getView()->registerJs('pistol88.orders_list.elementsUrl = "' . Url::toRoute(['/order/tools/ajax-elements-list']) . '";');
     return $this->render('index', ['tab' => Html::encode($tab), 'searchModel' => $searchModel, 'shippingTypes' => $shippingTypes, 'paymentTypes' => $paymentTypes, 'module' => $this->module, 'dataProvider' => $dataProvider]);
 }