170 lines
6.4 KiB
PHP
170 lines
6.4 KiB
PHP
<?php
|
|
|
|
use yii\helpers\Html;
|
|
use yii\widgets\DetailView;
|
|
|
|
/* @var $this yii\web\View */
|
|
/* @var $model common\models\Event */
|
|
|
|
$this->title = $model->trainer->name . "/" . $model->eventType->name . "/" . $model->room->name;
|
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
|
|
$this->params['breadcrumbs'][] = $this->title;
|
|
?>
|
|
<div class="event-view">
|
|
|
|
<h1><?= Html::encode($this->title) ?></h1>
|
|
|
|
<p>
|
|
<?= Html::a(Yii::t('event', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
|
<?= Html::a(Yii::t('event', 'Register'), ['register-card', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
|
<?= Html::a(Yii::t('event', 'Delete'), ['delete', 'id' => $model->id], [
|
|
'class' => 'btn btn-danger pull-right',
|
|
'data' => [
|
|
'confirm' => Yii::t('event', 'Are you sure you want to delete this item?'),
|
|
'method' => 'post',
|
|
],
|
|
]) ?>
|
|
</p>
|
|
|
|
<div class="row">
|
|
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
|
<?php try {
|
|
echo DetailView::widget([
|
|
'model' => $model,
|
|
'attributes' => [
|
|
'id',
|
|
'start:datetime',
|
|
'end:datetime',
|
|
[
|
|
'attribute' => 'room.name',
|
|
'label' => $model->getAttributeLabel('id_room')
|
|
],
|
|
[
|
|
'attribute' => 'trainer.name',
|
|
'label' => $model->getAttributeLabel('id_trainer')
|
|
],
|
|
],
|
|
]);
|
|
} catch (Exception $e) {
|
|
echo "failed to render event details ";
|
|
} ?>
|
|
</div>
|
|
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
|
<?php try {
|
|
echo DetailView::widget([
|
|
'model' => $model,
|
|
'attributes' => [
|
|
[
|
|
'attribute' => 'eventType.name',
|
|
'label' => $model->getAttributeLabel('id_event_type')
|
|
],
|
|
'seat_count',
|
|
'created_at:datetime',
|
|
'updated_at:datetime',
|
|
],
|
|
]);
|
|
} catch (Exception $e) {
|
|
echo "Failed to render view";
|
|
} ?>
|
|
</div>
|
|
</div>
|
|
<h2>Regisztrációk</h2>
|
|
|
|
<?php try {
|
|
echo \yii\grid\GridView::widget([
|
|
'dataProvider' => $dataProvider,
|
|
'columns' => [
|
|
[
|
|
'attribute' => 'card_number',
|
|
'label' => \Yii::t('event', 'Card Number'),
|
|
'contentOptions' => function ($model ) {
|
|
$options = [];
|
|
|
|
if (isset($model['event_registration_canceled_at'])) {
|
|
$options['style'] = 'text-decoration: line-through;';
|
|
}
|
|
|
|
return $options;
|
|
}
|
|
],
|
|
[
|
|
'attribute' => 'customer_name',
|
|
'label' => \Yii::t('event', 'Customer Name'),
|
|
'contentOptions' => function ($model ) {
|
|
$options = [];
|
|
|
|
if (isset($model['event_registration_canceled_at'])) {
|
|
$options['style'] = 'text-decoration: line-through;';
|
|
}
|
|
|
|
return $options;
|
|
}
|
|
],
|
|
[
|
|
'attribute' => 'customer_email',
|
|
'label' => \Yii::t('event', 'Customer Email'),
|
|
'contentOptions' => function ($model ) {
|
|
$options = [];
|
|
|
|
if (isset($model['event_registration_canceled_at'])) {
|
|
$options['style'] = 'text-decoration: line-through;';
|
|
}
|
|
|
|
return $options;
|
|
}
|
|
],
|
|
[
|
|
'attribute' => 'event_registration_created_at',
|
|
'label' => \Yii::t('event', 'Event Registration Created At'),
|
|
'contentOptions' => function ($model) {
|
|
$options = [];
|
|
|
|
if (isset($model['event_registration_canceled_at'])) {
|
|
$options['style'] = 'text-decoration: line-through;';
|
|
}
|
|
|
|
return $options;
|
|
}
|
|
],
|
|
[
|
|
'attribute' => 'event_registration_canceled_at',
|
|
'label' => \Yii::t('event', 'Canceled At'),
|
|
'contentOptions' => function () {
|
|
$options = [];
|
|
return $options;
|
|
}
|
|
],
|
|
[
|
|
'class' => 'yii\grid\ActionColumn',
|
|
'template' => '{cancel-registration}',
|
|
'urlCreator' => function ($action, $model) {
|
|
$params = ['id' => $model['event_registration_id']];
|
|
$params[0] = "event" . '/' . $action;
|
|
return \yii\helpers\Url::toRoute($params);
|
|
},
|
|
'buttons' => [
|
|
'cancel-registration' => function ($url, $model) {
|
|
if (isset($model['event_registration_canceled_at'])) {
|
|
return "";
|
|
}
|
|
$options = [
|
|
'title' => Yii::t('yii', 'Delete'),
|
|
'aria-label' => Yii::t('yii', 'Delete'),
|
|
'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
|
|
'data-method' => 'post',
|
|
'data-pjax' => '0',
|
|
];
|
|
return Html::a('<span class="glyphicon glyphicon-ban-circle"></span>', $url, $options);
|
|
},
|
|
]
|
|
|
|
],
|
|
]
|
|
]);
|
|
} catch (Exception $e) {
|
|
echo "Failed to render registrations";
|
|
}
|
|
?>
|
|
|
|
</div>
|