/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PurchaseOrder::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]); $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, 'language_id' => $this->language_id, 'status' => $this->status, 'customer_id' => $this->customer_id, 'customer_phone_number' => $this->customer_phone_number, 'delivered_at' => $this->delivered_at, 'shipped_at' => $this->shipped_at, 'shipping_fee' => $this->shipping_fee]); $query->andFilterWhere(['like', 'transaction_id', $this->transaction_id])->andFilterWhere(['like', 'customer_name', $this->customer_name])->andFilterWhere(['like', 'customer_email', $this->customer_email])->andFilterWhere(['like', 'customer_address', $this->customer_address])->andFilterWhere(['like', 'customer_city', $this->customer_city])->andFilterWhere(['like', 'customer_country', $this->customer_country])->andFilterWhere(['like', 'country_calling_code', $this->country_calling_code])->andFilterWhere(['like', 'zip_postal_code', $this->zip_postal_code])->andFilterWhere(['like', 'delivery_to', $this->delivery_to])->andFilterWhere(['like', 'shipping_from', $this->shipping_from])->andFilterWhere(['like', 'shipping_via', $this->shipping_via])->andFilterWhere(['like', 'payment_method', $this->payment_method])->andFilterWhere(['like', 'customer_note', $this->customer_note])->andFilterWhere(['like', 'user_note', $this->user_note]); return $dataProvider; }
<ul class="sidebar-menu"> <li class="header">NOW <?php echo date('d/m/Y H:i'); ?> </li> <!-- Đơn hàng --> <li class="treeview <?php echo in_array(Yii::$app->controller->id, ['purchase-order', 'purchase-order-detail']) ? 'active' : ''; ?> "> <a href="<?php echo Yii::$app->urlManager->createUrl('purchase-order/index'); ?> "> <i class="fa fa-truck"></i> <span>Đơn hàng</span> <span class="label label-warning pull-right"><?php echo PurchaseOrder::find()->where(['status' => PurchaseOrder::STATUS_NEW])->count(); ?> </span> </a> <!-- <ul class="treeview-menu"> <li class="<?php echo Yii::$app->controller->id == 'purchase-order' && Yii::$app->controller->action->id == 'index' ? 'active' : ''; ?> "><a href="<?php echo Yii::$app->urlManager->createUrl('purchase-order/index'); ?> "><i class="fa fa-circle-o"></i> Danh sách</a></li> </ul>--> </li> <!-- Theo dõi --> <li class="treeview <?php