public function actionFasten($id) { $user = Users::getOne($id); $status = $user['status']; $regions = Geo::find()->all(); $region = ArrayHelper::map($regions, 'id', 'name'); return $this->render('fasten', ['model' => $user, 'region' => $region, 'id' => $id, 'status_id' => $status, 'status' => Yii::$app->params['status_user'][$status]]); }
<?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'manuf')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'is_active')->checkbox(); ?> <?php echo $form->field($model, 'region_id')->dropdownList(Geo::find()->select(['name', 'id'])->indexBy('id')->column(), ['prompt' => 'Выберите регион']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Добавить' : 'Обновить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('Добавить препарат', ['create'], ['class' => 'btn btn-success']); ?> </p> <br> <?php $reg = Geo::find()->select(['name', 'id'])->indexBy('id')->orderBy('name')->column(); echo Html::dropdownList('region', $region, $reg, ['class' => 'form-control', 'id' => 'change_reg']); ?> <script> $(document).ready(function () { $('#change_reg').change(function () { window.location.href='?region='+this.value; }); }); </script> <br> <table> <?php foreach ($model as $preparat) {