<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\TechnicianUser;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class TechnicianUserController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new TechnicianUser(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('name');
            $grid->column('user_id');
            $grid->column('mobile');
            $grid->column('nickname');
            $grid->column('avatar');
            $grid->column('status');
            $grid->column('sex');
            $grid->column('work_time');
            $grid->column('city');
            $grid->column('lng');
            $grid->column('lat');
            $grid->column('address');
            $grid->column('brief');
            $grid->column('id_code');
            $grid->column('id_card');
            $grid->column('license');
            $grid->column('work_img');
            $grid->column('self_img');
            $grid->column('is_work');
            $grid->column('birthday');
            $grid->column('order_num');
            $grid->column('total_order_num');
            $grid->column('is_recommend');
            $grid->column('sort');
            $grid->column('auth_status');
            $grid->column('alipay_number');
            $grid->column('verify_text');
            $grid->column('verify_time');
            $grid->column('auth_text');
            $grid->column('auth_time');
            $grid->column('created_at');
            $grid->column('updated_at')->sortable();
        
            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
        
            });
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new TechnicianUser(), function (Show $show) {
            $show->field('id');
            $show->field('name');
            $show->field('user_id');
            $show->field('mobile');
            $show->field('nickname');
            $show->field('avatar');
            $show->field('status');
            $show->field('sex');
            $show->field('work_time');
            $show->field('city');
            $show->field('lng');
            $show->field('lat');
            $show->field('address');
            $show->field('brief');
            $show->field('id_code');
            $show->field('id_card');
            $show->field('license');
            $show->field('work_img');
            $show->field('self_img');
            $show->field('is_work');
            $show->field('birthday');
            $show->field('order_num');
            $show->field('total_order_num');
            $show->field('is_recommend');
            $show->field('sort');
            $show->field('auth_status');
            $show->field('alipay_number');
            $show->field('verify_text');
            $show->field('verify_time');
            $show->field('auth_text');
            $show->field('auth_time');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new TechnicianUser(), function (Form $form) {
            $form->display('id');
            $form->text('name');
            $form->text('user_id');
            $form->text('mobile');
            $form->text('nickname');
            $form->text('avatar');
            $form->text('status');
            $form->text('sex');
            $form->text('work_time');
            $form->text('city');
            $form->text('lng');
            $form->text('lat');
            $form->text('address');
            $form->text('brief');
            $form->text('id_code');
            $form->text('id_card');
            $form->text('license');
            $form->text('work_img');
            $form->text('self_img');
            $form->text('is_work');
            $form->text('birthday');
            $form->text('order_num');
            $form->text('total_order_num');
            $form->text('is_recommend');
            $form->text('sort');
            $form->text('auth_status');
            $form->text('alipay_number');
            $form->text('verify_text');
            $form->text('verify_time');
            $form->text('auth_text');
            $form->text('auth_time');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
