public function search($params) { $query = BranchModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id_branch' => $this->id_branch, 'id_orgn' => $this->id_orgn, 'create_by' => $this->create_by, 'update_by' => $this->update_by]); $query->andFilterWhere(['like', 'cd_branch', $this->cd_branch])->andFilterWhere(['like', 'nm_branch', $this->nm_branch])->andFilterWhere(['like', 'create_at', $this->create_at])->andFilterWhere(['like', 'update_at', $this->update_at]); return $dataProvider; }
public static function getBranchList($id_user = null) { if ($id_user === null) { return ArrayHelper::map(Branch::find()->all(), 'id_branch', 'nm_branch'); } else { $query = UserToBranch::find()->with('idBranch')->where(['user_id' => $id_user]); return ArrayHelper::map($query->all(), 'id_branch', 'idBranch.nm_branch'); } }
* @var yii\widgets\ActiveForm $form */ ?> <div class="warehouse-form col-lg-6" style="padding-left: 0px;"> <?php $form = ActiveForm::begin(); ?> <div class="panel panel-primary"> <div class="panel-heading"> Warehouse </div> <div class="panel-body"> <?php echo $form->field($model, 'id_branch')->dropDownList(ArrayHelper::map(Branch::find()->all(), 'id_branch', 'nm_branch'), ['style' => 'width:200px;']); ?> <?php echo $form->field($model, 'cd_whse')->textInput(['maxlength' => 4, 'style' => 'width:120px;']); ?> <?php echo $form->field($model, 'nm_whse')->textInput(['maxlength' => 32]); ?> </div> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?>
* @var biz\master\models\User2Branch $model * @var yii\widgets\ActiveForm $form */ ?> <div class="box box-primary"> <div class="box-body"> <?php $form = ActiveForm::begin(); ?> <?php echo ''; ?> <?php echo $form->field($model, 'id_branch')->dropDownList(ArrayHelper::map(Branch::find()->all(), 'id_branch', 'nm_branch')); ?> <?php echo ''; ?> <?php $listUser = User::find()->select('username')->asArray()->column(); $dUser = []; // foreach ($listUser as $row) { // $dUser[]=$row['username']; // } echo $form->field($model, 'nmUser')->widget('yii\\jui\\AutoComplete', ['options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $listUser]]); ?> </div> <div class="box-footer">