<?php

use yii\helpers\Url;
use qcbase\models\Auth;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $model common\models\User */

$this->title = '用户管理';

//默认值
if ($model->isNewRecord) {
    $model->gender = 1;
    $model->status = 1;
    $model->info = new qcbase\models\UserInfo;
} else {
    empty($model->depts) && $model->depts = ArrayHelper::getColumn($model->dept, 'dept_id');
    $model->role = array_keys(Auth::getRolesByUser($model->user_id));
}
?>

<div class="nav">
    <!--<div class="return"><a href="">返回上一级</a></div>-->
    <ul class="cc">
        <li ><a href="<?= Url::to([$this->context->id . '/index']) ?>">用户管理</a></li>
        <li class="current"><a href="<?= Url::to([$this->context->id . '/create']) ?>">添加用户</a></li>
    </ul>
</div>


<?= $this->render('_form', ['model' => $model, 'action' => $action]); ?>
