group training changes

This commit is contained in:
Roland Schneider
2020-10-24 16:08:33 +02:00
parent 43618764a4
commit a7147df522
27 changed files with 849 additions and 52 deletions

View File

@@ -0,0 +1,84 @@
<?php /** @noinspection PhpUnhandledExceptionInspection */
use common\modules\event\models\EventEquipmentTypeForm;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\widgets\DetailView;
/* @var $model EventEquipmentTypeForm */
?>
<h1>Szükséges felszerelés hozzáadása eseményhez</h1>
<div class="panel panel-default">
<div class="panel-heading">Esemény</div>
<div class="panel-body">
<?php try {
echo DetailView::widget([
'model' => $model->event,
'attributes' => [
'id',
'start:datetime',
[
'attribute' => 'eventType.name',
'label' => 'Típus'
],
[
'attribute' => 'trainer.name',
'label' => 'Edző'
]
],
]);
} catch (Exception $e) {
echo "failed to render event details ";
}
echo Html::a(Yii::t('event', 'Vissza az eseményhez'), ['view', 'id' => $model->event->id], ['class' => 'btn btn-primary']);
?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Felszerelés hozzáadása/módosítása</div>
<div class="panel-body">
<?php $form = ActiveForm::begin([]); ?>
<?= $form->field($model, 'idEvent')->hiddenInput()->label(false) ?>
<div class="form-group">
<?= $form->field($model, 'idEquipmentType')->dropDownList(ArrayHelper::map($model->equipmentTypeList, 'id', 'name'))->label("Felszerelés") ?>
</div>
<div class="form-group">
<?= $form->field($model, 'count')->textInput()->label("Mennyiség") ?>
</div>
<?= Html::submitButton( 'Hozzáad/Módosít', ['class' => 'btn btn-success' ]) ?>
<?php ActiveForm::end(); ?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Szükséges felszerelés</div>
<div class="panel-body">
<?php
echo GridView::widget([
'dataProvider' => $model->assignedEquipmentTypes,
'columns' => [
[
'label' => "Felszerelés",
'value' => function ($data) {
return $data->eventEquipmentType->name;
},
],
[
'label' => "Rendelkezésre álló mennyiség",
'value' => function ($data) {
return $data->count;
},
],
],
]);
?>
</div>
</div>

View File

@@ -0,0 +1,6 @@
<?php
use common\modules\event\models\EventEquipmentTypeForm;
/* @var $formModel EventEquipmentTypeForm */
echo $this->render('_equipment-types-assignment_form', ['model' => $formModel]);

View File

@@ -16,6 +16,7 @@ if ( $permissions->allowCreate ){
$indexTableTemplateButtons[] = '{update}';
}
$indexTableTemplateButtons[] = '{reserve-card}';
$indexTableTemplateButtons[] = '{equipment-types-assignment}';
?>
@@ -108,7 +109,7 @@ $indexTableTemplateButtons[] = '{reserve-card}';
],
[
'class' => 'yii\grid\ActionColumn',
'template' => join("",$indexTableTemplateButtons),
'template' => join(" ",$indexTableTemplateButtons),
'urlCreator' => function ($action, $model, $key, $index) {
$params = ['id' => $model['event_id']];
$params[0] = "event" . '/' . $action;
@@ -148,6 +149,14 @@ $indexTableTemplateButtons[] = '{reserve-card}';
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-user"></span>', $url, $options);
},
'equipment-types-assignment' => function ($url, $model, $key) {
$options = [
'title' => Yii::t('yii', 'Equipment Types'),
'aria-label' => Yii::t('yii', 'Equipment Types'),
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-wrench"></span>', $url, $options);
}
]

View File

@@ -5,7 +5,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
$this->title = Yii::t('event', 'Update Event:') . ' ' . $model->id;
$this->title = Yii::t('event', 'Update Event:') . ' #' . $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('event', 'Update');

View File

@@ -1,5 +1,6 @@
<?php
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView;
@@ -42,8 +43,11 @@ function getCommonColumnsHtmlOptions($model)
<?php
if ($permissions->allowEdit) {
echo Html::a(Yii::t('event', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
echo "&nbsp";
echo Html::a("Felszerelés", ['equipment-types-assignment', 'id' => $model->id], ['class' => 'btn btn-primary']);
}
if ($model->canReserve()) {
echo "&nbsp";
echo Html::a(Yii::t('event', 'Reservation'), ['reserve-card', 'id' => $model->id], ['class' => 'btn btn-primary']);
}
?>
@@ -65,13 +69,38 @@ function getCommonColumnsHtmlOptions($model)
<?php echo $this->render('_view', ['model' => $model]); ?>
<div class="panel panel-default">
<div class="panel-heading">Szükséges felszerelés</div>
<div class="panel-body">
<?php
echo GridView::widget([
'dataProvider' => $equipmentAssignmentDataProvider,
'columns' => [
[
'label' => "Felszerelés",
'value' => function ($data) {
return $data->eventEquipmentType->name;
},
],
[
'label' => "Rendelkezésre álló mennyiség",
'value' => function ($data) {
return $data->count;
},
],
],
]);
?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Foglalások</h3>
</div>
<div class="panel-body">
<?php try {
echo \yii\grid\GridView::widget([
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[