fitness-web/backend/views/customer/index.php

59 lines
1.7 KiB
PHP

<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\CustomerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/customer', 'Customers');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="customer-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('common/customer', 'Create Customer'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'customerCardNumber' ,
],
'name',
'email:email',
'phone',
'created_at:datetime',
['class' => 'yii\grid\ActionColumn',
'template' =>'{view} {update} {ticket/index-customer}',
'buttons' => [
'ticket/index-customer' => function ($url) { return Html::a( '<span class="glyphicon glyphicon-list-alt"> </span>', $url, [ 'title' => 'Bérletek' ] ); }
],
'urlCreator' =>function ($action, $model, $key, $index){
$params = is_array($key) ? $key : ['id' => (string) $key];
if ( $action == 'ticket/index-customer' ){
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
$tomorrow = \Yii::$app->formatter->asDate( strtotime( 'tomorrow UTC' ));
$params['TicketSearch[start]'] = $today;
$params['TicketSearch[end]'] = $tomorrow;
}
$params[0] = $action;
return Url::toRoute($params);
}
],
],
]); ?>
</div>