| Current Path : /var/www/html/drsa/backend/modules/appVisualization/views/module-app-visualization/ |
| Current File : /var/www/html/drsa/backend/modules/appVisualization/views/module-app-visualization/index.php |
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
$this->title = Yii::t('app', 'Visualization');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="wrapper wrapper-content">
<p><?= Html::a('Add New', ['create'], ['class' => 'btn btn-primary']) ?></p>
<div class="ibox animated">
<div class="mail-box b-r-md">
<?=
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'tableOptions' => ['class' => 'table table-hover table-mail table-custom',],
'layout' => "<div class='gridview-top-wrapper'><div class='row'><div class='col-sm-6'>{summary}</div><div class='col-sm-6'>{pager}</div></div></div>\n{items}\n{pager}",
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'class' => 'yii\grid\ActionColumn',
'header' => 'Action',
'template' => '{update}{delete}',
'headerOptions' => ['style' => 'text-align:center;'],
'contentOptions' => ['style' => 'text-align:center;'],
'buttons' => [
'update' => function ($url, $model, $key) {
return Html::a('<span class="fa fa-pencil"></span> ' . Yii::t('app', 'Edit'), ['update', 'id' => $model->id], ['title' => Yii::t('app', 'Edit Data'), 'class' => 'label label-info label-button']);
},
'delete' => function ($url, $model) {
return '<span class="label label-danger label-button" onclick="deletedata(' . $model->id . ')">
<i class="fa fa-trash"></i> Delete
</span>';
},
],
],
'title',
[
'attribute' => 'category',
'filter' => ArrayHelper::map(
(new \yii\db\Query())->select(['code', 'descr_en'])
->from('ref')
->where(['=', 'cat', 'VISUALIZATION_CATEGORY'])
->orderBy(['sort' => SORT_ASC])
->all(), 'code', 'descr_en'),
'value' => function ($model) {
$ref = (new \yii\db\Query())->select(['descr_en'])
->from('ref')
->where(['=', 'cat', 'VISUALIZATION_CATEGORY'])
->andwhere(['=', 'code', $model->category])
->one();
if (!empty($ref))
return $ref['descr_en'];
}
],
[
'attribute' => 'status',
'filter' => ArrayHelper::map(
(new \yii\db\Query())->select(['code', 'descr'])
->from('ref')
->where(['=', 'cat', 'CONTENT_STATUS'])
->orderBy(['sort' => SORT_ASC])
->all(), 'code', 'descr'),
'value' => function ($model) {
$ref = (new \yii\db\Query())->select(['descr'])
->from('ref')
->where(['=', 'cat', 'CONTENT_STATUS'])
->andwhere(['=', 'code', $model->status])
->one();
if (!empty($ref))
return $ref['descr'];
}
],
[
'attribute' => 'project_type',
'filter' => ArrayHelper::map(
(new \yii\db\Query())->select(['code', 'descr'])
->from('ref')
->where(['=', 'cat', 'PROJECT_TYPE'])
->orderBy(['sort' => SORT_ASC])
->all(), 'code', 'descr'),
'value' => function ($model) {
$ref = (new \yii\db\Query())->select(['descr'])
->from('ref')
->where(['=', 'cat', 'PROJECT_TYPE'])
->andwhere(['=', 'code', $model->project_type])
->one();
if (!empty($ref))
return $ref['descr'];
}
],
'project_dt',
],
]);
?>
</div>
</div>
<div class="version">Version 1.0 (Last update on 21th September 2023)</div>
</div>
<script>
function deletedata(id) {
Swal.fire({
title: 'Are you sure to delete this data?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.value) {
$.ajax({
url: "/admin/appVisualization/module-app-visualization/delete",
method: "POST",
data: {"id": id},
success: function (response) {
if (response === 'success') {
swal.fire({
title: 'Deleted',
icon: 'success',
text: 'Data have been deleted',
}).then(function (result) {
location.reload();
});
}
},
});
}
});
}
</script>