SignUpController.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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->column('id', __('Id'));
  42. $grid->column('docter_id', __('医生id'));
  43. $grid->column('docter.name', __('医生姓名'));
  44. $grid->column('organization_id', __('机构id'));
  45. $grid->column('organization.name', __('机构名字'));
  46. $grid->column('state', __('审核状态'))->using([0=>'社区端待审核',1=>'审核成功',2=>'审核驳回',3=>'待审核']);
  47. $grid->column('authentication_time', __('签约时间'))->display(function ($time){
  48. if ($time == 0){
  49. return '';
  50. }else
  51. {
  52. return $time;
  53. }
  54. });
  55. $grid->column('authentication_end_time', __('签约到期时间'))->display(function ($time){
  56. if ($time == 0){
  57. return '';
  58. }else
  59. {
  60. return $time;
  61. }
  62. });
  63. $grid->column('created_at', __('创建时间'));
  64. $grid->column('updated_at', __('更新时间'));
  65. return $grid;
  66. }
  67. /**
  68. * Make a show builder.
  69. *
  70. * @param mixed $id
  71. * @return Show
  72. */
  73. protected function detail($id)
  74. {
  75. $show = new Show(DocterOrganization::findOrFail($id));
  76. $show->field('id', __('Id'));
  77. $show->field('docter_id', __('Docter id'));
  78. $show->field('organization_id', __('Organization id'));
  79. $show->field('offices_id', __('Offices id'));
  80. $show->field('qualifications_id', __('Qualifications id'));
  81. $show->field('state', __('State'));
  82. $show->field('created_at', __('Created at'));
  83. $show->field('updated_at', __('Updated at'));
  84. return $show;
  85. }
  86. /**
  87. * Make a form builder.
  88. *
  89. * @return Form
  90. */
  91. protected function form()
  92. {
  93. $form = new Form(new DocterOrganization());
  94. $form->datetime('authentication_end_time', __('签约到期时间'));
  95. return $form;
  96. }
  97. }