edit.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. use common\helpers\Url;
  3. use yii\widgets\ActiveForm;
  4. use common\enums\GenderEnum;
  5. /** @var ActiveForm $form */
  6. /** @var \yii\db\ActiveRecord $model */
  7. $form = ActiveForm::begin([
  8. 'validationUrl' => Url::to(['edit', 'id' => $model['id']]),
  9. 'fieldConfig' => [
  10. 'template' => "<div class='row'><div class='col-sm-2 text-right'>{label}</div><div class='col-sm-10'>{input}\n{hint}\n{error}</div></div>",
  11. ]
  12. ]);
  13. ?>
  14. <div class="row">
  15. <div class="col-12">
  16. <div class="box">
  17. <div class="box-header with-border">
  18. <h3 class="box-title">基本信息</h3>
  19. </div>
  20. <div class="box-body">
  21. <?= $form->field($model, 'username')->textInput([
  22. 'disabled' => true
  23. ]); ?>
  24. <?= $form->field($model, 'realname')->textInput() ?>
  25. <?= $form->field($model, 'head_portrait')->widget(\common\widgets\cropper\Cropper::class, []); ?>
  26. <?= $form->field($model, 'gender')->radioList(GenderEnum::getMap()) ?>
  27. <?= $form->field($model, 'mobile')->textInput() ?>
  28. <?= $form->field($model, 'email')->textInput() ?>
  29. <?= $form->field($model, 'birthday')->widget('kartik\date\DatePicker', [
  30. 'language' => 'zh-CN',
  31. 'layout' => '{picker}{input}',
  32. 'pluginOptions' => [
  33. 'format' => 'yyyy-mm-dd',
  34. 'todayHighlight' => true,// 今日高亮
  35. 'autoclose' => true,// 选择后自动关闭
  36. 'todayBtn' => true,// 今日按钮显示
  37. ],
  38. 'options' => [
  39. 'class' => 'form-control no_bor',
  40. ]
  41. ]); ?>
  42. <?= \common\widgets\linkage\Linkage::widget([
  43. 'form' => $form,
  44. 'model' => $model,
  45. // 'template' => 'short',
  46. ]); ?>
  47. <?= $form->field($model, 'address')->textarea() ?>
  48. <?= $form->field($model, 'status')->radioList(\common\enums\StatusEnum::getMap()) ?>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <?php ActiveForm::end(); ?>
粤ICP备19079148号