<?php

namespace App\Admin\Controllers;

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

class TechnicianApproveController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new TechnicianApprove(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('name');
            $grid->column('user_id');
            $grid->column('technician_id');
            $grid->column('mobile');
            $grid->column('avatar');
            $grid->column('status');
            $grid->column('sex');
            $grid->column('work_time');
            $grid->column('city_id');
            $grid->column('lng');
            $grid->column('lat');
            $grid->column('address');
            $grid->column('brief');
            $grid->column('license');
            $grid->column('work_img');
            $grid->column('self_img');
            $grid->column('birthday');
            $grid->column('verify_text');
            $grid->column('verify_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 TechnicianApprove(), function (Show $show) {
            $show->field('id');
            $show->field('name');
            $show->field('user_id');
            $show->field('technician_id');
            $show->field('mobile');
            $show->field('avatar');
            $show->field('status');
            $show->field('sex');
            $show->field('work_time');
            $show->field('city_id');
            $show->field('lng');
            $show->field('lat');
            $show->field('address');
            $show->field('brief');
            $show->field('license');
            $show->field('work_img');
            $show->field('self_img');
            $show->field('birthday');
            $show->field('verify_text');
            $show->field('verify_time');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new TechnicianApprove(), function (Form $form) {
            $form->display('id');
            $form->text('name');
            $form->text('user_id');
            $form->text('technician_id');
            $form->text('mobile');
            $form->text('avatar');
            $form->text('status');
            $form->text('sex');
            $form->text('work_time');
            $form->text('city_id');
            $form->text('lng');
            $form->text('lat');
            $form->text('address');
            $form->text('brief');
            $form->text('license');
            $form->text('work_img');
            $form->text('self_img');
            $form->text('birthday');
            $form->text('verify_text');
            $form->text('verify_time');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
