You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.7 KiB
39 lines
1.7 KiB
<?php
|
|
|
|
namespace App\Forms;
|
|
|
|
use App\Models\Project;
|
|
use Kris\LaravelFormBuilder\Form;
|
|
use Kris\LaravelFormBuilder\Field;
|
|
|
|
class ManagerForm extends Form
|
|
{
|
|
public function buildForm()
|
|
{
|
|
$this->add("type", Field::SELECT, ["label" => "用户类型", "choices" => [
|
|
"teacher" => "管理老师",
|
|
"manager" => "项目经理"
|
|
]]);
|
|
$this->add("order_status_ability", Field::SELECT, ["label" => "订单恢复权限", "choices" => [
|
|
"0" => "不开放",
|
|
"1" => "开放"
|
|
]]);
|
|
$this->add("project_id", Field::SELECT, ["label" => "管辖项目/医院", "rules" => "required", "attr" => ["multiple" => true, "data-plugin" => "select2"], "choices" => (new Project())->get()->pluck("name", "id")->toArray()]);
|
|
|
|
$this->add("name", Field::TEXT, ["label" => "姓名", "rules" => "required"]);
|
|
$this->add("mobile", Field::TEXT, ["label" => "电话", "rules" => "required"]);
|
|
$this->add("username", Field::TEXT, ["label" => "用户名", "rules" => "required"]);
|
|
$this->add("password", Field::PASSWORD, ["label" => "密码", "rules" => "required"]);
|
|
$this->add("birthday", Field::TEXT, ["label" => "生日", "rules" => "required"]);
|
|
$this->add("sex", Field::SELECT, ["label" => "性别", "choices" => [
|
|
"男" => "男",
|
|
"女" => "女"
|
|
]]);
|
|
|
|
$this->add('buttons', 'buttongroup', ["splitted" => true, "buttons" => [
|
|
["label" => "保存", "attr" => ["class" => "btn btn-primary mr-1", "type" => "submit"]],
|
|
["label" => "返回", "attr" => ["class" => "btn btn-light btn-back", "type" => "button"]]
|
|
]]);
|
|
}
|
|
}
|