<?php

namespace App\Admin\Controllers;

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

class TechnicianPositionController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new TechnicianPosition(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('technician_id');
            $grid->column('longitude');
            $grid->column('latitude');
            $grid->column('nation_code');
            $grid->column('city_code');
            $grid->column('province');
            $grid->column('city');
            $grid->column('district');
            $grid->column('street');
            $grid->column('street_number');
            $grid->column('adcode');
            $grid->column('district_code');
            $grid->column('phone_area_code');
            $grid->column('address');
            $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 TechnicianPosition(), function (Show $show) {
            $show->field('id');
            $show->field('technician_id');
            $show->field('longitude');
            $show->field('latitude');
            $show->field('nation_code');
            $show->field('city_code');
            $show->field('province');
            $show->field('city');
            $show->field('district');
            $show->field('street');
            $show->field('street_number');
            $show->field('adcode');
            $show->field('district_code');
            $show->field('phone_area_code');
            $show->field('address');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new TechnicianPosition(), function (Form $form) {
            $form->display('id');
            $form->text('technician_id');
            $form->text('longitude');
            $form->text('latitude');
            $form->text('nation_code');
            $form->text('city_code');
            $form->text('province');
            $form->text('city');
            $form->text('district');
            $form->text('street');
            $form->text('street_number');
            $form->text('adcode');
            $form->text('district_code');
            $form->text('phone_area_code');
            $form->text('address');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
