/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Msdoctor::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(['DoctorID' => $this->DoctorID]); $query->andFilterWhere(['like', 'FirstName', $this->FirstName])->andFilterWhere(['like', 'LastName', $this->LastName])->andFilterWhere(['like', 'PhoneNumber', $this->PhoneNumber])->andFilterWhere(['like', 'Address', $this->Address])->andFilterWhere(['like', 'Gender', $this->Gender])->andFilterWhere(['like', 'Notes', $this->Notes]); return $dataProvider; }
use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\jui\DatePicker; use app\models\Msroom; use app\models\Mspatient; use app\models\Msdoctor; use kartik\datetime\DateTimePicker; /* @var $this yii\web\View */ /* @var $model app\models\Trreservation */ /* @var $form yii\widgets\ActiveForm */ ?> <?php $listRoom = ArrayHelper::map(Msroom::find()->all(), 'RoomID', 'RoomName'); $listPatient = ArrayHelper::map(Mspatient::find()->all(), 'PatientID', 'FirstName'); $listDoctor = ArrayHelper::map(Msdoctor::find()->all(), 'DoctorID', 'FirstName'); ?> <div class="trreservation-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'Date')->widget(DateTimePicker::className()); ?> <?php echo $form->field($model, 'RoomID')->dropDownList($listRoom); ?>