Your IP : 216.73.216.79


Current Path : /var/www/html/digitalnahrimv2/backend/views/audit-trail-entry/
Upload File :
Current File : /var/www/html/digitalnahrimv2/backend/views/audit-trail-entry/view.php

<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\models\AuditTrailEntry */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Audit Trail Entries'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ibox float-e-margins">
    <br>
        <div class="ibox-content">
            <div class="table-responsive">
            <?= DetailView::widget([
                'model' => $model,
                'attributes' => [
                    'id',
                    'model_type',
                    [
                        'attribute' => 'happened_at',
                        'value' => function($model){
                            date_default_timezone_set('asia/Kuala_Lumpur');
                            return date('d M Y H:i:a',$model->happened_at);
                        }
                    ],
                    'foreign_pk',
                    [
                        'attribute'=>'user_id',
                        'value' => $model->user->username
                    ],
                    'type',
                    [
                        'attribute' => 'data',
                        'value' => function($model){
                            $datas = json_decode($model->data);
                            $table = '<table class="table table-striped table-bordered">';
                            $table .= '<thead><tr><th>Field / Column</th><th>Dari</th><th>Kepada</th></tr></thead>';

                            foreach($datas as $data ){

                                $from = $data->from ?? '-';
                                $to = $data->to ?? '-';

                                $table .= '<tr>';
                                    $table .= '<td>'.$data->attr.'</td>';
                                    $table .= '<td>'.$from.'</td>';
                                    $table .= '<td>'.$to.'</td>';
                                $table .= '</tr>';
                            }

                            $table .= '</table>';
                            
                            return $table;
                        },
                        'format' => 'raw'
                    ]
                ],
            ]) ?>
        </div>
    </div>
</div>