Your IP : 216.73.216.79


Current Path : /var/www/html/akept/backend/modules/speaker/views/speaker/
Upload File :
Current File : /var/www/html/akept/backend/modules/speaker/views/speaker/index.php

<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;

$this->title = Yii::t('app', 'Penceramah');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="wrapper wrapper-content">
    <p><?= Html::a('Tambah Baru', ['create'], ['class' => 'btn btn-primary']) ?></p>
    <div class="ibox animated fadeInRightx">
        <div class="mail-box b-r-md">
            <?=
            GridView::widget([
                'summary' => "Paparan <b>{begin} - {end}</b> daripada <b>{totalCount}</b> rekod.",
                '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' => 'Tindakan',
                        'template' => '{update}{delete}',
                        'headerOptions' => ['style' => 'text-align:center;width:1%;'],
                        'contentOptions' => ['style' => 'text-align:center;'],
                        'buttons' => [
                            'update' => function ($url, $model, $key) {
                                return Html::a('<span class="fa fa-pencil"></span> Kemaskini', ['update', 'id' => $model->speaker_id], ['class' => 'label label-info label-button']);
                            },
                            'delete' => function ($url, $model) {
                                return '<span class="label label-danger label-button" onclick="deletedata(\'' . $model->speaker_id . '\')">
                                    <i class="fa fa-trash"></i> Hapus
                                </span>';
                            },
                        ],
                    ],
                    'speaker_name',
                    'speaker_institution',
                    'speaker_event_title',
                    'speaker_year',
                ],
            ]);
            ?>
        </div>
    </div>
</div>
<script>
    function deletedata(id) {
        Swal.fire({
            title: 'Anda pasti untuk hapuskan data ini?',
            text: "Data tidak boleh dikembalikan!",
            icon: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'Ya, teruskan!',
            cancelButtonText: 'Batal',
        }).then((result) => {
            if (result.value) {
                $.ajax({
                    url: "delete",
                    method: "POST",
                    data: {"id": id},
                    success: function (response) {
                        if (response === 'success') {
                            swal.fire({
                                title: 'Berjaya',
                                icon: 'success',
                                text: 'Data telah dihapuskan',
                            }).then(function (result) {
                                location.reload();
                            });
                        }
                    },
                });
            }
        });
    }
</script>