/**
  * @return array
  * handel search conditions
  */
 function handel_search()
 {
     $query = Schedule::find();
     switch ($_REQUEST['st']) {
         case 1:
             $_REQUEST['search_input'] ? $arr['employee_id'] = Employee::findOne(['name' => $_REQUEST['search_input']])->id : '';
             //search  employee name
             break;
         case 2:
             //($_REQUEST['search_input'])?$arr['mobile']=$_REQUEST['search_input']:'';
             $_REQUEST['search_input'] ? $condition['mobile'] = $_REQUEST['search_input'] : '';
             break;
         default:
     }
     $arr['agency_id'] = Yii::$app->user->identity->id;
     $query->where($arr);
     if ($_REQUEST['st']) {
         //($_REQUEST['status'])?$arr['job_id']=PostJob::findOne(['job_status'=>$_REQUEST['status']])->id:'';      //search job status
         // ($_REQUEST['service_type'])?$arr['job_id']=$_REQUEST['service_type']:'';                //search service_type
         $_REQUEST['status'] ? $condition['job_status'] = $_REQUEST['status'] : '';
         $_REQUEST['service_type'] ? $condition['service_type'] = $_REQUEST['service_type'] : '';
         $res = PostJob::find()->where($condition)->all();
         if (count($res) > 0) {
             foreach ($res as $k => $v) {
                 $ids[] = $v->id;
             }
             $query->andWhere(['in', 'job_id', $ids]);
         } else {
             $query->andWhere(['job_id' => '-1']);
         }
     }
     return $query;
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PostJob::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, 'user_id' => $this->user_id, 'payment_id' => $this->payment_id, 'create_time' => $this->create_time, 'beginning_date' => $this->beginning_date, 'end_date' => $this->end_date, 'worker' => $this->worker, 'price_range' => $this->price_range, 'number_family' => $this->number_family]);
     $query->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'topic', $this->topic])->andFilterWhere(['like', 'job_status', $this->job_status])->andFilterWhere(['like', 'service_type', $this->service_type])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'view_time', $this->view_time])->andFilterWhere(['like', 'week', $this->week])->andFilterWhere(['like', 'period', $this->period])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'province', $this->province])->andFilterWhere(['like', 'district', $this->district])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'term_period', $this->term_period])->andFilterWhere(['like', 'cleaning_type', $this->cleaning_type])->andFilterWhere(['like', 'cleaning_pet_type', $this->cleaning_pet_type])->andFilterWhere(['like', 'work_times', $this->work_times])->andFilterWhere(['like', 'workingdays_perweek', $this->workingdays_perweek])->andFilterWhere(['like', 'cleaning_time_estimate', $this->cleaning_time_estimate])->andFilterWhere(['like', 'estimated_date', $this->estimated_date])->andFilterWhere(['like', 'cleaning_size', $this->cleaning_size])->andFilterWhere(['like', 'beginning_time', $this->beginning_time])->andFilterWhere(['like', 'end_time', $this->end_time])->andFilterWhere(['like', 'stay_type', $this->stay_type])->andFilterWhere(['like', 'sex_type', $this->sex_type])->andFilterWhere(['like', 'cure_type', $this->cure_type])->andFilterWhere(['like', 'baby_age_type', $this->baby_age_type])->andFilterWhere(['like', 'food_type', $this->food_type])->andFilterWhere(['like', 'baby_type', $this->baby_type])->andFilterWhere(['like', 'longitude', $this->longitude])->andFilterWhere(['like', 'latitude', $this->latitude]);
     return $dataProvider;
 }
示例#3
0
 /**
  * Finds the PostJob model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PostJob the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PostJob::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#4
0
            </table>
        </div>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'layout' => "<div class='wrap'>{summary}{pager}</div>{items}\n<div class='wrap'>{summary}{pager}</div>", 'columns' => ['job_id', 'update_time', ['label' => '工作种类', 'format' => 'raw', 'value' => function ($model) {
    return Yii::$app->params['empl_type'][PostJob::findOne($model->job_id)['service_type']];
}], ['label' => '工作状态', 'format' => 'raw', 'value' => function ($model) {
    return Yii::$app->params['job_status'][PostJob::findOne($model->job_id)['job_status']];
}], ['label' => '地区', 'format' => 'raw', 'value' => function ($model) {
    return PostJob::findOne($model->user_id)['district'];
}], ['label' => '地址', 'format' => 'raw', 'value' => function ($model) {
    return PostJob::findOne($model->user_id)['address'];
}], ['label' => '配置工作人员', 'format' => 'raw', 'value' => function ($model) {
    return Employee::findOne($model->employee_id)['name'];
}], ['label' => '客户', 'format' => 'raw', 'value' => function ($model) {
    return User::findOne($model->user_id)['display_name'];
}], ['label' => '客户电话', 'format' => 'raw', 'value' => function ($model) {
    return PostJob::findOne($model->job_id)['mobile'];
}], ['label' => '付款记录', 'format' => 'raw', 'value' => function ($model) {
    return '记录';
}]]]);
?>

    </div>
</div>
<script src="<?php 
echo $this->context->get_path();
?>
/custom/search.js" type="text/javascript"></script>