Hello everyone
i try to show 2 gridviews of datas.
a first gridview where any of three fields is empty (so if one or two of thoses fields are empty, it should show the entry)
and a second gridview with the records that have those 3 fields filled up.
i do something wrong, because if the date field is entered, then the record goes from the first to the second gridview, event if the 2 other fields remain empty…
this is my code :
(dataprovider is the second gridview and unprocessed is the first)
if(Yii::$app->user->can('admin')){
$searchModel = new DeliverySearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider->query->orderBy(['delivery_expedition_date'=>SORT_DESC]);
}
elseif(Yii::$app->user->can('maker')){
$maker = Maker::find()->where(['user_id'=>Yii::$app->user->identity->id])->one();
$searchModel = new DeliverySearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider->query->andWhere(['maker_id'=>$maker->id]);
//$dataProvider->query->where(['and',['not',['delivery_trackcode' => null,'delivery_carrier' => null,'delivery_expedition_date' => null]]]);
$dataProvider->query->andWhere(['not', ['delivery_trackcode' => null]]);
$dataProvider->query->andWhere(['not', ['delivery_carrier' => null]]);
$dataProvider->query->andWhere(['not', ['delivery_expedition_date' => null]]);
$dataProvider->query->orderBy(['delivery_expedition_date'=>SORT_DESC]);
$unProcessed = $searchModel->search(Yii::$app->request->queryParams);
$unProcessed->query->andWhere(['maker_id'=>$maker->id]);
$unProcessed->query->andWhere(['or',['delivery_trackcode'=> NULL],['delivery_carrier'=> NULL],['delivery_expedition_date'=> NULL]]);
$unProcessed->query->orderBy(['created_at'=>SORT_DESC]);
}
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'unProcessed' => $unProcessed,
]);
Any help would be very much appreciated
kind regards