<?php
use app\models\Config;
$config = Config::find()->where("id=1")->one();
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php echo $this->params["meta_title"]; ?><?php echo $config->name; ?></title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="/plugins/msui/css/sm.min.css">
    <link rel="stylesheet" href="/plugins/msui/css/sm-extend.min.css">
    <script type="text/javascript" src="/public/js/zepto.min.js"></script>
  </head>
  <body>
    <div class="page-group">
        <div class="page">
            <header class="bar bar-nav">
                <h1 class="title" style="padding-top: 2px;">用户注册</h1>
            </header>

            <div class="content">
              <form id="detail_form" method="post">
              <div class="list-block">
                <ul>
                  <li>
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">角色</div>
                        <div class="item-input">
                          <select name="roleid">
                            <option value="" selected>请选择</option>
                            <?php foreach($roles as $onerole){ ?>
                            <option value="<?php echo $onerole->id; ?>"><?php echo $onerole->name; ?></option>
                            <?php } ?>
                          </select>
                        </div>
                      </div>
                    </div>
                  </li>
                  <li id="specialtybox">
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">专业</div>
                        <div class="item-input">
                          <select name="specialid">
                          <option value="">请选择</option>
                          <?php foreach($colleges as $onechapter){ ?>
                          <option disabled value="<?php echo $onechapter->id; ?>"><?php echo $onechapter->name; ?></option>
                            <?php if(!empty($onechapter->children)){ foreach($onechapter->children as $onesection){ ?>
                            <option disabled value="<?php echo $onesection->id; ?>"><?php echo $onesection->name; ?></option>
                            <?php if(!empty($onesection->children)){ foreach($onesection->children as $oneknowled){ ?>
                            <option value="<?php echo $oneknowled->id; ?>"><?php echo $oneknowled->name; ?></option>
                            <?php } } ?>
                          <?php } } ?>
                          <?php } ?>
                          </select>
                        </div>
                      </div>
                    </div>
                  </li>
                  <li id="xzclassbox">
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">班级</div>
                        <div class="item-input">
                          <select name="xzclassid">
                          <option value="">请选择</option>
                          </select>
                        </div>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">用户名</div>
                        <div class="item-input">
                          <input type="text" name="username" placeholder="请输入" maxlength="20">
                        </div>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">密码</div>
                        <div class="item-input">
                          <input type="password" name="password" placeholder="请输入" maxlength="20">
                        </div>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">姓名</div>
                        <div class="item-input">
                          <input type="text" name="realname" placeholder="请输入" maxlength="20">
                        </div>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">性别</div>
                        <div class="item-input">
                          <select name="male">
                            <option value="1" selected>男</option>
                            <option value="2">女</option>
                            <option value="0">保密</option>
                          </select>
                        </div>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">学号/工号</div>
                        <div class="item-input">
                          <input type="text" name="stdnumber" placeholder="请输入" maxlength="20">
                        </div>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">邮箱</div>
                        <div class="item-input">
                          <input type="email" name="email" placeholder="请输入" maxlength="50">
                        </div>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="item-content">
                      <div class="item-inner">
                        <div class="item-title label">验证</div>
                        <div class="item-input">
                          <img src="/verifycode/index" style="cursor: pointer; float: left; padding-top: 10px;" title="点击刷新" onclick="javascript:this.src='/verifycode/index?rnum='+ Math.random();">
                          <input type="text" name="verifycode" placeholder="请输入" maxlength="10" style="float: left; width: 50%;">
                        </div>
                      </div>
                    </div>
                  </li>
                </ul>
              </div>
              <input type="hidden" name="_csrf" value="<?php echo Yii::$app->request->getCsrfToken(); ?>">
              </form>
              <div class="content-block">
                <div class="row">
                  <div class="col-50"><a class="button button-big button-fill button-danger">取消</a></div>
                  <div class="col-50"><a class="button button-big button-fill button-success" id="finished_button">提交</a></div>
                </div>
                <div style="margin-top: 20px; text-align: center;"><a href="/api/login/index" class="external">已有帐号？立即登录</a></div>
              </div>
            </div>
        </div>

    </div>

    <script type="text/javascript" src="/plugins/msui/js/sm.min.js"></script>
    <script type="text/javascript" src="/plugins/msui/js/sm-extend.min.js"></script>

    <script src="/public/modules/api/register/index.js"></script>
  </body>
</html>