public function actions()
 {
     return ['set-orientation' => ['class' => OrientationAction::class, 'allowedRoutes' => ['@ticket/index']], 'index' => ['class' => IndexAction::class, 'data' => $this->prepareRefs()], 'view' => ['class' => ViewAction::class, 'findOptions' => $this->getSearchOptions(), 'on beforeSave' => function (Event $event) {
         /** @var PrepareBulkAction $action */
         $action = $event->sender;
         $dataProvider = $action->getDataProvider();
         $dataProvider->query->joinWith('answers');
     }, 'data' => function ($action) {
         $client = Client::find()->where(['id' => $action->model->recipient_id, 'with_contact' => 1])->withDomains()->withServers()->one();
         if ($client->login === 'anonym') {
             $client->name = $action->model->anonym_name;
             $client->email = $action->model->anonym_email;
             $client->seller = $action->model->anonym_seller;
         }
         return array_merge(compact('client'), $this->prepareRefs());
     }], 'validate-form' => ['class' => ValidateFormAction::class], 'answer' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:ticket', 'Ticket changed')], 'create' => ['class' => SmartCreateAction::class, 'success' => Yii::t('hipanel:ticket', 'Ticket posted'), 'data' => function () {
         return $this->prepareRefs();
     }], 'delete' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:ticket', 'Ticket deleted')], 'subscribe' => ['class' => SmartPerformAction::class, 'scenario' => 'answer', 'success' => Yii::t('hipanel:ticket', 'Subscribed'), 'on beforeSave' => function (Event $event) {
         /** @var Action $action */
         $action = $event->sender;
         foreach ($action->collection->models as $model) {
             $model->{$this->_subscribeAction[$action->id]} = Yii::$app->user->identity->username;
         }
     }, 'POST pjax' => ['save' => true, 'success' => ['class' => ViewAction::class, 'view' => '_subscribeButton', 'findOptions' => ['with_answers' => 1, 'show_closed' => 1]]]], 'unsubscribe' => ['class' => SmartPerformAction::class, 'scenario' => 'answer', 'success' => Yii::t('hipanel:ticket', 'Unsubscribed'), 'on beforeSave' => function (Event $event) {
         /** @var Action $action */
         $action = $event->sender;
         foreach ($action->collection->models as $model) {
             $model->{$this->_subscribeAction[$action->id]} = Yii::$app->user->identity->username;
         }
     }, 'POST pjax' => ['save' => true, 'success' => ['class' => ViewAction::class, 'view' => '_subscribeButton', 'findOptions' => ['with_answers' => 1, 'show_closed' => 1]]]], 'close' => ['class' => SmartPerformAction::class, 'scenario' => 'close', 'success' => Yii::t('hipanel:ticket', 'Ticket closed'), 'on beforeSave' => function (Event $event) {
         /** @var Action $action */
         $action = $event->sender;
         foreach ($action->collection->models as $model) {
             $model->{'state'} = Thread::STATE_CLOSE;
         }
     }, 'POST pjax' => ['save' => true, 'success' => ['class' => ProxyAction::class, 'action' => 'view', 'params' => function ($action, $model) {
         return ['id' => $model->id];
     }]]], 'open' => ['class' => SmartPerformAction::class, 'scenario' => 'open', 'success' => Yii::t('hipanel:ticket', 'Ticket opened'), 'on beforeSave' => function (Event $event) {
         /** @var Action $action */
         $action = $event->sender;
         foreach ($action->collection->models as $model) {
             $model->{'state'} = Thread::STATE_OPEN;
         }
     }, 'POST pjax' => ['save' => true, 'success' => ['class' => ProxyAction::class, 'action' => 'view', 'params' => function ($action, $model) {
         return ['id' => $model->id];
     }]]], 'update-answer-modal' => ['class' => PrepareAjaxViewAction::class, 'on beforeSave' => function (Event $event) {
         /** @var PrepareBulkAction $action */
         $action = $event->sender;
         $dataProvider = $action->getDataProvider();
         $dataProvider->query->joinWith('answers');
     }, 'data' => function ($action, $data) {
         $answer_id = Yii::$app->request->get('answer_id');
         if (!is_numeric($answer_id)) {
             throw new NotFoundHttpException('Invalid answer_id');
         }
         return ArrayHelper::merge($data, ['answer_id' => $answer_id]);
     }, 'findOptions' => $this->getSearchOptions(), 'scenario' => 'answer-update', 'view' => '_updateAnswerModal']];
 }
 /**
  * @param array $logins all logins used current import session to be pre-fetched
  * @void
  */
 private function resolveClients($logins)
 {
     $clients = Client::find()->where(['login' => $logins])->all();
     $this->clientsMap = array_combine(ArrayHelper::getColumn($clients, 'login'), ArrayHelper::getColumn($clients, 'id'));
 }