<?php

namespace App\Admin\Controllers;

use App\Admin\Actions\Service\ApplysAction;
use App\Admin\Actions\Service\RefuseAction;
use App\Models\Serviceapplys;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class OutpatientServiceCCController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '门诊咨询认证';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new Serviceapplys());

        $grid->model()->where('service_type','3');
        $grid->column('id', __('Id'));
        $grid->column('docter.avatar', __('头像'))->image('',50,50);
        $grid->column('docter.id', __('医生ID'));
        $grid->column('docter.name','医生名称');
        $grid->column('docter.sex','性别')->using([1=>'男',2=>'女']);
        $grid->column('docter.DocterOrganization', __('所属机构'));
//        $grid->column('docter.label', __('标签'))->map('ucwords')->implode('-');
        $grid->column('docter.label', __('标签'))->label('info');

        //$grid->column('service_type', __('服务类型'));

        $grid->column('status', __('状态'))->using([1=>'审核',2=>'已通过',3=>'已拒绝'])->label([
            1 => 'warning',
            2 => 'success',
            3 => 'default'
        ]);
        $grid->column('created_at', __('创建时间'));
        $grid->column('updated_at', __('更新时间'));
//        $grid->column('service_type','123')->hide();

        $grid->actions(function ($actions) {
            // 去掉删除
            $actions->disableDelete();
            // 去掉编辑
            $actions->disableEdit();
            // 去掉查看
            $actions->disableView();

            $actions->add(new ApplysAction());
            $actions->add(new RefuseAction());
        });
        return $grid;
    }
}
