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

71 lines
1.9 KiB
PHP

<?php
use yii\helpers\Html;
use yii\grid\GridView;
use common\components\AccountTotalWidget;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\CollectionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('frontend/collection', 'Vendégek');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'card_number',
'label' => 'Kártyaszám',
],
[
'attribute' => 'customer_name',
'label' => 'Név',
],
[
'attribute' => 'customer_phone',
'label' => 'Tel',
],
[
'attribute' => 'customer_email',
'label' => 'E-mail',
],
// [
// 'attribute' => 'customer.name',
// 'value' => 'customer.name',
// ],
['class' => 'yii\grid\ActionColumn',
'template' => '{ticket} {ticket_history}',
'buttons' => [
'ticket' => function ($url, $model, $key) {
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
'ticket_history' => function ($url, $model, $key) {
return Html::a('Befizetések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
],
'urlCreator' => function ($action, $model, $key, $index){
$url = "";
if ( 'ticket' == $action ){
$url = Url::to(['ticket/create','number' => $model['card_number']]);
}else if ( 'ticket_history' == $action ){
$url = Url::to(['ticket/index','number' => $model['card_number']]);
}
return $url;
}
],
],
]); ?>
</div>