DoctorManagementController.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. namespace App\Admin\Controllers\UserManagement\DocterManagement;
  3. use App\Admin\Actions\backstage\Docters\SignUp;
  4. use App\Admin\Actions\backstage\Docters\Team;
  5. use App\Models\Docter;
  6. use App\Models\DocterOrganization;
  7. use App\Models\Organization;
  8. use App\Models\User;
  9. use Encore\Admin\Controllers\AdminController;
  10. use Encore\Admin\Form;
  11. use Encore\Admin\Grid;
  12. use Encore\Admin\Show;
  13. class DoctorManagementController extends AdminController
  14. {
  15. /**
  16. * Title for current resource.
  17. *
  18. * @var string
  19. */
  20. protected $title = '医生列表';
  21. /**
  22. * Make a grid builder.
  23. *
  24. * @return Grid
  25. */
  26. protected function grid()
  27. {
  28. $grid = new Grid(new Docter());
  29. $grid->disableCreateButton();
  30. $grid->filter(function ($filter){
  31. $filter->disableIdFilter();
  32. $filter->like('name','昵称');
  33. $filter->equal('status','工作状态')->select([
  34. 0 => '禁用',
  35. 1 => '启用',
  36. ]);
  37. });
  38. $grid->actions(function ($actions) {
  39. // 去掉编辑
  40. $actions->disableEdit();
  41. // 去掉查看
  42. $actions->disableView();
  43. //签约管理
  44. $actions->add(new SignUp());
  45. //团队管理
  46. $actions->add(new Team());
  47. });
  48. $grid->column('id', __('Id'))->sortable();
  49. $grid->column('name', __('姓名'));
  50. $grid->column('avatar', __('头像'))->image('',50,50);
  51. $grid->column('score', __('评分'));
  52. $grid->column('service_persons', __('服务人数'));
  53. $states = [
  54. 'on' => ['value' => 1, 'text' => '启用', 'color' => 'primary'],
  55. 'off' => ['value' => 0, 'text' => '禁用', 'color' => 'danger'],
  56. ];
  57. $grid->column('status', __('工作状态'))->switch($states);
  58. $grid->column('is_then', __('认证状态'))->using([0=>'未认证',1=>'已认证']);
  59. $grid->column('label', __('标签'))->label('info');
  60. return $grid;
  61. }
  62. /**
  63. * Make a show builder.
  64. *
  65. * @param mixed $id
  66. * @return Show
  67. */
  68. protected function detail($id)
  69. {
  70. $show = new Show(Docter::findOrFail($id));
  71. $show->field('id', __('Id'));
  72. $show->field('type', __('Type'));
  73. $show->field('name', __('Name'));
  74. $show->field('phone', __('Phone'));
  75. $show->field('sex', __('Sex'));
  76. $show->field('birthday', __('Birthday'));
  77. $show->field('avatar', __('Avatar'));
  78. $show->field('status', __('Status'));
  79. $show->field('label', __('Label'));
  80. $show->field('sign', __('Sign'));
  81. $show->field('intro', __('Intro'));
  82. $show->field('office_id', __('Office id'));
  83. $show->field('qualification_id', __('Qualification id'));
  84. $show->field('score', __('Score'));
  85. $show->field('service_persons', __('Service persons'));
  86. $show->field('eva_num', __('Eva num'));
  87. $show->field('service_days', __('Service days'));
  88. $show->field('phone_minutes', __('Phone minutes'));
  89. $show->field('chat_price', __('Chat price'));
  90. $show->field('phone_price', __('Phone price'));
  91. $show->field('appoint_price', __('Appoint price'));
  92. $show->field('is_chat', __('Is chat'));
  93. $show->field('is_phone', __('Is phone'));
  94. $show->field('is_appoint', __('Is appoint'));
  95. $show->field('latitude', __('Latitude'));
  96. $show->field('longitude', __('Longitude'));
  97. $show->field('created_at', __('Created at'));
  98. $show->field('updated_at', __('Updated at'));
  99. $show->field('user_id', __('User id'));
  100. $show->field('password', __('Password'));
  101. $show->field('is_then', __('Is then'));
  102. $show->field('practice', __('Practice'));
  103. $show->field('card_photo', __('Card photo'));
  104. $show->field('is_quail', __('Is quail'));
  105. $show->field('card_id', __('Card id'));
  106. $show->field('receiving_time', __('Receiving time'));
  107. return $show;
  108. }
  109. /**
  110. * Make a form builder.
  111. *
  112. * @return Form
  113. */
  114. protected function form()
  115. {
  116. $form = new Form(new Docter());
  117. $form->switch('status', __('状态'));
  118. return $form;
  119. }
  120. }