<?php

namespace App\Admin\Controllers;

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

class ScmUserController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new ScmUser(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('name');
            $grid->column('email');
            $grid->column('email_verified_at');
            $grid->column('password');
            $grid->column('phone');
            $grid->column('remember_token');
            $grid->column('account_properties');
            $grid->column('status');
            $grid->column('company_name');
            $grid->column('first_name');
            $grid->column('last_name');
            $grid->column('create_time');
            $grid->column('update_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 ScmUser(), function (Show $show) {
            $show->field('id');
            $show->field('name');
            $show->field('email');
            $show->field('email_verified_at');
            $show->field('password');
            $show->field('phone');
            $show->field('remember_token');
            $show->field('account_properties');
            $show->field('status');
            $show->field('company_name');
            $show->field('first_name');
            $show->field('last_name');
            $show->field('create_time');
            $show->field('update_time');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new ScmUser(), function (Form $form) {
            $form->display('id');
            $form->text('name');
            $form->text('email');
            $form->text('email_verified_at');
            $form->text('password');
            $form->text('phone');
            $form->text('remember_token');
            $form->text('account_properties');
            $form->text('status');
            $form->text('company_name');
            $form->text('first_name');
            $form->text('last_name');
            $form->text('create_time');
            $form->text('update_time');

            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}