<?php
namespace App\Admin\Renderable;


use App\Admin\Repositories\DistAdminDistributor;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class DistDistributorTable extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(DistAdminDistributor::with(['appearance']), function (Grid $grid) {
            $grid->view('admin.grid.table');
            $grid->column('id')->width('5%');
            $grid->column('client_code', admin_trans_label('client_code'))->width('25%');
            $grid->column('distr_email',admin_trans_label('email'));
            $grid->column('dist_contact_number',admin_trans_label('contact_number'));
            $grid->column('country');
            $grid->disableActions();
            $grid->paginate(10);
//            $grid->filter(function (Grid\Filter $filter) {
//                $filter->like('client_code')->width(4);
//            });
            $grid->quickSearch('client_code');
            $grid->model()->where('enabled', 1)->orderBy('id', 'desc');
        });
    }
}
