<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\Key;
use backend\components\AdminCustomerTabWidget;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\KeySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('backend/key', 'Keys');
$this->params['breadcrumbs'][] = "Vendég";
$this->params['breadcrumbs'][] = "Kulcsok";
?>

<?php echo AdminCustomerTabWidget::widget(['customer' => $searchModel->customer]) ?>

<div class="key-index">	


    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        //'filterModel' => $searchModel, // ezt nem szeretjük
        'columns' => [
           // ['class' => 'yii\grid\SerialColumn'],
           // 'id_key',
           [
           		'attribute' => 'number',
           		'label' => "Kulcs szám",
        	],
           [
           		'attribute' => 'rfid_key',
           		'label' => "RFID kód",
        	],
            [
				  'attribute' => 'status',
				  'value' => function ($model, $key, $index, $column){
					$statuszok = Key::statuses();
					$result = $statuszok[$model['status']];
					return $result;
				}
			  ],
			  [
			  'attribute' => 'assigned_at',
			  'label' => "Kiadva",
			  'format' =>'datetime'
			  ],

        ],
    ]); ?>

</div>
