public function addClientValidation(&$grid)
    {
        $rules = $grid->rules;
        $form  = $grid->attributes;
        if (!array_key_exists('id', $form)) {
            $id         = $this->generateID();
            $grid->attributes(array_merge($form, ['id' => $id]));
            $form['id'] = $id;
        }
        if (!empty($rules)) {
            $form['data-toggle'] = "validator";
            $this->attachScripts();
            $this->attachRules($grid, $rules);
        }


        if ($grid->ajaxable !== false) {
            $this->ajaxValidation->build($grid);
        }

        return ['form' => $form, 'fieldsets' => $grid->fieldsets()];
    }