/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Employee::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, 'status' => $this->status, 'created' => $this->created, 'updated' => $this->updated]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'text', $this->text]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Employee::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(['employee_id' => $this->employee_id, 'position_id' => $this->position_id, 'user_id' => $this->user_id]);
     $query->orFilterWhere(['like', 'id_number', $this->globalSearch])->orFilterWhere(['like', 'firstname', $this->globalSearch])->orFilterWhere(['like', 'lastname', $this->globalSearch])->orFilterWhere(['like', 'middlename', $this->globalSearch])->orFilterWhere(['like', 'sex', $this->globalSearch])->orFilterWhere(['like', 'employee_status', $this->globalSearch]);
     $query->andFilterWhere(['like', 'id_number', $this->id_number])->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'middlename', $this->middlename])->andFilterWhere(['like', 'sex', $this->sex])->andFilterWhere(['like', 'employee_status', $this->employee_status]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Employee::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['fullName'] = ['asc' => ['name' => SORT_ASC, 'surname' => SORT_ASC], 'desc' => ['name' => SORT_DESC, 'surname' => SORT_DESC], 'label' => 'ชื่อ - นามสกุล', 'default' => SORT_ASC];
     $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(['emp_id' => $this->emp_id, 'sex' => $this->sex, 'birthday' => $this->birthday, 'modify_date' => $this->modify_date, 'create_date' => $this->create_date, 'salary' => $this->salary, 'expire_date' => $this->expire_date, 'age' => $this->age, 'marital' => $this->marital, 'count_download_resume' => $this->count_download_resume]);
     $query->orFilterWhere(['like', 'employee.name', $this->fullName])->orFilterWhere(['like', 'employee.surname', $this->fullName]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'surname', $this->surname])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'zip_code', $this->zip_code])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'mobile_phone', $this->mobile_phone])->andFilterWhere(['like', 'position', $this->position])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'skill', $this->skill])->andFilterWhere(['like', 'countries', $this->countries])->andFilterWhere(['like', 'experience', $this->experience])->andFilterWhere(['like', 'personal_id', $this->personal_id])->andFilterWhere(['like', 'province', $this->province])->andFilterWhere(['like', 'amphur', $this->amphur])->andFilterWhere(['like', 'district', $this->district])->andFilterWhere(['like', 'office', $this->office])->andFilterWhere(['like', 'social', $this->social])->andFilterWhere(['like', 'resume', $this->resume])->andFilterWhere(['like', 'token_forupload', $this->token_forupload]);
     return $dataProvider;
 }
 public function actionEmployee()
 {
     $this->layout = false;
     header('Content-type: application/json');
     $tmpDataEmployees = Employee::find(['department', 'employee'])->select(['employee.id', 'employee.firstname', 'employee.lastname', 'employee.profile_image_path', 'department.name', 'employee.email'])->asArray()->innerJoin('department', 'department.id = employee.department_id')->all();
     $employees = [];
     if (!empty($tmpDataEmployees)) {
         foreach ($tmpDataEmployees as $tmpDataEmployee) {
             $employees[] = ['id' => $tmpDataEmployee['id'], 'fullname' => $tmpDataEmployee['firstname'] . ' ' . $tmpDataEmployee['lastname'], 'department' => $tmpDataEmployee['name'], 'urlImage' => $tmpDataEmployee['profile_image_path'], 'email' => $tmpDataEmployee['email']];
         }
     }
     echo json_encode($employees);
 }
$ticket = Ticket::find()->all();
$listData = ArrayHelper::map($ticket, 'ticket_id', 'ticketnumber');
echo $form->field($model, 'ticket_id')->dropDownList($listData, ['prompt' => 'Select Ticket Number']);
?>

    

    <?php 
$ticket_status = TicketStatus::find()->all();
$listData = ArrayHelper::map($ticket_status, 'ticket_status_id', 'status_name');
echo $form->field($model, 'ticket_status_id')->dropDownList($listData, ['prompt' => 'Select Ticket Status']);
?>

    
   <?php 
$employee = Employee::find()->all();
$listData = ArrayHelper::map($employee, 'employee_id', 'firstname', 'lastname');
echo $form->field($model, 'employee_id')->dropDownList($listData, ['prompt' => 'Select Case Number']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>