fitness-web/frontend/views/inventory/index.php

51 lines
1.4 KiB
PHP

<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\InventorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/inventory', 'Leltár lista');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="inventory-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('common/inventory', 'Új leltár'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id_inventory',
'name',
[ 'attribute' => 'id_user', "value" =>"userName" ],
'created_at:datetime',
['class' => 'yii\grid\ActionColumn',
'template' => '{view}',
'urlCreator' => function( $action, $model, $key, $index ){
if ( $action == 'view' ){
return Url::to(['inventory-item/index' , 'id'=> $model->id_inventory]);
}
},
'buttons' =>[
'view' =>function ($url, $model, $key) {
return Html::a('Részletek', $url,['class' => 'btn btn-xs btn-primary',
]) ;
}
]
],
],
]); ?>
</div>