/**
  * Lists all Freelance models.
  * @return mixed
  */
 public function actionViewApp($id)
 {
     //$modelsDriver = Drivers::find()->where(['appilcant_id' => $id])->all();
     $modelsDriver = new ActiveDataProvider(['query' => Drivers::find()->where(['appilcant_id' => $id])]);
     $model = Zform::findOne(['id' => $id]);
     return $this->render('view-app', ['model' => $model, 'modelsDriver' => $modelsDriver]);
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Drivers::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, 'drivers_title' => $this->drivers_title, 'appilcant_id' => $this->appilcant_id, 'docs' => $this->docs, 'status' => $this->status, 'blacklist_status' => $this->blacklist_status, 'create_at' => $this->create_at, 'create_by' => $this->create_by, 'update_at' => $this->update_at, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'drivers_name', $this->drivers_name])->andFilterWhere(['like', 'drivers_lastname', $this->drivers_lastname])->andFilterWhere(['like', 'drivers_passport', $this->drivers_passport])->andFilterWhere(['like', 'drivers_licence', $this->drivers_licence])->andFilterWhere(['like', 'blacklist_date', $this->blacklist_date])->andFilterWhere(['like', 'comment', $this->comment]);
     return $dataProvider;
 }
Example #3
0
                <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'fullname', ['label' => 'Passport', 'value' => function ($model) {
    return $model->passport;
}, 'options' => ['style' => 'width:60px;']], ['header' => 'ทะเบียนรถ', 'value' => function ($model) {
    return $model->plates_number;
}, 'options' => ['style' => 'width:20px;']], ['label' => 'วดป(เข้า)', 'value' => function ($model) {
    //return $model->start_date;
    Yii::$app->formatter->locale = 'th_TH';
    return Yii::$app->formatter->asDate($model->start_date, 'short');
}], ['label' => 'วดป(ออก)', 'value' => function ($model) {
    //return $model->start_date;
    return Yii::$app->formatter->asDate($model->end_date, 'medium');
}], ['header' => 'ปลายทางที่', 'value' => function ($model) {
    return $model->targetProvince->PRV_DESC;
}], ['header' => 'คนขับ', 'format' => 'raw', 'value' => function ($data) {
    $count = Drivers::find()->where(['appilcant_id' => $data->id])->count();
    if (!empty($count)) {
        return Html::a($count, ['detail', 'app_id' => $data->id], ['data-toggle' => "modal", 'data-target' => "#myModal", 'data-title' => "Detail Data"]);
        // ubah ini
    } else {
        return "-";
    }
}], ['options' => ['style' => 'width:50px;'], 'format' => 'raw', 'label' => 'วัน', 'value' => function ($model) {
    return $model->dateDiff();
}], ['class' => 'yii\\grid\\ActionColumn', 'options' => ['style' => 'width:150px;'], 'template' => '<div class="btn-group btn-group-sm" role="group" aria-label="...">{create-mpdf}{view}{update}{delete}</div>', 'buttons' => ['create-mpdf' => function ($url, $model, $key) {
    return Html::a('<i class="fa fa-print"></i>', $url, ['class' => 'btn btn-default', 'target' => 'blank']);
}, 'view' => function ($url, $model, $key) {
    return Html::a('<i class="glyphicon glyphicon-eye-open"></i>', $url, ['class' => 'btn btn-default']);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<i class="glyphicon glyphicon-pencil"></i>', $url, ['class' => 'btn btn-default']);
}, 'delete' => function ($url, $model, $key) {
Example #4
0
 public function actionDrivers($id)
 {
     $model = $this->findModel($id);
     $modelsDriver = new ActiveDataProvider(['query' => Drivers::find()->where(['appilcant_id' => $id])]);
     $model2 = new Drivers();
     if ($model2->load(Yii::$app->request->post())) {
         $model2->appilcant_id = $id;
         return $this->redirect(['drivers', 'id' => $model->id]);
     } else {
         return $this->render('drivers', ['model' => $model2, 'modelsApp' => $model, 'modelsDriver' => $modelsDriver]);
     }
 }