DoctorManagementController.php 4.6 KB

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