group training changes
This commit is contained in:
parent
43618764a4
commit
a7147df522
@ -166,6 +166,7 @@ class AdminMenuStructure{
|
|||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
if ( Yii::$app->user ){
|
if ( Yii::$app->user ){
|
||||||
$items = [];
|
$items = [];
|
||||||
|
$items[] = ['label' => 'Felszerelés', 'url' => ['/event-equipment-type' ] ];
|
||||||
$items[] = ['label' => 'Edzők', 'url' => ['/trainer' ] ];
|
$items[] = ['label' => 'Edzők', 'url' => ['/trainer' ] ];
|
||||||
$items[] = ['label' => 'Termek', 'url' => ['/room' ] ];
|
$items[] = ['label' => 'Termek', 'url' => ['/room' ] ];
|
||||||
$items[] = ['label' => 'Esemény típusok', 'url' => ['/event-type' ] ];
|
$items[] = ['label' => 'Esemény típusok', 'url' => ['/event-type' ] ];
|
||||||
|
|||||||
109
backend/controllers/EventEquipmentTypeController.php
Normal file
109
backend/controllers/EventEquipmentTypeController.php
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use common\models\EventEquipmentType;
|
||||||
|
use backend\models\EventEquipmentTypeSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventEquipmentTypeController implements the CRUD actions for EventEquipmentType model.
|
||||||
|
*/
|
||||||
|
class EventEquipmentTypeController extends Controller
|
||||||
|
{
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['post'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all EventEquipmentType models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new EventEquipmentTypeSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single EventEquipmentType model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new EventEquipmentType model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new EventEquipmentType();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing EventEquipmentType model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the EventEquipmentType model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return EventEquipmentType the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = EventEquipmentType::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
backend/models/EventEquipmentTypeSearch.php
Normal file
67
backend/models/EventEquipmentTypeSearch.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\EventEquipmentType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventEquipmentTypeSearch represents the model behind the search form about `common\models\EventEquipmentType`.
|
||||||
|
*/
|
||||||
|
class EventEquipmentTypeSearch extends EventEquipmentType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['name'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = EventEquipmentType::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'name', $this->name]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
backend/views/event-equipment-type/_form.php
Normal file
23
backend/views/event-equipment-type/_form.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventEquipmentType */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-equipment-type-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/event-equipment-type', 'Create') : Yii::t('common/event-equipment-type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
26
backend/views/event-equipment-type/_search.php
Normal file
26
backend/views/event-equipment-type/_search.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\EventEquipmentTypeSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-equipment-type-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'name') ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('common/event-equipment-type', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/event-equipment-type/create.php
Normal file
21
backend/views/event-equipment-type/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventEquipmentType */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/event-equipment-type', 'Create Event Equipment Type');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/event-equipment-type', 'Event Equipment Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-equipment-type-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
34
backend/views/event-equipment-type/index.php
Normal file
34
backend/views/event-equipment-type/index.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\EventEquipmentTypeSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/event-equipment-type', 'Event Equipment Types');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-equipment-type-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('common/event-equipment-type', 'Create Event Equipment Type'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view} {update}'
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
23
backend/views/event-equipment-type/update.php
Normal file
23
backend/views/event-equipment-type/update.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventEquipmentType */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/event-equipment-type', 'Update {modelClass}: ', [
|
||||||
|
'modelClass' => 'Event Equipment Type',
|
||||||
|
]) . ' #' . $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/event-equipment-type', 'Event Equipment Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('common/event-equipment-type', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="event-equipment-type-update">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
31
backend/views/event-equipment-type/view.php
Normal file
31
backend/views/event-equipment-type/view.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventEquipmentType */
|
||||||
|
|
||||||
|
$this->title = $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/event-equipment-type', 'Event Equipment Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-equipment-type-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('common/event-equipment-type', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -11,7 +11,6 @@ $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id'
|
|||||||
$this->params['breadcrumbs'][] = Yii::t('event', 'Update');
|
$this->params['breadcrumbs'][] = Yii::t('event', 'Update');
|
||||||
?>
|
?>
|
||||||
<div class="event-update">
|
<div class="event-update">
|
||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
<?= $this->render('_form', [
|
<?= $this->render('_form', [
|
||||||
|
|||||||
14
common/messages/hu/common/event-equipment-type.php
Normal file
14
common/messages/hu/common/event-equipment-type.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
"Name" => "Megnevezés",
|
||||||
|
"Search" => "Keresés",
|
||||||
|
"Create" => "Mentés",
|
||||||
|
"Update" => "Módosít",
|
||||||
|
"Delete" => "Törlés",
|
||||||
|
"Created At" => "Létrehozás dátum, idő",
|
||||||
|
"Updated At" => "Módosítás dátum, idő",
|
||||||
|
"Event Equipment Types" => "Felszerelések",
|
||||||
|
"Create Event Equipment Type" => "Új felszerelés létrehozása",
|
||||||
|
"Update {modelClass}: " => "Felszerelés módosítása: ",
|
||||||
|
];
|
||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
|
use customerapi\models\details\EventEquipmentTypeAssignmentView;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeZone;
|
use DateTimeZone;
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -147,6 +148,14 @@ class Event extends ActiveRecord
|
|||||||
return $this->hasMany(EventRegistration::class,['id_event' => 'id']);
|
return $this->hasMany(EventRegistration::class,['id_event' => 'id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return EventEquipmentTypeAssignment[]|ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getEquipmentTypeAssignments(){
|
||||||
|
return $this->hasMany($this->getEquipmentTypeAssignmentsClass(),['id_event' => 'id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return EventRegistration[]|ActiveQuery
|
* @return EventRegistration[]|ActiveQuery
|
||||||
@ -167,6 +176,11 @@ class Event extends ActiveRecord
|
|||||||
return count($this->getActiveEventRegistrations()->all());
|
return count($this->getActiveEventRegistrations()->all());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getEquipmentTypeAssignmentsClass()
|
||||||
|
{
|
||||||
|
return EventEquipmentTypeAssignment::class;
|
||||||
|
}
|
||||||
|
|
||||||
/** @noinspection PhpUnused */
|
/** @noinspection PhpUnused */
|
||||||
public function getOpenSeatCount(){
|
public function getOpenSeatCount(){
|
||||||
return $this->seat_count - $this->getEventRegistrationCount();
|
return $this->seat_count - $this->getEventRegistrationCount();
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the model class for table "event_equipment_type".
|
* This is the model class for table "event_equipment_type".
|
||||||
@ -31,22 +33,32 @@ class EventEquipmentType extends \yii\db\ActiveRecord
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['created_at', 'updated_at'], 'required'],
|
[['name'], 'required'],
|
||||||
[['created_at', 'updated_at'], 'safe'],
|
|
||||||
[['name'], 'string', 'max' => 255]
|
[['name'], 'string', 'max' => 255]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function attributeLabels()
|
public function attributeLabels()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => Yii::t('common/event', 'ID'),
|
'id' => Yii::t('common/event-equipment-type', 'ID'),
|
||||||
'name' => Yii::t('common/event', 'Name'),
|
'name' => Yii::t('common/event-equipment-type', 'Name'),
|
||||||
'created_at' => Yii::t('common/event', 'Created At'),
|
'created_at' => Yii::t('common/event-equipment-type', 'Created At'),
|
||||||
'updated_at' => Yii::t('common/event', 'Updated At'),
|
'updated_at' => Yii::t('common/event-equipment-type', 'Updated At'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the model class for table "event_equipment_type_assignment".
|
* This is the model class for table "event_equipment_type_assignment".
|
||||||
@ -39,6 +41,18 @@ class EventEquipmentTypeAssignment extends \yii\db\ActiveRecord
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -57,7 +71,7 @@ class EventEquipmentTypeAssignment extends \yii\db\ActiveRecord
|
|||||||
/**
|
/**
|
||||||
* @return \yii\db\ActiveQuery
|
* @return \yii\db\ActiveQuery
|
||||||
*/
|
*/
|
||||||
public function getIdEvent()
|
public function getEvent()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Event::className(), ['id' => 'id_event']);
|
return $this->hasOne(Event::className(), ['id' => 'id_event']);
|
||||||
}
|
}
|
||||||
@ -65,7 +79,7 @@ class EventEquipmentTypeAssignment extends \yii\db\ActiveRecord
|
|||||||
/**
|
/**
|
||||||
* @return \yii\db\ActiveQuery
|
* @return \yii\db\ActiveQuery
|
||||||
*/
|
*/
|
||||||
public function getIdEventEquipmentType()
|
public function getEventEquipmentType()
|
||||||
{
|
{
|
||||||
return $this->hasOne(EventEquipmentType::className(), ['id' => 'id_event_equipment_type']);
|
return $this->hasOne(EventEquipmentType::className(), ['id' => 'id_event_equipment_type']);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,13 @@ namespace common\modules\event\controllers;
|
|||||||
|
|
||||||
use common\manager\EventRegistrationManager;
|
use common\manager\EventRegistrationManager;
|
||||||
use common\models\CardEventRegistrationForm;
|
use common\models\CardEventRegistrationForm;
|
||||||
|
use common\models\EventEquipmentType;
|
||||||
|
use common\models\EventEquipmentTypeAssignment;
|
||||||
|
use common\models\EventRegistrationEquipmentTypeAssignment;
|
||||||
use common\modules\event\EventModule;
|
use common\modules\event\EventModule;
|
||||||
use common\modules\event\models\copy\ClearWeekForm;
|
use common\modules\event\models\copy\ClearWeekForm;
|
||||||
use common\modules\event\models\copy\CopyWeekSearch;
|
use common\modules\event\models\copy\CopyWeekSearch;
|
||||||
|
use common\modules\event\models\EventEquipmentTypeForm;
|
||||||
use common\modules\event\models\EventPermissions;
|
use common\modules\event\models\EventPermissions;
|
||||||
use common\modules\event\models\timetable\TimeTableSearch;
|
use common\modules\event\models\timetable\TimeTableSearch;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
@ -43,11 +47,12 @@ class EventController extends Controller
|
|||||||
|
|
||||||
$module = EventModule::getInstance();
|
$module = EventModule::getInstance();
|
||||||
assert(isset($module), 'event module not set');
|
assert(isset($module), 'event module not set');
|
||||||
$allowedActions = ['index', 'view', 'reserve-card', 'cancel-registration', 'delete-registration', 'timetable', 'copy-week','clear-week'];
|
$allowedActions = ['index', 'view', 'reserve-card', 'cancel-registration', 'delete-registration', 'timetable', 'copy-week','clear-week',];
|
||||||
if ($module->mode === 'backend') {
|
if ($module->mode === 'backend') {
|
||||||
$allowedActions[] = 'create';
|
$allowedActions[] = 'create';
|
||||||
$allowedActions[] = 'update';
|
$allowedActions[] = 'update';
|
||||||
$allowedActions[] = 'delete';
|
$allowedActions[] = 'delete';
|
||||||
|
$allowedActions[] = 'equipment-types-assignment';
|
||||||
}
|
}
|
||||||
$behaviors['access'] = [
|
$behaviors['access'] = [
|
||||||
'class' => AccessControl::class,
|
'class' => AccessControl::class,
|
||||||
@ -93,14 +98,19 @@ class EventController extends Controller
|
|||||||
{
|
{
|
||||||
$eventRegistrationManager = new EventRegistrationManager();
|
$eventRegistrationManager = new EventRegistrationManager();
|
||||||
|
|
||||||
|
|
||||||
$dataProvider = new ActiveDataProvider([
|
$dataProvider = new ActiveDataProvider([
|
||||||
'query' => $eventRegistrationManager->createFindRegistrationsQuery($id),
|
'query' => $eventRegistrationManager->createFindRegistrationsQuery($id),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$equipmentAssignmentDataProvider = new ActiveDataProvider([
|
||||||
|
'query' => EventEquipmentTypeAssignment::find()->andWhere(['id_event' => $id]),
|
||||||
|
]
|
||||||
|
);
|
||||||
return $this->render('view', [
|
return $this->render('view', [
|
||||||
'model' => $this->findModel($id),
|
'model' => $this->findModel($id),
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
|
'equipmentAssignmentDataProvider' => $equipmentAssignmentDataProvider,
|
||||||
'permissions' => new EventPermissions()
|
'permissions' => new EventPermissions()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -295,6 +305,36 @@ class EventController extends Controller
|
|||||||
return $this->redirect(['timetable', []]);
|
return $this->redirect(['timetable', []]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $id the id
|
||||||
|
* @return string
|
||||||
|
* @throws NotFoundHttpException
|
||||||
|
*/
|
||||||
|
public function actionEquipmentTypesAssignment($id)
|
||||||
|
{
|
||||||
|
// $event = $this->findModel($id);
|
||||||
|
$formModel = new EventEquipmentTypeForm(
|
||||||
|
['idEvent' => $id]
|
||||||
|
);
|
||||||
|
$formModel->loadEvent();
|
||||||
|
$formModel->loadAssignedEquipment();
|
||||||
|
if (Yii::$app->request->isPost) {
|
||||||
|
if ($formModel->load(Yii::$app->request->post()) && $formModel->save()) {
|
||||||
|
$this->redirect(['view','id' => $formModel->event->id]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if ( !isset($formModel->event) ){
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$formModel->equipmentTypeList = EventEquipmentType::find()->orderBy(['name' => SORT_ASC])->all();
|
||||||
|
|
||||||
|
return $this->render('equipment-types-assignment', [
|
||||||
|
'formModel' => $formModel
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the Event model based on its primary key value.
|
* Finds the Event model based on its primary key value.
|
||||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
|||||||
118
common/modules/event/models/EventEquipmentTypeForm.php
Normal file
118
common/modules/event/models/EventEquipmentTypeForm.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\modules\event\models;
|
||||||
|
|
||||||
|
|
||||||
|
use common\models\Event;
|
||||||
|
use common\models\EventEquipmentType;
|
||||||
|
use common\models\EventEquipmentTypeAssignment;
|
||||||
|
use common\modules\event\manager\EventManager;
|
||||||
|
use common\modules\event\models\timetable\TimeTableMonth;
|
||||||
|
use common\modules\event\models\timetable\TimeTableMonthDay;
|
||||||
|
use customerapi\models\available\EventInterval;
|
||||||
|
use DateTime;
|
||||||
|
use Exception;
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property string $sourceDateString
|
||||||
|
*/
|
||||||
|
class EventEquipmentTypeForm extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
public $equipmentTypeList = [];
|
||||||
|
public $idEquipmentType;
|
||||||
|
public $idEvent;
|
||||||
|
public $count = null;
|
||||||
|
public $event = null;
|
||||||
|
|
||||||
|
public $assignedEquipmentTypes;
|
||||||
|
|
||||||
|
private $equipmentType = null;
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['count','idEvent','idEquipmentType'],'required'],
|
||||||
|
['count','integer'],
|
||||||
|
[['idEvent',], 'validateIdEvent'],
|
||||||
|
[['idEquipmentType',], 'validateEquipment'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validateEquipment(){
|
||||||
|
|
||||||
|
$this->equipmentType = EventEquipmentType::find()->andWhere(['id'=> $this->idEquipmentType])->one();
|
||||||
|
if ( !isset($this->equipmentType)){
|
||||||
|
$this->addError("idEquipmentType","Hibás Felszerelés típus");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validateIdEvent(){
|
||||||
|
$this->loadEvent();
|
||||||
|
if ( !isset($this->event)){
|
||||||
|
$this->addError("idEvent","Esemény nem található");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadEvent(){
|
||||||
|
$this->event = Event::find()->andWhere(['id'=> $this->idEvent])->one();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadAssignedEquipment(){
|
||||||
|
$this->assignedEquipmentTypes = new ActiveDataProvider(
|
||||||
|
[
|
||||||
|
'query' => EventEquipmentTypeAssignment::find()->andWhere(['id_event' => $this->event->id]),
|
||||||
|
'pagination' => false,
|
||||||
|
// 'sort' => [
|
||||||
|
// 'defaultOrder' => [
|
||||||
|
// 'created_at' => SORT_DESC,
|
||||||
|
// 'title' => SORT_ASC,
|
||||||
|
// ]
|
||||||
|
// ],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function save(){
|
||||||
|
$result = $this->validate();
|
||||||
|
if ( $result === false ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete assignments with the same type
|
||||||
|
EventEquipmentTypeAssignment::deleteAll(
|
||||||
|
[
|
||||||
|
'id_event' => $this->event->id,
|
||||||
|
'id_event_equipment_type' => $this->equipmentType->id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $this->count > 0 ){
|
||||||
|
$assignment = new EventEquipmentTypeAssignment();
|
||||||
|
$assignment->id_event = $this->event->id;
|
||||||
|
$assignment->id_event_equipment_type = $this->equipmentType->id;
|
||||||
|
$assignment->count = $this->count;
|
||||||
|
$assignment->save(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function attributeLabels(){
|
||||||
|
return [
|
||||||
|
"count" => "Mennyiség"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -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>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
use common\modules\event\models\EventEquipmentTypeForm;
|
||||||
|
|
||||||
|
/* @var $formModel EventEquipmentTypeForm */
|
||||||
|
echo $this->render('_equipment-types-assignment_form', ['model' => $formModel]);
|
||||||
|
|
||||||
@ -16,6 +16,7 @@ if ( $permissions->allowCreate ){
|
|||||||
$indexTableTemplateButtons[] = '{update}';
|
$indexTableTemplateButtons[] = '{update}';
|
||||||
}
|
}
|
||||||
$indexTableTemplateButtons[] = '{reserve-card}';
|
$indexTableTemplateButtons[] = '{reserve-card}';
|
||||||
|
$indexTableTemplateButtons[] = '{equipment-types-assignment}';
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -108,7 +109,7 @@ $indexTableTemplateButtons[] = '{reserve-card}';
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'class' => 'yii\grid\ActionColumn',
|
'class' => 'yii\grid\ActionColumn',
|
||||||
'template' => join("",$indexTableTemplateButtons),
|
'template' => join(" ",$indexTableTemplateButtons),
|
||||||
'urlCreator' => function ($action, $model, $key, $index) {
|
'urlCreator' => function ($action, $model, $key, $index) {
|
||||||
$params = ['id' => $model['event_id']];
|
$params = ['id' => $model['event_id']];
|
||||||
$params[0] = "event" . '/' . $action;
|
$params[0] = "event" . '/' . $action;
|
||||||
@ -148,6 +149,14 @@ $indexTableTemplateButtons[] = '{reserve-card}';
|
|||||||
'data-pjax' => '0',
|
'data-pjax' => '0',
|
||||||
];
|
];
|
||||||
return Html::a('<span class="glyphicon glyphicon-user"></span>', $url, $options);
|
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);
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ use yii\helpers\Html;
|
|||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Event */
|
/* @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' => Yii::t('event', 'Events'), 'url' => ['index']];
|
||||||
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||||
$this->params['breadcrumbs'][] = Yii::t('event', 'Update');
|
$this->params['breadcrumbs'][] = Yii::t('event', 'Update');
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use yii\grid\GridView;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\DetailView;
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
@ -42,8 +43,11 @@ function getCommonColumnsHtmlOptions($model)
|
|||||||
<?php
|
<?php
|
||||||
if ($permissions->allowEdit) {
|
if ($permissions->allowEdit) {
|
||||||
echo Html::a(Yii::t('event', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
|
echo Html::a(Yii::t('event', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
|
||||||
|
echo " ";
|
||||||
|
echo Html::a("Felszerelés", ['equipment-types-assignment', 'id' => $model->id], ['class' => 'btn btn-primary']);
|
||||||
}
|
}
|
||||||
if ($model->canReserve()) {
|
if ($model->canReserve()) {
|
||||||
|
echo " ";
|
||||||
echo Html::a(Yii::t('event', 'Reservation'), ['reserve-card', 'id' => $model->id], ['class' => 'btn btn-primary']);
|
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]); ?>
|
<?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 panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">Foglalások</h3>
|
<h3 class="panel-title">Foglalások</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?php try {
|
<?php try {
|
||||||
echo \yii\grid\GridView::widget([
|
echo GridView::widget([
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
'columns' => [
|
'columns' => [
|
||||||
[
|
[
|
||||||
|
|||||||
@ -64,7 +64,8 @@
|
|||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
"options": {
|
"options": {
|
||||||
"browserTarget": "app:build"
|
"browserTarget": "app:build",
|
||||||
|
"port": 4260
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
|
|||||||
@ -1,37 +1,76 @@
|
|||||||
<div class="container" *ngIf="event">
|
<div class="container" *ngIf="event">
|
||||||
<h1>Jelentkezés</h1>
|
<h1>Jelentkezés</h1>
|
||||||
<div class="row">
|
<form [formGroup]="eventForm">
|
||||||
<div class="col-lg-3 col-sm-12"><span class="title">Edzés típusa</span></div>
|
<div class="row">
|
||||||
<div class="col-lg-9 col-sm-12"><span>{{event.eventType.name}}</span></div>
|
<div class="col-lg-3 col-sm-12"><span class="title">Edzés típusa</span></div>
|
||||||
</div>
|
<div class="col-lg-9 col-sm-12"><span>{{event.eventType.name}}</span></div>
|
||||||
<div class="row" *ngIf="event.trainer">
|
|
||||||
<div class="col-lg-3 col-sm-12"><span class="title">Edző</span></div>
|
|
||||||
<div class="col-lg-9 col-sm-12"><span>{{event?.trainer?.name}}</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-3 col-sm-12"><span class="title">Edzés kezdési időpontja</span></div>
|
|
||||||
<div class="col-lg-9 col-sm-12"><span>{{event.start * 1000 | date:'yyyy.MM.dd HH:mm'}}</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-3 col-sm-12"><span class="title">Edzés vége</span></div>
|
|
||||||
<div class="col-lg-9 col-sm-12"><span>{{event.end * 1000 | date:'yyyy.MM.dd HH:mm'}}</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-3 col-sm-12"><span class="title">Férőhelyek száma</span></div>
|
|
||||||
<div class="col-lg-9 col-sm-12"><span>{{event.seat_count }}</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-3 col-sm-12"><span class="title">Terem</span></div>
|
|
||||||
<div class="col-lg-9 col-sm-12"><span>{{event?.room?.name }}</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-9 col-sm-12 pt-2">
|
|
||||||
<a *ngIf="mayRegister(event)" class="btn btn-primary " (click)="register(event)">Foglalás</a>
|
|
||||||
<a *ngIf="mayCancel(event)" class="btn btn-primary" (click)="cancel(event)">Lemondás</a>
|
|
||||||
<span *ngIf="!mayCancel(event) && noFreeSeat(event)">Már nincs szabad hely</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3 text-lg-right col-sm-12 pt-2">
|
<div class="row" *ngIf="event.trainer">
|
||||||
<a class="btn btn-primary " (click)="goBack(event)">Vissza</a>
|
<div class="col-lg-3 col-sm-12"><span class="title">Edző</span></div>
|
||||||
|
<div class="col-lg-9 col-sm-12"><span>{{event?.trainer?.name}}</span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row">
|
||||||
|
<div class="col-lg-3 col-sm-12"><span class="title">Edzés kezdési időpontja</span></div>
|
||||||
|
<div class="col-lg-9 col-sm-12"><span>{{event.start * 1000 | date:'yyyy.MM.dd HH:mm'}}</span></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-3 col-sm-12"><span class="title">Edzés vége</span></div>
|
||||||
|
<div class="col-lg-9 col-sm-12"><span>{{event.end * 1000 | date:'yyyy.MM.dd HH:mm'}}</span></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-3 col-sm-12"><span class="title">Férőhelyek száma</span></div>
|
||||||
|
<div class="col-lg-9 col-sm-12"><span>{{event.seat_count }}</span></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-3 col-sm-12"><span class="title">Terem</span></div>
|
||||||
|
<div class="col-lg-9 col-sm-12"><span>{{event?.room?.name }}</span></div>
|
||||||
|
</div>
|
||||||
|
<h2 *ngIf="event.equipmentTypeAssignments.length > 0">
|
||||||
|
Szükséges eszközök
|
||||||
|
</h2>
|
||||||
|
<ng-container *ngFor="let equipment of event.equipmentTypeAssignments; let i = index; ">
|
||||||
|
<h3>{{equipment?.equipmentType?.name }}</h3>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-sm-12">
|
||||||
|
<div class="form-check">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="{{'equipment'+equipment.id}}"
|
||||||
|
formControlName="{{'equipment'+equipment.id}}"
|
||||||
|
autocomplete="off"
|
||||||
|
id="equipment_{{equipment.id}}_1"
|
||||||
|
value="1"
|
||||||
|
>
|
||||||
|
<label class="form-check-label" for="equipment_{{equipment.id}}_1">
|
||||||
|
Szeretném a terem saját eszközét használni
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="{{'equipment'+equipment.id}}"
|
||||||
|
formControlName="{{'equipment'+equipment.id}}"
|
||||||
|
autocomplete="off"
|
||||||
|
id="equipment_{{equipment.id}}_0"
|
||||||
|
value="0"
|
||||||
|
>
|
||||||
|
<label class="form-check-label" for="equipment_{{equipment.id}}_0">
|
||||||
|
A saját eszközömet használom
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-9 col-sm-12 pt-2">
|
||||||
|
<a *ngIf="mayRegister(event)" class="btn btn-primary " (click)="register(event)">Foglalás</a>
|
||||||
|
<a *ngIf="mayCancel(event)" class="btn btn-primary" (click)="cancel(event)">Lemondás</a>
|
||||||
|
<span *ngIf="!mayCancel(event) && noFreeSeat(event)">Már nincs szabad hely</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 text-lg-right col-sm-12 pt-2">
|
||||||
|
<a class="btn btn-primary " (click)="goBack(event)">Vissza</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import {Event, EventService} from "../../services/event.service";
|
import {Event, EventService, RegisterEventRequest} from "../../services/event.service";
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from "@angular/router";
|
||||||
import {NavigationService} from "../../services/navigation.service";
|
import {NavigationService} from "../../services/navigation.service";
|
||||||
|
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-event-details',
|
selector: 'app-event-details',
|
||||||
@ -12,16 +13,31 @@ export class EventDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
event: Event;
|
event: Event;
|
||||||
|
|
||||||
|
eventForm: FormGroup;
|
||||||
|
formControls: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private fb: FormBuilder,
|
||||||
private eventService: EventService,
|
private eventService: EventService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private navigationService: NavigationService
|
private navigationService: NavigationService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.formControls = {
|
||||||
|
idEvent: ["", [Validators.required ]],
|
||||||
|
}
|
||||||
let idEvent = +this.route.snapshot.paramMap.get('idEvent');
|
let idEvent = +this.route.snapshot.paramMap.get('idEvent');
|
||||||
this.eventService.findEvent(idEvent).subscribe(
|
this.eventService.findEvent(idEvent).subscribe(
|
||||||
value => this.event = value
|
value => {
|
||||||
|
|
||||||
|
this.event = value;
|
||||||
|
this.event.equipmentTypeAssignments.forEach((assignment,index) =>{
|
||||||
|
this.formControls['equipment'+assignment.id] = ["", [Validators.required ]]
|
||||||
|
})
|
||||||
|
this.eventForm = this.fb.group(this.formControls);
|
||||||
|
this.eventForm.patchValue({"idEvent": this.event.id})
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +60,24 @@ export class EventDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
register(event: Event) {
|
register(event: Event) {
|
||||||
console.info("register", event);
|
console.info("register", event);
|
||||||
this.eventService.register(event.id)
|
console.info(this.eventForm.value);
|
||||||
|
|
||||||
|
let request :RegisterEventRequest= {
|
||||||
|
idEvent: this.eventForm.value.idEvent,
|
||||||
|
equipment: []
|
||||||
|
|
||||||
|
};
|
||||||
|
this.event.equipmentTypeAssignments.forEach((value, index) => {
|
||||||
|
if ( this.eventForm.value.hasOwnProperty('equipment'+value.id) ){
|
||||||
|
if ( this.eventForm.value['equipment'+value.id] === "1"){
|
||||||
|
request.equipment.push(value.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.info(request);
|
||||||
|
|
||||||
|
this.eventService.register(request)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
value => {},
|
value => {},
|
||||||
value => {},
|
value => {},
|
||||||
|
|||||||
@ -23,8 +23,8 @@ export class EventService {
|
|||||||
return this.http.get(Endpoints.GET_EVENT( idEvent )) as Observable<Event>;
|
return this.http.get(Endpoints.GET_EVENT( idEvent )) as Observable<Event>;
|
||||||
}
|
}
|
||||||
|
|
||||||
register(idEvent: number ): Observable<Event> {
|
register(registerEventRequest: RegisterEventRequest ): Observable<Event> {
|
||||||
return this.http.post(Endpoints.POST_EVENT_REGISTRATIONS_REGISTER( idEvent ),{}) as Observable<Event>;
|
return this.http.post(Endpoints.POST_EVENT_REGISTRATIONS_REGISTER( registerEventRequest.idEvent ),registerEventRequest) as Observable<Event>;
|
||||||
}
|
}
|
||||||
|
|
||||||
findRegistrations(): Observable<Registration[]> {
|
findRegistrations(): Observable<Registration[]> {
|
||||||
@ -65,6 +65,20 @@ export interface Event {
|
|||||||
eventType: EventType;
|
eventType: EventType;
|
||||||
reservedAt: number;
|
reservedAt: number;
|
||||||
room: Room;
|
room: Room;
|
||||||
|
equipmentTypeAssignments?: EquipmentTypeAssignment[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EquipmentTypeAssignment {
|
||||||
|
id: number;
|
||||||
|
count: number;
|
||||||
|
equipmentType: EquipmentType;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EquipmentType {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Room {
|
export interface Room {
|
||||||
@ -93,3 +107,8 @@ export interface Registration {
|
|||||||
created_at: number;
|
created_at: number;
|
||||||
event: Event
|
event: Event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RegisterEventRequest{
|
||||||
|
idEvent: number;
|
||||||
|
equipment: number[];
|
||||||
|
}
|
||||||
|
|||||||
@ -32,6 +32,12 @@ class EventDetailsView extends Event
|
|||||||
return RoomDetailsView::class;
|
return RoomDetailsView::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getEquipmentTypeAssignmentsClass()
|
||||||
|
{
|
||||||
|
return EventEquipmentTypeAssignmentView::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Override
|
* @Override
|
||||||
* @return array|false
|
* @return array|false
|
||||||
@ -50,6 +56,7 @@ class EventDetailsView extends Event
|
|||||||
$fields['trainer'] = 'trainer';
|
$fields['trainer'] = 'trainer';
|
||||||
$fields['eventType'] = 'eventType';
|
$fields['eventType'] = 'eventType';
|
||||||
$fields['room'] = 'room';
|
$fields['room'] = 'room';
|
||||||
|
$fields['equipmentTypeAssignments'] = 'equipmentTypeAssignments';
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace customerapi\models\details;
|
||||||
|
|
||||||
|
|
||||||
|
use common\models\EventEquipmentTypeAssignment;
|
||||||
|
|
||||||
|
class EventEquipmentTypeAssignmentView extends EventEquipmentTypeAssignment
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public function fields()
|
||||||
|
{
|
||||||
|
|
||||||
|
$fields = [
|
||||||
|
"id" => "id",
|
||||||
|
"count" => "count",
|
||||||
|
];
|
||||||
|
$fields['equipmentType'] = 'eventEquipmentType';
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user