diff --git a/models/Logs.php b/models/Logs.php index bd2d5ddd..db47a033 100644 --- a/models/Logs.php +++ b/models/Logs.php @@ -56,7 +56,12 @@ class Logs extends \yii\db\ActiveRecord { 'seal_no' => 'SEAL_NO', 'note' => 'Nội dung khác', 'factory' => 'Factory', - 'plate' => "Biển số" + 'plate' => "Biển số", + 'type' => "Loại xe", + 'company' => "Tên công ty", + 'driver' => "Lái xe", + 'telephone' => "Điện thoại", + 'cmt' => "CMT" ]; } diff --git a/models/LogsSearch.php b/models/LogsSearch.php index b9679d07..5774ff1c 100644 --- a/models/LogsSearch.php +++ b/models/LogsSearch.php @@ -12,13 +12,20 @@ use app\models\Logs; */ class LogsSearch extends Logs { + public $plate; + public $type; + public $company; + public $driver; + public $telephone; + public $cmt; + /** * {@inheritdoc} */ public function rules() { return [ [['id', 'vehicle_id'], 'integer'], - [['frame_image_in', 'frame_image_out', 'seal_no', 'note', 'factory'], 'safe'], + [['frame_image_in', 'frame_image_out', 'seal_no', 'note', 'factory', 'plate', 'type', 'company', 'driver', 'telephone', 'cmt'], 'safe'], ]; } @@ -70,7 +77,12 @@ class LogsSearch extends Logs { ->andFilterWhere(['like', 'seal_no', $this->seal_no]) ->andFilterWhere(['like', 'note', $this->note]) ->andFilterWhere(['like', 'factory', $this->factory]) - ->andFilterWhere(['like', 'vehicle.plate', $this->vehicle_id]); + ->andFilterWhere(['like', 'vehicle.plate', $this->plate]) + ->andFilterWhere(['like', 'vehicle.type', $this->type]) + ->andFilterWhere(['like', 'vehicle.company', $this->company]) + ->andFilterWhere(['like', 'vehicle.driver', $this->driver]) + ->andFilterWhere(['like', 'vehicle.telephone', $this->telephone]) + ->andFilterWhere(['like', 'vehicle.indentity_card', $this->cmt]); return $dataProvider; } diff --git a/views/logs/index.tpl b/views/logs/index.tpl index d5d96330..11979445 100644 --- a/views/logs/index.tpl +++ b/views/logs/index.tpl @@ -48,12 +48,30 @@ ], 'columns' => [ ['class' => 'yii\grid\SerialColumn'], - 'vehicle.plate', - 'vehicle.type', - 'vehicle.company', - 'vehicle.driver', - 'vehicle.telephone', - 'vehicle.indentity_card', + [ + 'attribute' => 'plate', + 'value' => 'vehicle.plate' + ], + [ + 'attribute' => 'type', + 'value' => 'vehicle.type' + ], + [ + 'attribute' => 'company', + 'value' => 'vehicle.company' + ], + [ + 'attribute' => 'driver', + 'value' => 'vehicle.driver' + ], + [ + 'attribute' => 'telephone', + 'value' => 'vehicle.telephone' + ], + [ + 'attribute' => 'cmt', + 'value' => 'vehicle.indentity_card' + ], 'factory', 'seal_no', [