header('服务事项预约列表')
            ->description(' ')
            ->body($this->grid());
    }
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new LtApppointment);
        $grid->model()->orderBy('id', 'DESC');
        $status = \Illuminate\Support\Facades\Request::input('status', 99);
        if ($status != 99) {
            $grid->model()->where('status', '=', $status);
        } else {
            $grid->model()->where('status', '<', 2);
        }
        $grid->number('预约号码')->width(200);
        $grid->username('真实姓名')->width(150);
        $grid->phone('手机')->width(150);
        $grid->service('服务事项')->width(300);
        $grid->content('说明')->width(600);
        $grid->createtime('登记时间')->width(300);
        $grid->is_talent('是否认证人才')->width(300)->display(function () {
            if ($this->is_talent == 0) {
                return '未认证人才';
            } else if ($this->is_talent == 1) {
                return '已认证人才';
            }
            return '';
        });
        $grid->evaluate('评价')->display(function () {
            if ($this->is_talent == 1) {
                if (empty($this->evaluate)) {
                    return '未评价';
                } else {
                    return '' . $this->evaluate . '';
                }
            } else {
                return '不需要评价';
            }
            return '';
        });
        $grid->actions(function ($actions) {
            $actions->disableView(false);
        });
        $grid->filter(function ($filter) {
            $filter->disableIdFilter();
            $filter->like('number', '预约单号');
            $filter->like('username', '姓名');
            $type_option = ['0' => '未认证人才', '1' => '已认证人才', '99' => '全部'];
            $filter->where(function ($query) {
                if ($this->input != 99) {
                    $query->where('is_talent', '=', "{$this->input}");
                }
            }, '是否认证人才', 'is_talent')->radio($type_option);
        });
        return $grid;
    }
    public function show($id, Content $content)
    {
        return $content
            ->header('详情')
            ->description()
            ->body($this->detail($id));
    }
    protected function detail($id)
    {
        $show = new Show(LtApppointment::findOrFail($id));
        $show->number('预约号码');
        $show->username('真实姓名');
        $show->phone('手机');
        $show->service('服务事项');
        $show->content('说明');
        $show->createtime('登记时间');
        $show->is_talent('是否认证人才')->display(function () {
            if ($this->is_talent == 0) {
                return '未认证人才';
            } else if ($this->is_talent == 1) {
                return '已认证人才';
            }
            return '';
        });
        $show->evaluate('评价')->display(function () {
            if ($this->is_talent == 1) {
                if (empty($this->evaluate)) {
                    return '未评价';
                } else {
                    return '' . $this->evaluate . '';
                }
            } else {
                return '不需要评价';
            }
            return '';
        });
        return $show;
    }
}