public function __construct(UserService $userService) { $this->columnModel = array(array('label' => 'ID', 'width' => 100, 'table' => 'user', 'id' => 'id', 'queryParamField' => true), array('label' => 'First Name', 'width' => 100, 'table' => 'user', 'id' => 'first_name', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true), array('label' => 'Last Name', 'width' => 100, 'table' => 'user', 'id' => 'last_name', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true), array('label' => 'Email', 'width' => 100, 'table' => 'user', 'id' => 'email', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true), array('label' => 'Company Name', 'width' => 100, 'table' => 'user', 'id' => 'company_name', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true), array('label' => 'Is Admin', 'width' => 100, 'table' => 'user', 'id' => 'is_admin', 'editable' => true, 'edittype' => 'checkbox', 'editvalues' => '1:0'), array('label' => 'Campaigns', 'width' => 400, 'table' => 'campaign', 'id' => 'campaigns', 'alias' => 'campaigns', 'editable' => true, 'edittype' => 'multiselect', 'editvalues' => $userService->getSpotCampaignIdsForSelectFilter()), array('label' => 'Reports', 'width' => 400, 'table' => 'section', 'id' => 'sections', 'alias' => 'sections', 'editable' => true, 'edittype' => 'multiselect', 'editvalues' => $userService->getSections()), array('label' => 'Fields', 'width' => 400, 'table' => 'scolumn', 'id' => 'scolumns', 'alias' => 'scolumns', 'editable' => true, 'edittype' => 'multiselect', 'editvalues' => $userService->getSColumns()), array('label' => 'Api Key', 'width' => 300, 'table' => 'api_keys', 'id' => 'key', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true), array('label' => 'Allowed IP Range', 'width' => 300, 'table' => 'user', 'id' => 'allowed_ip_range', 'edittype' => 'text', 'editable' => true)); $this->url = route('user-api'); $this->connectionName = 'ott'; $this->customNavButtons = array('deleteRow', 'exportCsv', 'changePassword', 'createApiKey'); parent::__construct($userService); $this->grid->setSortName('id')->setMultiselect(true)->setSortOrder('DESC')->setInlineNavOptions(['addParams' => ['position' => "last", 'restoreAfterError' => false, 'addRowParams' => ['successfunc' => new Expr(' function(response){ if(response.responseJSON.success){ toastr.success("User updated"); jQuery("' . $this->grid->getGridIdentifier() . '").trigger("reloadGrid"); } else { jQuery.each(jQuery.parseJSON(response.responseJSON.message), function( index, value ) { toastr.error(value); }); return false; } } ')]], 'editParams' => ['restoreAfterError' => false, 'successfunc' => new Expr(' function(response){ if(response.responseJSON.success){ toastr.success("User updated"); jQuery("' . $this->grid->getGridIdentifier() . '").trigger("reloadGrid"); } else { jQuery.each(jQuery.parseJSON(response.responseJSON.message), function( index, value ) { toastr.error(value); }); return false; } } ')]])->setEditUrl($this->url); }