mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
144
modules/admin/views/tickets/index.php
Normal file
144
modules/admin/views/tickets/index.php
Normal file
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $tickets \yii\data\ActiveDataProvider */
|
||||
/* @var $ticketsNotRead \yii\data\ActiveDataProvider */
|
||||
|
||||
use yii\grid\ActionColumn;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use \app\models\Ticket;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
|
||||
$this->title = 'Список запросов';
|
||||
|
||||
echo \yii\grid\GridView::widget([
|
||||
"dataProvider" => $ticketsNotRead,
|
||||
"tableOptions" => [
|
||||
"class" => "tickets"
|
||||
],
|
||||
"rowOptions" => function ($model, $key, $index, $grid) {
|
||||
return ["onclick" => "location.href='".Url::toRoute(["tickets/view", "id" => $model->id])."'", "class" => "ticketRow"];
|
||||
},
|
||||
"caption" => "Открытые тикеты без ответа администратора",
|
||||
"layout" => "{items}\n{summary}\n{pager}",
|
||||
"columns" => [
|
||||
"id",
|
||||
"tm_create",
|
||||
[
|
||||
'attribute' => 'user_id',
|
||||
'content' => function(Ticket $model) {
|
||||
$email = ArrayHelper::getValue($model, 'user.email');
|
||||
return $email?$email:"iOS пользователь";
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'subject_id',
|
||||
'content' => function(Ticket $model) {
|
||||
return ArrayHelper::getValue(Ticket::SUBJECTS, $model->subject_id, '-');
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'subject',
|
||||
'content' => function(Ticket $model) {
|
||||
return $model->subject;
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'content' => function(Ticket $model) {
|
||||
return ArrayHelper::getValue(Ticket::STATUSES, $model->status);
|
||||
}
|
||||
],
|
||||
[
|
||||
'class' => ActionColumn::className(),
|
||||
'template' => '{close} {reopen} {delete}',
|
||||
'buttons' => [
|
||||
'close' => function ($url, $model, $key) {
|
||||
return $model->status!=4?Html::a("Закрыть", $url, [
|
||||
"class" => "btn btn-xs btn-warning",
|
||||
"onclick" => "event.stopPropagation();"
|
||||
]):'';
|
||||
},
|
||||
'reopen' => function ($url, $model, $key) {
|
||||
return $model->status==4?Html::a("Переоткрыть", $url, [
|
||||
"class" => "btn btn-xs btn-warning",
|
||||
"onclick" => "event.stopPropagation();"
|
||||
]):'';
|
||||
},
|
||||
'delete' => function ($url, $model, $key) {
|
||||
return Html::a("Удалить", $url, [
|
||||
"class" => "btn btn-xs btn-danger",
|
||||
"onclick" => "event.stopPropagation();"
|
||||
]);
|
||||
}
|
||||
]
|
||||
],
|
||||
]
|
||||
]);?>
|
||||
<br><br>
|
||||
<?php echo \yii\grid\GridView::widget([
|
||||
"dataProvider" => $tickets,
|
||||
"tableOptions" => [
|
||||
"class" => "tickets"
|
||||
],
|
||||
"rowOptions" => function ($model, $key, $index, $grid) {
|
||||
return ["onclick" => "location.href='".Url::toRoute(["tickets/view", "id" => $model->id])."'", "class" => "ticketRow"];
|
||||
},
|
||||
"caption" => "Все остальные тикеты",
|
||||
"layout" => "{items}\n{summary}\n{pager}",
|
||||
"columns" => [
|
||||
"id",
|
||||
"tm_create",
|
||||
[
|
||||
'attribute' => 'user_id',
|
||||
'content' => function(Ticket $model) {
|
||||
$email = ArrayHelper::getValue($model, 'user.email');
|
||||
return $email?$email:"iOS пользователь";
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'subject_id',
|
||||
'content' => function(Ticket $model) {
|
||||
return ArrayHelper::getValue(Ticket::SUBJECTS, $model->subject_id, "-");
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'subject',
|
||||
'content' => function(Ticket $model) {
|
||||
return $model->subject;
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'content' => function(Ticket $model) {
|
||||
return ArrayHelper::getValue(Ticket::STATUSES, $model->status);
|
||||
}
|
||||
],
|
||||
[
|
||||
'class' => ActionColumn::className(),
|
||||
'template' => '{close} {reopen} {delete}',
|
||||
'buttons' => [
|
||||
'close' => function ($url, $model, $key) {
|
||||
return $model->status!=4?Html::a("Закрыть", $url, [
|
||||
"class" => "btn btn-xs btn-warning",
|
||||
"onclick" => "event.stopPropagation();"
|
||||
]):'';
|
||||
},
|
||||
'reopen' => function ($url, $model, $key) {
|
||||
return $model->status==4?Html::a("Переоткрыть", $url, [
|
||||
"class" => "btn btn-xs btn-warning",
|
||||
"onclick" => "event.stopPropagation();"
|
||||
]):'';
|
||||
},
|
||||
'delete' => function ($url, $model, $key) {
|
||||
return Html::a("Удалить", $url, [
|
||||
"class" => "btn btn-xs btn-danger",
|
||||
"onclick" => "event.stopPropagation();"
|
||||
]);
|
||||
}
|
||||
]
|
||||
],
|
||||
]
|
||||
]);
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue