public function __construct(UserService $userService)
 {
     $this->columnModel = array(array('label' => 'ID', 'width' => 100, 'table' => 'platform', 'id' => 'id', 'queryParamField' => true), array('label' => 'Name', 'width' => 250, 'table' => 'platform', 'id' => 'platform_name', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true), array('label' => 'Api URL', 'width' => 250, 'table' => 'platform', 'id' => 'api_url', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true), array('label' => 'Api Username', 'width' => 250, 'table' => "platform", 'id' => 'api_username', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true), array('label' => 'Api Password', 'width' => 250, 'table' => 'platform', 'id' => 'api_password', 'edittype' => 'text', 'editable' => true, 'queryParamField' => true));
     $this->url = route('platform-api');
     $this->connectionName = 'ott';
     $this->customNavButtons = array('deleteRow', 'exportCsv', 'changePassword');
     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("Platform 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("Platform 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);
 }
 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);
 }
 public function __construct(UserService $userService)
 {
     $this->columnModel = array(array('label' => 'Country', 'width' => 200, 'table' => 'country', 'alias' => 'country', 'id' => 'name', 'defaultValue' => null, 'searchType' => 'select', 'svalues' => $userService->getCountryListForSelectFilter()), array('label' => 'Leads', 'width' => 200, 'table' => 'clients', 'type' => 'raw', 'alias' => 'leads', 'rawValue' => 'COUNT(clients.id)', 'id' => 'lead'), array('label' => 'Customers', 'width' => 200, 'table' => 'clients', 'type' => 'raw', 'alias' => 'customers', 'rawValue' => 'COUNT(clients.id) - SUM(clients.islead)', 'id' => 'customers'), array('label' => 'Deposits Count', 'width' => 200, 'table' => 'deposits', 'type' => 'raw', 'alias' => 'dcount', 'rawValue' => 'COALESCE(deposits.dcount, 0)', 'id' => 'dcount'), array('label' => 'Deposits Amount', 'width' => 200, 'table' => 'deposits', 'type' => 'raw', 'alias' => 'damount', 'rawValue' => 'COALESCE(deposits.damount, 0)', 'id' => 'damount'), array('label' => 'FTD', 'width' => 200, 'table' => 'deposits', 'type' => 'raw', 'alias' => 'FTD', 'rawValue' => 'COALESCE(deposits.FTD, 0)', 'id' => 'FTD'));
     $this->rawQueryParamFields = array(array('field' => 'campaigns', 'type' => 'multiselect', 'sort' => false, 'queryOp' => 'inclusive', 'dbField' => 'customers.campaignId'), array('field' => 'country', 'type' => 'multiselect', 'sort' => true, 'queryOp' => 'inclusive', 'dbField' => 'customers.Country'), array('field' => 'dateRange', 'type' => 'dateRange', 'defaultValue' => Json::encode(array('start' => date(Config::get('app.dateformat')), 'end' => date(Config::get('app.dateformat')))), 'sort' => false));
     $this->url = route('country-api');
     $this->connectionName = 'so_rep';
     $this->sortname = 'damount';
     $this->postDataFields = array('campaigns' => new Expr("jQuery('#'+'%field%').val();"), 'dateRange' => new Expr("JSON.stringify(\$('#'+'%field%').daterangepicker('getRange'));"));
     $this->customNavButtons = array('exportCsv');
     parent::__construct($userService);
 }
 public function __construct(UserService $userService, CampaignService $campaignService)
 {
     $this->columnModel = array(array('label' => 'Campaigns', 'width' => 300, 'table' => 'campaign', 'id' => 'name', 'alias' => 'campaigns', 'searchType' => 'select', 'svalues' => $userService->getCampaignListForSelectFilter()), array('label' => 'Country', 'width' => 300, 'table' => 'campaign_country', 'id' => 'id', 'alias' => 'country', 'searchType' => 'select', 'svalues' => $userService->getCountryListForMultiSelectFilter(), 'editable' => true, 'edittype' => 'multiselect', 'editvalues' => $userService->getCountryIdsForSelectFilter()), array('label' => 'Platform', 'width' => 300, 'table' => 'campaign_platform', 'alias' => 'platforms', 'id' => 'platform_id', 'searchType' => 'select', 'svalues' => $userService->getPlatformListForSelectFilter(), 'editable' => true, 'edittype' => 'multifind', 'editvalues' => $userService->getPlatformIdsForSelectFilter(), 'multiple' => false, 'type' => 'select'));
     $this->rawQueryParamFields = array(array('field' => 'campaigns', 'type' => 'multiselect', 'sort' => false, 'queryOp' => 'inclusive', 'dbField' => 'campaign.id'), array('field' => 'country', 'type' => 'multiselect', 'sort' => false, 'queryOp' => 'inclusive', 'dbField' => 'campaign_country.country_id'), array('field' => 'platforms', 'type' => 'multiselect', 'sort' => false, 'queryOp' => 'inclusive', 'dbField' => 'campaign_platform.platform_id'));
     $this->url = route('campaign-api');
     $this->connectionName = 'ott';
     $this->customNavButtons = array('exportCsv');
     parent::__construct($userService);
     $this->grid->setSortName('id')->setMultiselect(true)->setSortOrder('ASC')->setInlineNavOptions(['editParams' => ['restoreAfterError' => false, 'successfunc' => new Expr('
                     function(response){
                         if(response.responseJSON.success){
                             toastr.success("Campaign 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);
 }