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