surat/frontend/modules/administrator/views/case-pap/index.php

127 lines
6.3 KiB
PHP
Raw Normal View History

2024-12-25 03:04:59 +00:00
<?php
use common\models\CasePap;
use common\models\ConstStatus;
use common\models\User;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\MaskedInput;
/* @var $this yii\web\View */
/* @var $searchModel frontend\modules\administrator\models\CasePapGynSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'จัดการ Case Pap';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="card shadow">
<div class="card-header">
<h5 class="card-title"><i class="ri-delete-bin-7-line"></i> <?= Html::encode($this->title) ?></h5>
</div>
<?php // echo $this->render('_search', ['model' => $searchModel]);
?>
<div class="card-body">
<div class="table-responsive">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'tableOptions' => ['class' => 'table align-middle table-hover m-0 truncate'],
2026-02-16 07:32:27 +00:00
'layout' => "{summary}<div class='table-outer'><div class='table-responsive'>\n{items}\n</div></div><div class='d-flex justify-content-between align-items-center mt-4'>{pager}</div>",
2024-12-25 03:04:59 +00:00
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
2026-02-16 07:32:27 +00:00
'class' => 'yii\grid\ActionColumn',
'headerOptions' => ['class' => 'custom-action-column-header'],
'contentOptions' => ['class' => 'custom-action-column'],
'template' => '{update} {delete}', // Customize buttons if needed
'buttons' => [
'update' => function ($url, $model, $key) {
return Html::a('<i class="ri-edit-box-line"></i> แก้ไขสถานะ', $url, [
'title' => Yii::t('app', 'Update'),
'class' => 'btn btn-info btn-sm'
]);
},
'delete' => function ($url, $model, $key) {
return Html::a('<i class="ri-delete-bin-line"></i> ลบ Case', $url, [
'title' => Yii::t('app', 'Delete'),
'data-confirm' => Yii::t('app', 'คุณแน่ใจว่าต้องการลบรายการนี้หรือไม่ ?'),
'data-method' => 'post',
'class' => 'btn btn-danger btn-sm'
]);
},
],
2024-12-25 03:04:59 +00:00
],
[
'attribute' => 'id_case',
'format' => 'raw',
'value' => function ($model) {
return '<strong>' . $model->id_case . '</strong> ' . Yii::$app->pathology->getCaseDate($model->id_case) . Yii::$app->pathology->getExpress($model);
}
],
2026-02-16 07:32:27 +00:00
'his_ln',
2024-12-25 03:04:59 +00:00
[
'attribute' => 'patient_name',
'label' => 'ชื่อ - นามสกุล',
'value' => function ($model) {
$case = CasePap::findOne(['id_case' => $model->id_case]);
return isset($case) ? $case->getFullname() : '';
}
],
2026-02-16 07:32:27 +00:00
'h_n',
2024-12-25 03:04:59 +00:00
[
2026-02-16 07:32:27 +00:00
'attribute' => 'status_id',
'filter' => ArrayHelper::map(ConstStatus::find()->all(), 'id', 'status'),
'format' => 'raw',
2024-12-25 03:04:59 +00:00
'value' => function ($model) {
2026-02-16 07:32:27 +00:00
return Yii::$app->pathology->getStatus($model->status_id);
2024-12-25 03:04:59 +00:00
}
],
[
'attribute' => 'hospital_id',
'value' => function ($model) {
return isset($model->hospital) ? $model->hospital->name : '';
}
],
[
2026-02-16 07:32:27 +00:00
'attribute' => 'register_at',
'filter' => MaskedInput::widget([
'model' => $searchModel,
'attribute' => 'register_at',
'mask' => '99/99/9999'
]),
2024-12-25 03:04:59 +00:00
'value' => function ($model) {
2026-02-16 07:32:27 +00:00
return $model->register_at;
2024-12-25 03:04:59 +00:00
}
],
2026-02-16 07:32:27 +00:00
/*[
2024-12-25 03:04:59 +00:00
'label' => 'พยาธิแพทย์',
'attribute' => 'pathologist_id',
'filter' => ArrayHelper::map(User::find()->orderBy(['realname' => SORT_ASC])
->where(['like', 'role', 'pathologist'])->all(), 'id', 'realname'),
'value' => function ($model) {
return isset($model->pathologist_id) > 1 ? $model->pathologist->realname : '';
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{delete}',
'visibleButtons' => [
'delete' => function ($model) {
2025-10-24 09:23:53 +00:00
return $model->status_id < 18 ? true : false; //กด approved มาแล้ว แต่ยังไม่ release
2024-12-25 03:04:59 +00:00
}
],
'buttons' => [
'delete' => function ($url, $model, $key) {
return Html::a('<i class="ri-delete-bin-7-line"></i> Delete Case', ['delete', 'id' => $model->id], ['data' => ['method' => 'post', 'confirm' => 'แน่ใจนะว่าต้องการลบข้อมูลนี้ จะไม่สามารถนำข้อมูลกลับคืนได้'], 'class' => 'btn btn-danger btn-sm']);
}
]
2026-02-16 07:32:27 +00:00
],*/
2024-12-25 03:04:59 +00:00
],
]); ?>
</div>
</div>
</div>