add registrations to customer gui
This commit is contained in:
@@ -5,7 +5,6 @@ namespace customerapi\models\available;
|
||||
|
||||
|
||||
use common\models\Event;
|
||||
use common\models\EventType;
|
||||
|
||||
class EventAvailable extends Event
|
||||
{
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace customerapi\models\available;
|
||||
|
||||
|
||||
use common\models\EventRegistration;
|
||||
|
||||
class EventRegistrationAvailable extends EventRegistration
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
56
customerapi/models/details/EventDetailsView.php
Normal file
56
customerapi/models/details/EventDetailsView.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace customerapi\models\details;
|
||||
|
||||
|
||||
use common\models\Event;
|
||||
|
||||
class EventDetailsView extends Event
|
||||
{
|
||||
|
||||
public $reservationCount;
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getTrainerClass()
|
||||
{
|
||||
// override trainer class to have more control
|
||||
// about json fields
|
||||
return TrainerDetailsView::class;
|
||||
}
|
||||
|
||||
protected function getEventTypeClass()
|
||||
{
|
||||
return EventTypeDetailsView::class;
|
||||
}
|
||||
|
||||
protected function getRoomClass()
|
||||
{
|
||||
return RoomDetailsView::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Override
|
||||
* @return array|false
|
||||
*/
|
||||
function fields()
|
||||
{
|
||||
|
||||
$fields = [
|
||||
"id" => "id",
|
||||
"start" => "start",
|
||||
"end" => "end",
|
||||
"seat_count" => "seat_count",
|
||||
"active" => "active",
|
||||
// "reservationCount" => "reservationCount"
|
||||
];
|
||||
$fields['trainer'] = 'trainer';
|
||||
$fields['eventType'] = 'eventType';
|
||||
$fields['room'] = 'room';
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
20
customerapi/models/details/EventTypeDetailsView.php
Normal file
20
customerapi/models/details/EventTypeDetailsView.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace customerapi\models\details;
|
||||
|
||||
|
||||
use common\models\EventType;
|
||||
|
||||
class EventTypeDetailsView extends EventType
|
||||
{
|
||||
|
||||
function fields()
|
||||
{
|
||||
return [
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
19
customerapi/models/details/RoomDetailsView.php
Normal file
19
customerapi/models/details/RoomDetailsView.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace customerapi\models\details;
|
||||
|
||||
|
||||
use common\models\Room;
|
||||
|
||||
class RoomDetailsView extends Room
|
||||
{
|
||||
function fields()
|
||||
{
|
||||
return [
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
'seat_count' => 'seat_count'
|
||||
];
|
||||
}
|
||||
}
|
||||
20
customerapi/models/details/TrainerDetailsView.php
Normal file
20
customerapi/models/details/TrainerDetailsView.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace customerapi\models\details;
|
||||
|
||||
|
||||
use common\models\Trainer;
|
||||
|
||||
class TrainerDetailsView extends Trainer
|
||||
{
|
||||
|
||||
public function fields()
|
||||
{
|
||||
return [
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace customerapi\models\registrations;
|
||||
|
||||
|
||||
use common\models\EventRegistration;
|
||||
use customerapi\models\available\EventAvailable;
|
||||
|
||||
class EventRegistrationAvailable extends EventRegistration
|
||||
{
|
||||
|
||||
function fields()
|
||||
{
|
||||
|
||||
$fields = [
|
||||
"id" => "id",
|
||||
"created_at" => "created_at",
|
||||
"updated_at" => "updated_at",
|
||||
];
|
||||
$fields['event'] = 'event';
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function getEventClass()
|
||||
{
|
||||
return EventAvailable::class;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user