CityStoreParams,
Files,
MatrixBouquetForecast,
+ MatrixBouquetForecastSearch,
MatrixType,
PricesDynamic,
Products1c,
Yii::$app->session->setFlash('success', 'Импорт завершён: записи добавлены или обновлены.');
}
}
+ $searchModel = new MatrixBouquetForecastSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
- $dataProvider = new ActiveDataProvider([
- 'query' => MatrixBouquetForecast::find()->orderBy(['id' => SORT_ASC]),
- 'pagination' => ['pageSize' => 200],
- ]);
return $this->render('get-guid-bouquet', [
+ 'searchModel' => $searchModel,
'model' => $model,
'dataProvider' => $dataProvider,
]);
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use yii\base\Model;
+use yii\data\ActiveDataProvider;
+use yii_app\records\MatrixBouquetForecast;
+
+/**
+ * MatrixBouquetForecastSearch represents the model behind the search form of `yii_app\records\MatrixBouquetForecast`.
+ */
+class MatrixBouquetForecastSearch extends MatrixBouquetForecast
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['id', 'year', 'month', 's_store', 'm_store', 'l_store', 'xl_store', 'marketplace', 'internet'], 'integer'],
+ [['guid', 'name', 'group', 'created_at', 'updated_at'], 'safe'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function scenarios()
+ {
+ // bypass scenarios() implementation in the parent class
+ return Model::scenarios();
+ }
+
+ /**
+ * Creates data provider instance with search query applied
+ *
+ * @param array $params
+ * @param string|null $formName Form name to be used into `->load()` method.
+ *
+ * @return ActiveDataProvider
+ */
+ public function search($params, $formName = null)
+ {
+ $query = MatrixBouquetForecast::find();
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params, $formName);
+
+ 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;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'id' => $this->id,
+ 'year' => $this->year,
+ 'month' => $this->month,
+ 's_store' => $this->s_store,
+ 'm_store' => $this->m_store,
+ 'l_store' => $this->l_store,
+ 'xl_store' => $this->xl_store,
+ 'marketplace' => $this->marketplace,
+ 'internet' => $this->internet,
+ 'created_at' => $this->created_at,
+ 'updated_at' => $this->updated_at,
+ ]);
+
+ $query->andFilterWhere(['ilike', 'guid', $this->guid])
+ ->andFilterWhere(['ilike', 'name', $this->name])
+ ->andFilterWhere(['ilike', 'group', $this->group]);
+
+ return $dataProvider;
+ }
+}
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use kartik\grid\GridView;
+use yii_app\records\MatrixBouquetForecastSearch;
/** @var yii\web\View $this */
/** @var yii\data\ActiveDataProvider $dataProvider */
/** @var \yii\base\DynamicModel $model */
+/** @var yii_app\records\MatrixBouquetForecastSearch $searchModel */
$this->title = 'Импорт прогноза по букетам';
?>
<?php if (!empty($dataProvider)): ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
'columns' => [
'id',
'guid',