79 lines
2.9 KiB
PHP
79 lines
2.9 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
use common\models\Chat;
|
||
|
|
use yii\helpers\Html;
|
||
|
|
use yii\grid\GridView;
|
||
|
|
use yii\widgets\Pjax;
|
||
|
|
|
||
|
|
/* @var $this yii\web\View */
|
||
|
|
/* @var $searchModel frontend\modules\chat\models\ChatSearch */
|
||
|
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||
|
|
|
||
|
|
$this->title = 'การสอบถามจากแพทย์';
|
||
|
|
$this->params['breadcrumbs'][] = $this->title;
|
||
|
|
?>
|
||
|
|
<div class="chat-index">
|
||
|
|
|
||
|
|
<div class="card">
|
||
|
|
<div class="card-header">
|
||
|
|
<h4 class="card-title"><span data-feather="message-square"></span> <?= Html::encode($this->title) ?></h4>
|
||
|
|
|
||
|
|
<div class="heading-elements">
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="card-body">
|
||
|
|
|
||
|
|
<?php Pjax::begin(); ?>
|
||
|
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||
|
|
|
||
|
|
<div class="table-responsive">
|
||
|
|
<?= GridView::widget([
|
||
|
|
'pager' => ['class' => 'yii\bootstrap5\LinkPager'],
|
||
|
|
'dataProvider' => $dataProvider,
|
||
|
|
'filterModel' => $searchModel,
|
||
|
|
'columns' => [
|
||
|
|
|
||
|
|
['class' => 'yii\grid\SerialColumn'],
|
||
|
|
|
||
|
|
//'id',
|
||
|
|
[
|
||
|
|
'attribute' => 'id_case',
|
||
|
|
'format' => 'raw',
|
||
|
|
'value' => function ($model) {
|
||
|
|
return Html::a($model->id_case, ['chat', 'id_case' => $model->id_case], ['target' => '_blank']);
|
||
|
|
}
|
||
|
|
],
|
||
|
|
'name',
|
||
|
|
[
|
||
|
|
'label' => 'ตอบล่าสุด',
|
||
|
|
'value' => function ($model) {
|
||
|
|
$chat = Chat::find()
|
||
|
|
->joinWith(['createdBy'])
|
||
|
|
->where(['id_case' => $model->id_case])
|
||
|
|
->andFilterWhere(['not like', 'user_table.role', 'pathologist'])
|
||
|
|
->orderBy(['chat.id' => SORT_DESC])
|
||
|
|
->one();
|
||
|
|
return $chat ? $chat->name : '';
|
||
|
|
}
|
||
|
|
],
|
||
|
|
'created_at:datetime',
|
||
|
|
//'updated_at',
|
||
|
|
[
|
||
|
|
'attribute' => 'created_by',
|
||
|
|
'value' => function ($model) {
|
||
|
|
return isset($model->createdBy) ? $model->createdBy->report_name : null;
|
||
|
|
}
|
||
|
|
],
|
||
|
|
//'updated_by',
|
||
|
|
|
||
|
|
//['class' => 'yii\grid\ActionColumn'],
|
||
|
|
],
|
||
|
|
]); ?>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php Pjax::end(); ?>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|