/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = EbayAccount::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'listing_template_id' => $this->listing_template_id, 'token_expiration' => $this->token_expiration]); $query->andFilterWhere(['like', 'seller_id', $this->seller_id])->andFilterWhere(['like', 'store_id', $this->store_id])->andFilterWhere(['like', 'shipping_info', $this->shipping_info])->andFilterWhere(['like', 'warranty_info', $this->warranty_info])->andFilterWhere(['like', 'payment_info', $this->payment_info])->andFilterWhere(['like', 'contact_info', $this->contact_info])->andFilterWhere(['like', 'token', $this->token])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'listing_assets_url', $this->listing_assets_url]); return $dataProvider; }
/* @var $dataProvider yii\data\ActiveDataProvider */ use frontend\models\ebayaccounts\EbayAccount; $this->title = Yii::t('app/listing', 'Listings'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="listing-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php //= Html::a(Yii::t('app/listing', 'Create Listing'), ['create'], ['class' => 'btn btn-success']) ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['item_id', ['attribute' => 'sku', 'value' => function ($model, $key, $index, $widget) { return Html::a($model->sku, Url::to(['product/view', 'id' => $model->product->id]), ['target' => '_blank']); }, 'format' => 'raw'], ['attribute' => 'ebay_id', 'value' => function ($model, $key, $index, $widget) { return $model->ebay->seller_id; }, 'vAlign' => 'middle', 'width' => '180px', 'label' => Yii::t('app/order', 'eBay Account', []), 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map(EbayAccount::find()->where(['user_id' => Yii::$app->user->id])->orderBy('seller_id')->asArray()->all(), 'id', 'seller_id'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'eBay Account'], 'format' => 'raw'], 'price', 'title', 'qty', 'sold_qty', 'sync_at']]); ?> </div>
echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'columns' => [['class' => 'kartik\\grid\\ExpandRowColumn', 'width' => '50px', 'value' => function ($model, $key, $index, $column) { return GridView::ROW_COLLAPSED; }, 'detail' => function ($model, $key, $index, $column) { return Yii::$app->controller->renderPartial('_expand-transaction', ['model' => $model]); }, 'headerOptions' => ['class' => 'kartik-sheet-style'], 'expandOneOnly' => true], ['class' => '\\kartik\\grid\\BooleanColumn', 'attribute' => 'status', 'trueLabel' => 'YES', 'falseLabel' => 'NO', 'label' => Yii::t('app/order', 'Shipped', [])], ['attribute' => 'ebay_id', 'value' => function ($model, $key, $index, $widget) { return $model->ebay->seller_id; }, 'vAlign' => 'middle', 'width' => '180px', 'label' => Yii::t('app/order', 'eBay Account', []), 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map(EbayAccount::find()->where(['user_id' => Yii::$app->user->id])->orderBy('seller_id')->asArray()->all(), 'id', 'seller_id'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'eBay Account'], 'format' => 'raw'], 'sale_record_number', 'buyer_id', ['label' => 'Buyer Email', 'value' => function ($model, $key, $index, $column) { if (isset($model->ebayTransactions[0])) { return $model->ebayTransactions[0]->buyer_email; } else { return null; } }], 'ebay_order_id', 'total', ['attribute' => 'created_time', 'label' => 'Sale Date', 'filterType' => GridView::FILTER_DATE_RANGE, 'value' => function ($model, $key, $index, $column) { if ($model['created_time']) { $date = new DateTime($model['created_time'], new DateTimeZone('GMT')); $date->setTimezone(new DateTimeZone('Australia/Sydney')); return $date->format('Y-m-d H:i:s'); } else { return null; } }], ['attribute' => 'paid_time', 'label' => Yii::t('app/order', 'Paid Time', []), 'filterType' => GridView::FILTER_DATE_RANGE, 'value' => function ($model, $key, $index, $column) { if ($model['paid_time']) {
public function getEbayAccoutsObj() { $ebayAcc = EbayAccount::find()->allOfUserObj(Yii::$app->user->id, $db = null); return $ebayAcc; }