public static function defaultColumns() { return ['subject' => ['attribute' => 'subject', 'format' => 'raw', 'filterInputOptions' => ['style' => 'width:100%', 'class' => 'form-control'], 'value' => function ($model) { $ava = Html::tag('div', Gravatar::widget(['emailHash' => $model->author_email, 'defaultImage' => 'identicon', 'options' => ['alt' => Yii::t('hipanel:ticket', 'Avatar for {login}', ['login' => $model->author]), 'class' => 'img-circle'], 'size' => 40]), ['class' => 'pull-right']); $isClosed = $model->state === Thread::STATE_CLOSE; $titleLink = Html::a($model->subject, $model->threadUrl, ['class' => 'text-bold', 'style' => $isClosed ? 'color: black!important;' : '']) . Topic::widget(['topics' => $model->topics]) . Html::tag('div', sprintf('#%s %s %s', $model->id, Html::tag('span', Yii::t('hipanel:ticket', $model->state_label), ['class' => 'text-bold']), Yii::$app->formatter->asDatetime($model->create_time)), ['class' => 'text-muted']); return $ava . Html::tag('div', $titleLink); }], 'author_id' => ['class' => ClientColumn::class, 'label' => Yii::t('hipanel:ticket', 'Author'), 'idAttribute' => 'author_id', 'sortAttribute' => 'author', 'attribute' => 'author_id', 'value' => function ($model) { return ClientSellerLink::widget(compact('model')); }], 'responsible_id' => ['class' => ClientColumn::class, 'idAttribute' => 'responsible_id', 'sortAttribute' => 'responsible', 'attribute' => 'responsible_id', 'clientType' => ['admin', 'seller', 'manager'], 'value' => function ($model) { return Html::a($model['responsible'], ['/client/client/view', 'id' => $model->responsible_id]); }, 'visible' => Yii::$app->user->can('support')], 'recipient_id' => ['class' => ClientColumn::class, 'idAttribute' => 'recipient_id', 'label' => Yii::t('hipanel:ticket', 'Recipient'), 'sortAttribute' => 'recipient', 'attribute' => 'recipient_id', 'value' => function ($model) { return Html::a($model->recipient, ['/client/client/view', 'id' => $model->recipient_id]); }, 'visible' => Yii::$app->user->can('support')], 'answer_count' => ['attribute' => 'answer_count', 'label' => Yii::t('hipanel:ticket', 'Answers'), 'format' => 'raw', 'filter' => false, 'enableSorting' => false, 'value' => function ($model) { $answerCount = Html::tag('span', $model->answer_count, ['class' => 'label label-default', 'title' => Yii::t('hipanel:ticket', 'Ticket contains {n, plural, one{# answer} other{# answers}}', ['n' => $model->answer_count])]); $lastAnswer = Html::a($model->replier, ['@client/view', 'id' => $model->replier_id], ['class' => '']) . '<br>' . Html::tag('span', Yii::$app->formatter->asRelativeTime($model->reply_time), ['style' => 'font-size: smaller;white-space: nowrap;', 'class' => 'text-muted']) . ' ' . $answerCount; return $lastAnswer; }, 'contentOptions' => ['class' => 'answer']], 'actions' => ['class' => MenuColumn::class, 'menuClass' => TicketActionsMenu::class]]; }
<?php Box::begin(['options' => ['class' => 'box-solid'], 'bodyOptions' => ['class' => 'no-padding']]); ?> <div class="profile-user-img text-center"> <?php echo $this->render('//layouts/gravatar', ['email' => $model->email, 'size' => 120]); ?> </div> <p class="text-center"> <span class="profile-user-role"><?php echo $this->title; ?> </span> <br> <span class="profile-user-name"><?php echo ClientSellerLink::widget(compact('model')); ?> </span> </p> <div class="profile-usermenu"> <?php echo ContactDetailMenu::create(['model' => $model])->render(DetailMenu::class); ?> </div> <?php Box::end(); ?> <?php if (Yii::$app->user->can('manage')) {
<?php use hipanel\modules\ticket\models\Thread; use hipanel\widgets\ClientSellerLink; use hipanel\widgets\Gravatar; use yii\helpers\Html; /* @var \hipanel\modules\client\models\Client $client */ $answerId = 'answer-' . $answer->answer_id; echo Html::beginTag('div', ['class' => $answer->is_answer ? 'comment answer' : 'comment', 'id' => $answerId]); echo Gravatar::widget(['email' => $answer->email_hash, 'options' => ['alt' => $answer->author, 'class' => 'comment-avatar'], 'size' => 32]); echo Html::beginTag('div', ['class' => 'comment-body']); echo Html::beginTag('div', ['class' => 'comment-text']); ?> <div class="comment-heading" xmlns="http://www.w3.org/1999/html"> <?php echo ClientSellerLink::widget(['model' => new \yii\base\DynamicModel(['client_id' => $answer->author_id, 'client' => $answer->author, 'seller_id' => $answer->seller_id, 'seller' => $answer->author_seller]), 'clientAttribute' => 'client', 'clientIdAttribute' => 'client_id', 'sellerAttribute' => 'seller', 'sellerIdAttribute' => 'seller_id']); ?> · <?php echo Html::tag('span', Yii::$app->formatter->asDatetime($answer->create_time)); ?> <?php echo $answer->ip ? " · " . Html::tag('span', 'IP: ' . $answer->ip) : ''; ?> <?php $country_name = Yii::$app->geoip->ip($answer->ip)->country; if ($country_name) { print " · " . Html::tag('span', Yii::t('hipanel:ticket', 'Country') . ': ' . $country_name); } ?> ·
?> <div class="profile-block"> <div class="profile-photo"> <?php if ($client->email) { ?> <?php echo $this->render('//layouts/gravatar', ['email' => $client->email, 'size' => 120, 'alt' => '']); ?> <?php } ?> </div> <div class="profile-user-name"> <?php echo ClientSellerLink::widget(['model' => $client, 'clientAttribute' => 'login', 'clientIdAttribute' => 'id']); ?> </div> <div class="profile-user-role"><?php echo Yii::t('hipanel:client', $client->type); ?> </div> </div> <?php $box->beginFooter(); ?> <div class="table-responsive"> <?php echo ClientGridView::detailView(['model' => $client, 'boxed' => false, 'columns' => $client->login == 'anonym' ? ['name', 'email'] : ['name', 'email', 'country', 'state', 'balance', 'credit', 'servers_spoiler', 'domains_spoiler', 'hosting']]); ?> </div>