SignUpController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace App\Admin\Controllers\UserManagement\DocterManagement;
  3. use App\Models\DocterOrganization;
  4. use Encore\Admin\Controllers\AdminController;
  5. use Encore\Admin\Form;
  6. use Encore\Admin\Grid;
  7. use Encore\Admin\Show;
  8. class SignUpController extends AdminController
  9. {
  10. /**
  11. * Title for current resource.
  12. *
  13. * @var string
  14. */
  15. protected $title = '签约管理';
  16. /**
  17. * Make a grid builder.
  18. *
  19. * @return Grid
  20. */
  21. protected function grid()
  22. {
  23. $grid = new Grid(new DocterOrganization());
  24. $grid->disableCreateButton();
  25. $docter_id = \request('docter_id');
  26. $grid->filter(function ($filter){
  27. $filter->disableIdFilter();
  28. $filter->equal('docter_id','医生');
  29. });
  30. $grid->actions(function ($actions) {
  31. // 去掉删除
  32. $actions->disableDelete();
  33. // 去掉查看
  34. $actions->disableView();
  35. // 如果审核成功才能修改认证到期时间
  36. if($actions->row->state != 1){
  37. //去掉编辑
  38. $actions->disableEdit();
  39. }
  40. });
  41. $grid->model()->orderBy('id','desc');
  42. $grid->column('id', __('Id'));
  43. $grid->column('docter_id', __('医生id'));
  44. $grid->column('docter.name', __('医生姓名'));
  45. $grid->column('organization_id', __('机构id'));
  46. $grid->column('organization.name', __('机构名字'));
  47. $grid->column('state', __('审核状态'))->using([0=>'社区端待审核',1=>'审核成功',2=>'审核驳回',3=>'待审核']);
  48. $grid->column('authentication_time', __('签约时间'))->display(function ($time){
  49. if ($time == 0){
  50. return '';
  51. }else
  52. {
  53. return $time;
  54. }
  55. });
  56. $grid->column('authentication_end_time', __('签约到期时间'))->display(function ($time){
  57. if ($time == 0){
  58. return '';
  59. }else
  60. {
  61. return $time;
  62. }
  63. });
  64. $grid->column('created_at', __('创建时间'));
  65. $grid->column('updated_at', __('更新时间'));
  66. return $grid;
  67. }
  68. /**
  69. * Make a show builder.
  70. *
  71. * @param mixed $id
  72. * @return Show
  73. */
  74. protected function detail($id)
  75. {
  76. $show = new Show(DocterOrganization::findOrFail($id));
  77. $show->field('id', __('Id'));
  78. $show->field('docter_id', __('Docter id'));
  79. $show->field('organization_id', __('Organization id'));
  80. $show->field('offices_id', __('Offices id'));
  81. $show->field('qualifications_id', __('Qualifications id'));
  82. $show->field('state', __('State'));
  83. $show->field('created_at', __('Created at'));
  84. $show->field('updated_at', __('Updated at'));
  85. return $show;
  86. }
  87. /**
  88. * Make a form builder.
  89. *
  90. * @return Form
  91. */
  92. protected function form()
  93. {
  94. $form = new Form(new DocterOrganization());
  95. $form->datetime('authentication_end_time', __('签约到期时间'));
  96. return $form;
  97. }
  98. }