|
@@ -2,6 +2,9 @@
|
|
|
|
|
|
namespace App\Community\Controllers;
|
|
namespace App\Community\Controllers;
|
|
|
|
|
|
|
|
+use App\Admin\Actions\Community\Docter\AddAccount;
|
|
|
|
+use App\Admin\Actions\Community\Docter\EditAccount;
|
|
|
|
+use App\Models\CdmsUsers;
|
|
use App\Models\Docter;
|
|
use App\Models\Docter;
|
|
use App\Models\DocterOrganization;
|
|
use App\Models\DocterOrganization;
|
|
use App\Models\Office;
|
|
use App\Models\Office;
|
|
@@ -31,10 +34,16 @@ class DocterOrgController extends AdminController
|
|
$grid = new Grid(new DocterOrganization());
|
|
$grid = new Grid(new DocterOrganization());
|
|
|
|
|
|
// $grid->disableCreateButton(false);
|
|
// $grid->disableCreateButton(false);
|
|
- $is_admin = Admin::user()->isRole('administrator');
|
|
|
|
- $grid->model()->where(['organization_id'=>Admin::user()->org_id]);
|
|
|
|
|
|
+ $is_manager = Admin::user()->isRole('manager');
|
|
$grid->column('id', __('Id'));
|
|
$grid->column('id', __('Id'));
|
|
$grid->column('docter.name', __('成员名称'));
|
|
$grid->column('docter.name', __('成员名称'));
|
|
|
|
+ if($is_manager){
|
|
|
|
+ $grid->model()->where(['organization_id'=>Admin::user()->org_id]);
|
|
|
|
+ } else {
|
|
|
|
+ $grid->column('organization.name','所属机构')->display(function ($org_name){
|
|
|
|
+ return $org_name ?? '总后台';
|
|
|
|
+ });
|
|
|
|
+ }
|
|
$grid->column('docter.sex', __('性别'))->display(function ($w){
|
|
$grid->column('docter.sex', __('性别'))->display(function ($w){
|
|
return $w==1?'男':'女';
|
|
return $w==1?'男':'女';
|
|
});;
|
|
});;
|
|
@@ -53,8 +62,17 @@ class DocterOrgController extends AdminController
|
|
});
|
|
});
|
|
|
|
|
|
$grid->actions(function ($actions){
|
|
$grid->actions(function ($actions){
|
|
- $actions->disableDelete(false);
|
|
|
|
|
|
+ $actions->disableDelete();
|
|
$actions->disableView(false);
|
|
$actions->disableView(false);
|
|
|
|
+ $actions->disableEdit();
|
|
|
|
+ $docter_id = $actions->row->docter_id;
|
|
|
|
+ $org_id = $actions->row->organization_id;
|
|
|
|
+ $have_user = CdmsUsers::where(['org_id'=>$org_id,'docter_id'=>$docter_id])->first();
|
|
|
|
+ if($have_user){
|
|
|
|
+ $actions->add(new EditAccount());
|
|
|
|
+ } else {
|
|
|
|
+ $actions->add(new AddAccount());
|
|
|
|
+ }
|
|
});
|
|
});
|
|
return $grid;
|
|
return $grid;
|
|
}
|
|
}
|
|
@@ -69,12 +87,16 @@ class DocterOrgController extends AdminController
|
|
{
|
|
{
|
|
$show = new Show(DocterOrganization::findOrFail($id));
|
|
$show = new Show(DocterOrganization::findOrFail($id));
|
|
|
|
|
|
- $show->field('id', __('Id'));
|
|
|
|
- $show->field('docter_id', __('Docter id'));
|
|
|
|
- $show->field('organization_id', __('Organization id'));
|
|
|
|
- $show->field('created_at', __('Created at'));
|
|
|
|
- $show->field('updated_at', __('Updated at'));
|
|
|
|
-
|
|
|
|
|
|
+ $show->field('docter.name', __('名称'));
|
|
|
|
+ $show->field('docter.phone', __('联系方式 '));
|
|
|
|
+ $show->field('organization.name', __('机构'));
|
|
|
|
+ $show->field('created_at', __('创建时间'));
|
|
|
|
+ $show->field('updated_at', __('更新时间'));
|
|
|
|
+ $show->panel()
|
|
|
|
+ ->tools(function ($tools) {
|
|
|
|
+ $tools->disableEdit(true);
|
|
|
|
+ $tools->disableDelete(true);
|
|
|
|
+ });
|
|
return $show;
|
|
return $show;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -87,12 +109,11 @@ class DocterOrgController extends AdminController
|
|
{
|
|
{
|
|
$form = new Form(new DocterOrganization());
|
|
$form = new Form(new DocterOrganization());
|
|
|
|
|
|
- $form->text('docter.name', __('姓名'));
|
|
|
|
- $form->text('docter.sex', __('姓名'));
|
|
|
|
- $form->text('docter.phone', __('电话'));
|
|
|
|
- $form->text('docter.email', __('邮箱'));
|
|
|
|
- $form->select('docter.card_id', __('身份证号'));
|
|
|
|
- $form->text('docter.tyep', __('类型'));
|
|
|
|
|
|
+ $form->display('docter.name', __('姓名'))->rules('required',['required'=>'名称必须']);
|
|
|
|
+ $form->display('docter.sex', __('姓名'));
|
|
|
|
+ $form->display('docter.phone', __('电话'));
|
|
|
|
+// $form->display('docter.email', __('邮箱'));
|
|
|
|
+ $form->display('docter.card_id', __('身份证号'));
|
|
$form->select('docter.office_id', __('所属部门'))->options(function (){
|
|
$form->select('docter.office_id', __('所属部门'))->options(function (){
|
|
$org_id = Admin::user()->org_id;
|
|
$org_id = Admin::user()->org_id;
|
|
return Office::where(['org_id'=>$org_id])->pluck('name','id');
|
|
return Office::where(['org_id'=>$org_id])->pluck('name','id');
|
|
@@ -102,6 +123,10 @@ class DocterOrgController extends AdminController
|
|
return Qualification::pluck('name','id');
|
|
return Qualification::pluck('name','id');
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ $form->saved(function ($form){
|
|
|
|
+ return redirect('/docters');
|
|
|
|
+ });
|
|
|
|
+
|
|
return $form;
|
|
return $form;
|
|
}
|
|
}
|
|
}
|
|
}
|