Merge branch 'release/version/v0.1.26'

This commit is contained in:
Roland Schneider 2021-09-27 22:01:12 +02:00
commit 93c8750441
578 changed files with 101315 additions and 728 deletions

5
.gitignore vendored
View File

@ -49,9 +49,10 @@ phpunit.phar
/rest/web/assets/**
!/rest/web/assets/.gitkeep
/customerapi/web/assets/**
!/customerapi/web/assets/.gitkeep
/customerapi/config/*-local.php
/customerapi/runtime/logs/**
!/customerapi/runtime/.gitkeep
/customerapi/web/assets/**
!/customerapi/assets/.gitkeep

View File

@ -1,204 +1,233 @@
<?php
namespace backend\components;
use Yii;
use common\models\Order;
use yii\helpers\Html;
use common\components\RoleDefinition;
use common\components\Helper;
class AdminMenuStructure{
public $menuItems;
public $emptyUrl = '#';//maybe null
public function __construct(){
$this->menuItems = [];
}
protected function can($authItem){
$result = false;
if (\Yii::$app->user->can($authItem)) {
$result = true;
}
return $result;
}
protected function addUserMainMenu(){
$userMainMenu = null;
$items = [];
if (!Yii::$app->user->isGuest) {
//$today = \Yii::$app->formatter->asDate( time() );
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
$tomorrow = \Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
/////////////////////////////
// Beállítások
/////////////////////////////
if ( RoleDefinition::isAdmin()){
$items[] = ['label' => 'Felhasználók', 'url' =>['/user/index']];
$items[] = ['label' => 'Jogosultságok', 'url' =>['/user/role']];
$this->menuItems[] = ['label' => 'Beállítások', 'url' => $this->emptyUrl,
'items' => $items
];
}
/////////////////////////////
// Törszadatok
/////////////////////////////
$items = [];
$items[] = ['label' => 'Raktárak', 'url' =>['/warehouse/index']];
if ( RoleDefinition::isAdmin()){
$items[] = ['label' => 'Kasszák', 'url' =>['/account/index']];
}
$items[] = ['label' => 'Kedvezmények', 'url' => ['/discount/index'] ];
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index'] ];
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];
$items[] = ['label' => 'Kulcsok', 'url' =>['/key/index']];
class AdminMenuStructure
{
public $menuItems;
public $emptyUrl = '#';//maybe null
public function __construct()
{
$this->menuItems = [];
}
protected function can($authItem)
{
$result = false;
if (\Yii::$app->user->can($authItem)) {
$result = true;
}
return $result;
}
/**
* @throws \yii\base\InvalidConfigException
*/
protected function addUserMainMenu()
{
$userMainMenu = null;
$items = [];
if (!Yii::$app->user->isGuest) {
//$today = \Yii::$app->formatter->asDate( time() );
$today = \Yii::$app->formatter->asDate(strtotime('today UTC'));
$tomorrow = \Yii::$app->formatter->asDate(strtotime('tomorrow UTC'));
$todayDatetime = \Yii::$app->formatter->asDatetime(strtotime('today UTC'));
$tomorrowDatetime = \Yii::$app->formatter->asDatetime(strtotime('tomorrow UTC'));
/////////////////////////////
// Beállítások
/////////////////////////////
if (RoleDefinition::isAdmin()) {
$items[] = ['label' => 'Felhasználók', 'url' => ['/user/index']];
$items[] = ['label' => 'Jogosultságok', 'url' => ['/user/role']];
$this->menuItems[] = ['label' => 'Beállítások', 'url' => $this->emptyUrl,
'items' => $items
];
}
if (RoleDefinition::isAdmin() || RoleDefinition::isEmployee()
|| RoleDefinition::isReception()) {
/////////////////////////////
// Törszadatok
/////////////////////////////
$items = [];
$items[] = ['label' => 'Raktárak', 'url' => ['/warehouse/index']];
if (RoleDefinition::isAdmin()) {
$items[] = ['label' => 'Kasszák', 'url' => ['/account/index']];
}
$items[] = ['label' => 'Kedvezmények', 'url' => ['/discount/index']];
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index']];
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index']];
$items[] = ['label' => 'Kulcsok', 'url' => ['/key/index']];
// $items[] = ['label' => 'Pénznem', 'url' => ['/currency/index'] ];
$this->menuItems[] = ['label' => 'Törzsadatok', 'url' =>$this->emptyUrl,
'items' => $items
];
/////////////////////////////
// BÉRLETEK
/////////////////////////////
$items = [];
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'] , 'target_url' => ['/customer/index' ,'/customer/view','/ticket/index-customer'] ];
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index'] ];
$items[] = ['label' => 'Bérletek', 'url' => ['/ticket/index' , 'TicketSearch[start]' =>$todayDatetime,'TicketSearch[end]' => $tomorrowDatetime ] ];
$items[] = ['label' => 'Statisztika', 'url' => ['/ticket/statistics' , 'TicketSearchStatisitcs[start]' =>$today,'TicketSearchStatisitcs[end]' => $tomorrow ] ];
$items[] = ['label' => 'Kártya létrehozás', 'url' => ['/card-package/index' , ] ];
$items[] = ['label' => 'Kártya csomag RFId hozzárendelés', 'url' => ['/card-package/import' , ] ];
$items[] = ['label' => 'Érvényességek újraszámolása', 'url' => ['/card/recalculate' , ] ];
$this->menuItems[] = ['label' => 'Bérletek/Vendégek', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Termékek
/////////////////////////////
$items = [];
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index'] ];
$items[] = ['label' => 'Selejt', 'url' => ['/waste/index' ,'WasteSearch[date_start]' =>$today,'WasteSearch[date_end]' => $tomorrow ] ];
$items[] = ['label' => 'Leltár csoport', 'url' => ['/inventory-group/index'] ];
$items[] = ['label' => 'Leltár', 'url' => ['/inventory/index'] ];
$items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale' ,'TransferSaleSearch[start]' =>$todayDatetime,'TransferSaleSearch[end]' => $tomorrowDatetime ] ];
$items[] = ['label' => 'Termék összesítő', 'url' => ['/product/statistics' ,'ProductStatisticsSearch[start]' =>$todayDatetime,'ProductStatisticsSearch[end]' => $tomorrowDatetime ] ];
$items[] = ['label' => 'Leltár pillanat képek', 'url' => ['/inventory/daily' ] ];
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Pénzügy
/////////////////////////////
$items = [];
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$todayDatetime,'TransferSearch[end]' => $tomorrowDatetime ] ];
$this->menuItems[] = ['label' => 'Törzsadatok', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// BÉRLETEK
/////////////////////////////
$items = [];
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'], 'target_url' => ['/customer/index', '/customer/view', '/ticket/index-customer']];
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index']];
$items[] = ['label' => 'Bérletek', 'url' => ['/ticket/index', 'TicketSearch[start]' => $todayDatetime, 'TicketSearch[end]' => $tomorrowDatetime]];
$items[] = ['label' => 'Statisztika', 'url' => ['/ticket/statistics', 'TicketSearchStatisitcs[start]' => $today, 'TicketSearchStatisitcs[end]' => $tomorrow]];
$items[] = ['label' => 'Kártya létrehozás', 'url' => ['/card-package/index',]];
$items[] = ['label' => 'Kártya csomag RFId hozzárendelés', 'url' => ['/card-package/import',]];
$items[] = ['label' => 'Érvényességek újraszámolása', 'url' => ['/card/recalculate',]];
$this->menuItems[] = ['label' => 'Bérletek/Vendégek', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Termékek
/////////////////////////////
$items = [];
$items[] = ['label' => 'Termékek', 'url' => ['/product/index']];
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index']];
$items[] = ['label' => 'Selejt', 'url' => ['/waste/index', 'WasteSearch[date_start]' => $today, 'WasteSearch[date_end]' => $tomorrow]];
$items[] = ['label' => 'Leltár csoport', 'url' => ['/inventory-group/index']];
$items[] = ['label' => 'Leltár', 'url' => ['/inventory/index']];
$items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale', 'TransferSaleSearch[start]' => $todayDatetime, 'TransferSaleSearch[end]' => $tomorrowDatetime]];
$items[] = ['label' => 'Termék összesítő', 'url' => ['/product/statistics', 'ProductStatisticsSearch[start]' => $todayDatetime, 'ProductStatisticsSearch[end]' => $tomorrowDatetime]];
$items[] = ['label' => 'Leltár pillanat képek', 'url' => ['/inventory/daily']];
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Pénzügy
/////////////////////////////
$items = [];
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index', 'TransferSearch[start]' => $todayDatetime, 'TransferSearch[end]' => $tomorrowDatetime]];
// $items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ];
$items[] = ['label' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' =>$todayDatetime,'TransferListSearch[end]' => $tomorrowDatetime ] ];
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
$items[] = ['label' => 'Későbbi utalások', 'url' => ['/transfer/payment-later','TransferLaterSearch[start]' =>$todayDatetime,'TransferLaterSearch[end]' => $tomorrowDatetime ,'TransferLaterSearch[enterStart]' =>$todayDatetime,'TransferLaterSearch[enterEnd]' => $tomorrowDatetime ] ];
//$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Tartós megbízások
/////////////////////////////
$items = [];
$items[] = ['label' => 'Szerződések', 'url' => ['/contract/index' ] ];
$items[] = ['label' => 'Megbízások', 'url' => ['/ticket-installment-request/index' , 'TicketInstallmentRequestSearch[start]' =>$today,'TicketInstallmentRequestSearch[end]' => $tomorrow ] ];
$items[] = ['label' => 'Giro kötegbe jelölés', 'url' => ['/ticket-installment-request/pending' , 'TicketInstallmentRequestSearchPending[end]' => $tomorrow ] ];
$items[] = ['label' => 'GIRO köteg létrehozás', 'url' => ['/ticket-installment-request/download-giro' ] ];
$items[] = ['label' => 'GIRO kötegek', 'url' => ['/ugiro/index' ] ];
$items[] = ['label' => 'Detsta feltöltés', 'url' => ['/ugiro/upload' ] ];
$items[] = ['label' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' => $todayDatetime, 'TransferListSearch[end]' => $tomorrowDatetime]];
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index']];
$items[] = ['label' => 'Későbbi utalások', 'url' => ['/transfer/payment-later', 'TransferLaterSearch[start]' => $todayDatetime, 'TransferLaterSearch[end]' => $tomorrowDatetime, 'TransferLaterSearch[enterStart]' => $todayDatetime, 'TransferLaterSearch[enterEnd]' => $tomorrowDatetime]];
//$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Tartós megbízások
/////////////////////////////
$items = [];
$items[] = ['label' => 'Szerződések', 'url' => ['/contract/index']];
$items[] = ['label' => 'Megbízások', 'url' => ['/ticket-installment-request/index', 'TicketInstallmentRequestSearch[start]' => $today, 'TicketInstallmentRequestSearch[end]' => $tomorrow]];
$items[] = ['label' => 'Giro kötegbe jelölés', 'url' => ['/ticket-installment-request/pending', 'TicketInstallmentRequestSearchPending[end]' => $tomorrow]];
$items[] = ['label' => 'GIRO köteg létrehozás', 'url' => ['/ticket-installment-request/download-giro']];
$items[] = ['label' => 'GIRO kötegek', 'url' => ['/ugiro/index']];
$items[] = ['label' => 'Detsta feltöltés', 'url' => ['/ugiro/upload']];
// $items[] = ['label' => 'Részletek aktiválása', 'url' => ['/ugiro/parts' ] ];
// $items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ];
// $items[] = ['label' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' =>$todayDatetime,'TransferListSearch[end]' => $tomorrowDatetime ] ];
// $items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
if ( RoleDefinition::isAdmin() ){
$this->menuItems[] = ['label' => 'Tartós megbízások', 'url' => $this->emptyUrl,
'items' => $items
];
}
/////////////////////////////
// Kap lug megbízások
/////////////////////////////
$items = [];
$items[] = ['label' => 'Kártya események', 'url' => ['/door-log/index' , 'DoorLogSearch[start]' =>$todayDatetime,'DoorLogSearch[end]' => $tomorrowDatetime ] ];
$items[] = ['label' => 'Esemény napló', 'url' => ['/log/index' , 'LogSearch[start]' =>$todayDatetime,'LogSearch[end]' => $tomorrowDatetime ] ];
$this->menuItems[] = ['label' => 'Események', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Hírlevelek
/////////////////////////////
$items = [];
$items[] = ['label' => 'Hírlevelek', 'url' => ['/newsletter/index' , 'NewsletterSearch[start]' =>$todayDatetime,'NewsletterSearch[end]' => $tomorrowDatetime ] ];
$this->menuItems[] = ['label' => 'Hírlevél', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Korona vírus
/////////////////////////////
$items = [];
$items[] = ['label' => 'Inaktiválás', 'url' => ['/customer/inactivate' ] ];
$items[] = ['label' => 'Aktiválás', 'url' => ['/customer/activate' ] ];
$this->menuItems[] = ['label' => 'Koronavírus', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Development
/////////////////////////////
if ( Yii::$app->user ){
if (RoleDefinition::isAdmin()) {
$this->menuItems[] = ['label' => 'Tartós megbízások', 'url' => $this->emptyUrl,
'items' => $items
];
}
/////////////////////////////
// Kap lug megbízások
/////////////////////////////
$items = [];
$items[] = ['label' => 'Kapu Ki', 'url' => ['/door-log/out' ] ];
$items[] = ['label' => 'Kapu Be', 'url' => ['/door-log/in' ] ];
$this->menuItems[] = ['label' => 'Development', 'url' => $this->emptyUrl,
'items' => $items
$items[] = ['label' => 'Kártya események', 'url' => ['/door-log/index', 'DoorLogSearch[start]' => $todayDatetime, 'DoorLogSearch[end]' => $tomorrowDatetime]];
$items[] = ['label' => 'Esemény napló', 'url' => ['/log/index', 'LogSearch[start]' => $todayDatetime, 'LogSearch[end]' => $tomorrowDatetime]];
$this->menuItems[] = ['label' => 'Események', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Hírlevelek
/////////////////////////////
$items = [];
$items[] = ['label' => 'Hírlevelek', 'url' => ['/newsletter/index', 'NewsletterSearch[start]' => $todayDatetime, 'NewsletterSearch[end]' => $tomorrowDatetime]];
$this->menuItems[] = ['label' => 'Hírlevél', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Korona vírus
/////////////////////////////
$items = [];
$items[] = ['label' => 'Inaktiválás', 'url' => ['/customer/inactivate']];
$items[] = ['label' => 'Aktiválás', 'url' => ['/customer/activate']];
$this->menuItems[] = ['label' => 'Koronavírus', 'url' => $this->emptyUrl,
'items' => $items
];
}
}
}
protected function addLoginMainMenu(){
if (Yii::$app->user->isGuest) {
$mainMenuItem= ['label' => Yii::t('common/site','Login'), 'url' => ['/site/login']];
} else {
$mainMenuItem= [
'label' => Yii::t('common/site','Logout') . '(' . Yii::$app->user->identity->username . ')',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']
];
}
$this->menuItems[] = $mainMenuItem;
}
public function run(){
$this->addUserMainMenu();
/////////////////////////////
// Group Training
/////////////////////////////
if (RoleDefinition::isLoggedUser()) {
$items = [];
$items[] = ['label' => 'Felszerelés', 'url' => ['/event-equipment-type']];
$items[] = ['label' => 'Edzők', 'url' => ['/trainer']];
$items[] = ['label' => 'Termek', 'url' => ['/room']];
$items[] = ['label' => 'Esemény típusok', 'url' => ['/event-type']];
$items[] = ['label' => 'Események', 'url' => ['/event/event/index']];
$items[] = ['label' => 'Órarend', 'url' => ['/event/event/timetable']];
$items[] = ['label' => 'Hét másolása', 'url' => ['/event/event/copy-week']];
$this->menuItems[] = ['label' => 'Csoportos edzés', 'url' => $this->emptyUrl,
'items' => $items
];
}
/////////////////////////////
// Development
/////////////////////////////
if (RoleDefinition::isAdmin()) {
$items = [];
$items[] = ['label' => 'Kapu Ki', 'url' => ['/door-log/out']];
$items[] = ['label' => 'Kapu Be', 'url' => ['/door-log/in']];
$this->menuItems[] = ['label' => 'Development', 'url' => $this->emptyUrl,
'items' => $items
];
}
}
}
protected function addLoginMainMenu()
{
if (Yii::$app->user->isGuest) {
$mainMenuItem = ['label' => Yii::t('common/site', 'Login'), 'url' => ['/site/login']];
} else {
/** @noinspection PhpUndefinedFieldInspection */
$mainMenuItem = [
'label' => Yii::t('common/site', 'Logout') . '(' . Yii::$app->user->identity->username . ')',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']
];
}
$this->menuItems[] = $mainMenuItem;
}
/**
* @return array
* @throws \yii\base\InvalidConfigException
*/
public function run()
{
$this->addUserMainMenu();
// $this->addLoginMainMenu();
return $this->menuItems;
}
return $this->menuItems;
}
}

View File

@ -12,7 +12,6 @@ return [
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
'modules' => [],
'components' => [
'request' => [
'enableCsrfValidation'=>false,
@ -46,5 +45,11 @@ return [
'errorAction' => 'site/error',
],
],
'modules' => [
'event' => [
'class' => 'common\modules\event\EventModule',
'mode' => 'backend'
],
],
'params' => $params,
];

View File

@ -269,7 +269,7 @@ class CardPackageController extends \backend\controllers\BackendController
} catch (\Exception $e) {
$tx->rollBack();
$model->failed = $model->failed + 1;
\Yii::error("Failed to import card rfid: " . print_r($row, true));
\Yii::error("Failed to import card rfid: " . print_r($row, true) . " ->" . $e->getMessage());
}
}

View File

@ -149,6 +149,8 @@ class CustomerController extends \backend\controllers\BackendController
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
* @throws \yii\base\InvalidConfigException
*/
public function actionUpdate($id)
{

View 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.');
}
}
}

View File

@ -0,0 +1,152 @@
<?php
namespace backend\controllers;
use common\manager\EventRegistrationManager;
use common\models\CardEventRegistrationForm;
use Yii;
use common\models\EventRegistration;
use backend\models\EventRegistrationSearch;
use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\web\HttpException;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\ServerErrorHttpException;
/**
* EventRegistrationController implements the CRUD actions for EventRegistration model.
*/
class EventRegistrationController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all EventRegistration models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new EventRegistrationSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single EventRegistration model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new EventRegistration model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new EventRegistration();
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 EventRegistration model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
*/
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,
]);
}
}
/**
* Deletes an existing EventRegistration model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
* @throws \yii\db\StaleObjectException
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
public function actionRegisterCard(){
$model = new CardEventRegistrationForm();
if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
$manager = new EventRegistrationManager();
try {
$manager->registerCard($model);
} catch (HttpException $e) {
if ( array_key_exists($e->getCode(),EventRegistrationManager::$STATES)) {
$model->addError("id_event", Yii::t('event-registration', EventRegistrationManager::$STATES[$e->getCode()]));
}else {
$model->addError("id_event", Yii::t('event-registration', "Unknown Error"));
}
}
}
if ( $model->hasErrors() ){
return $this->redirect(['view', 'id' => $model->registration->id]);
} else {
return $this->render('register_card', [
'model' => $model,
]);
}
}
/**
* Finds the EventRegistration model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return EventRegistration the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = EventRegistration::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,121 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\EventType;
use backend\models\EventTypeSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* EventTypeController implements the CRUD actions for EventType model.
*/
class EventTypeController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all EventType models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new EventTypeSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single EventType model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new EventType model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new EventType();
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 EventType 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,
]);
}
}
/**
* Deletes an existing EventType model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the EventType model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return EventType the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = EventType::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,121 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Room;
use backend\models\RoomSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* RoomController implements the CRUD actions for Room model.
*/
class RoomController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Room models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new RoomSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Room model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Room model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Room();
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 Room 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,
]);
}
}
/**
* Deletes an existing Room model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Room model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Room the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Room::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -71,10 +71,11 @@ class SiteController extends Controller
$model = new LoginForm();
$model->roles = [
'admin',
'employee'
'employee',
'trainer',
];
if ($model->load(Yii::$app->request->post()) && $model->login()) {
$geoip = Helper::getGeoIp();
@ -83,14 +84,14 @@ class SiteController extends Controller
$ipAddress = ( isset($geoip) && isset($geoip->ip) ) ? $geoip->ip : "ismeretlen";
$geoCity = ( isset($geoip) && isset($geoip->city) ) ? $geoip->city : "ismeretlen";
$message = "Bejelentkezés: " .$user->username. " Ip cím:". $ipAddress . " Város: " . $geoCity;
Log::log([
'type' =>Log::$TYPE_LOGIN,
'message' => $message
]);
$this->sendLoginMail();
return $this->goBack();
} else {
return $this->render('login', [
@ -102,32 +103,32 @@ class SiteController extends Controller
protected function sendLoginMail(){
if ( \Yii::$app->params['login_admin_email'] == true){
$geoip = Helper::getGeoIp();
$user = User::findOne(\Yii::$app->user->id);
$message = \Yii::$app->mailer->compose('login_admin', [
'model' => $user,
'geoip' => $geoip,
'company' => Helper::getCompany()
]);
$message->setFrom( \Yii::$app->params['infoEmail'] )
->setTo( \Yii::$app->params['notify_mail'] )
->setSubject('Admin bejelentkezés - ' . $user->username )
->send();
}
}
public function actionLogout()
{
Yii::$app->user->logout();
return $this->goHome();
}
public function actionUploadImage(){
\yii::$app->request->enableCsrfValidation = false;
$model = new UploadForm();
return $this->render('upload', ['model' =>$model]);
}
}

View File

@ -5,15 +5,13 @@ namespace backend\controllers;
use Yii;
use common\models\TicketType;
use backend\models\TicketTypeSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Account;
/**
* TicketTypeController implements the CRUD actions for TicketType model.
*/
class TicketTypeController extends \backend\controllers\BackendController
class TicketTypeController extends BackendController
{
@ -60,6 +58,7 @@ class TicketTypeController extends \backend\controllers\BackendController
* Displays a single TicketType model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
*/
public function actionView($id)
{
@ -82,6 +81,7 @@ class TicketTypeController extends \backend\controllers\BackendController
$model->time_unit_type = TicketType::TIME_UNIT_MONTH;
$model->time_unit_count = 1;
$model->max_usage_count = 0;
$model->max_reservation_count = 0;
$accounts = Account::find()->andWhere(['status' => Account::STATUS_ACTIVE])->all();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
@ -99,6 +99,7 @@ class TicketTypeController extends \backend\controllers\BackendController
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
*/
public function actionUpdate($id)
{

View File

@ -0,0 +1,126 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Trainer;
use backend\models\TrainerSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* TrainerController implements the CRUD actions for Trainer model.
*/
class TrainerController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Trainer models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new TrainerSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Trainer model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Trainer model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Trainer();
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 Trainer model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
*/
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,
]);
}
}
/**
* Deletes an existing Trainer model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
* @throws \yii\db\StaleObjectException
*/
public function actionDelete($id)
{
$trainer = $this->findModel($id);
$trainer->active = Trainer::ACTIVE_OFF;
$trainer->update( );
return $this->redirect(['index']);
}
/**
* Finds the Trainer model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Trainer the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Trainer::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -33,13 +33,12 @@ use common\models\Customer;
*/
class CustomerUpdate extends \common\models\Customer
{
public $password_plain;
public $cardNumber;
public $partnerCardNumber;
public $password_plain;
public $password_repeat;
/**
* @inheritdoc
*/
@ -57,7 +56,9 @@ class CustomerUpdate extends \common\models\Customer
// [['cardNumber'], 'required' ],
// [['cardNumber'], 'string', 'max' => 10],
// [['cardNumber'], 'validateCustomerCard' ],
[['password_plain' ] ,'string','min' =>6 ],
[['partnerCardNumber'], 'string', 'max' => 10],
[['partnerCardNumber'], 'validatePartnerCard' ],
@ -78,7 +79,7 @@ class CustomerUpdate extends \common\models\Customer
],
[['password_plain','password_repeat'], 'string', 'max' => 32],
[['password_plain' ], 'string', 'max' => 32],
[['sex'], 'integer'],
@ -113,5 +114,22 @@ class CustomerUpdate extends \common\models\Customer
public function validatePartnerCard($a,$p){
// Customer::find()->andWhere( [$this->cardNumber )
}
/**
* @param bool $insert
* @return bool
* @throws \yii\base\Exception
* @throws \yii\base\InvalidConfigException
*/
public function beforeSave($insert)
{
$result = parent::beforeSave($insert);
if ($result && !empty($this->password_plain)) {
$this->setPassword($this->password_plain);
return true;
}
return $result;
}
}

View 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;
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\EventRegistration;
/**
* EventRegistrationSearch represents the model behind the search form about `common\models\EventRegistration`.
*/
class EventRegistrationSearch extends EventRegistration
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'id_event', 'id_customer'], 'integer'],
[['created_at', 'updated_at', 'canceled_at'], '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 = EventRegistration::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,
'id_event' => $this->id_event,
'id_customer' => $this->id_customer,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'canceled_at' => $this->canceled_at,
]);
return $dataProvider;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\EventType;
/**
* EventTypeSearch represents the model behind the search form about `common\models\EventType`.
*/
class EventTypeSearch extends EventType
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id'], 'integer'],
[['name', 'created_at', 'updated_at'], '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 = EventType::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;
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Room;
/**
* RoomSearch represents the model behind the search form about `common\models\Room`.
*/
class RoomSearch extends Room
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'seat_count'], 'integer'],
[['name', 'created_at', 'updated_at'], '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 = Room::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,
'seat_count' => $this->seat_count,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name]);
return $dataProvider;
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Trainer;
/**
* TrainerSearch represents the model behind the search form about `common\models\Trainer`.
*/
class TrainerSearch extends Trainer
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'active'], 'integer'],
[['name', 'phone', 'email', 'password', 'created_at', 'updated_at'], '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 = Trainer::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,
'active' => $this->active,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'phone', $this->phone])
->andFilterWhere(['like', 'email', $this->email])
->andFilterWhere(['like', 'password', $this->password]);
return $dataProvider;
}
}

View File

@ -8,7 +8,6 @@ use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\db\Expression;
use yii\db\Query;
use yii\helpers\ArrayHelper;
use common\models\Account;
use common\components\Helper;
use common\components\RoleDefinition;
@ -278,11 +277,12 @@ class TransferSearch extends Transfer
}
/**
* @throws \yii\db\Exception
*/
public function totalsTransfers()
{
$accounts = Account::read();
$accountMap = ArrayHelper::map($accounts, 'id_account', 'name');
$idUser = $this->id_user;
/**mk totals need date time format*/
@ -291,8 +291,7 @@ class TransferSearch extends Transfer
$start .= ' 00:00';
}
$this->totals = Transfer::mkTotals($start, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
$this->totals = Transfer::mkTotals($start, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts);
}

View File

@ -84,4 +84,4 @@ class UserUpdate extends User {
$role = $am->getRole($this->role);
Yii::$app->authManager->assign($role, $this->id);
}
}
}

View File

@ -69,6 +69,11 @@ use kartik\widgets\DatePicker;
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'password_plain')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
</div>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

@ -0,0 +1,24 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\EventRegistration */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-registration-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_event')->textInput() ?>
<?= $form->field($model, 'id_customer')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-registration', 'Create') : Yii::t('event-registration', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,24 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\CardEventRegistrationForm */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-registration-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'card_number')->textInput() ?>
<?= $form->field($model, 'event_id')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-registration', 'Create') : Yii::t('event-registration', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,51 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\EventRegistrationSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-registration-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="panel panel-default">
<div class="panel-heading">
Keresés
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'id') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'id_event') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'id_customer') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
</div>
</div>
<?php // echo $form->field($model, 'canceled_at') ?>
</div>
<div class="panel-footer">
<?= Html::submitButton(Yii::t('event-registration', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\EventRegistration */
$this->title = Yii::t('event-registration', 'Create Event Registration');
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-registration-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\EventRegistrationSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('event-registration', 'Event Registrations');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-registration-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('event-registration', 'Create Event Registration'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'id_event',
'id_customer',
'created_at:datetime',
'updated_at:datetime',
'canceled_at:datetime',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\CardEventRegistrationForm */
$this->title = Yii::t('event-registration', 'Create Event Registration');
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-registration-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form_register_card', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\EventRegistration */
$this->title = Yii::t('event-registration', 'Update {modelClass}: ', [
'modelClass' => 'Event Registration',
]) . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('event-registration', 'Update');
?>
<div class="event-registration-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,40 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\EventRegistration */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-registration-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('event-registration', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('event-registration', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('event-registration', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'id_event',
'id_customer',
'created_at',
'updated_at',
'canceled_at',
],
]) ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\EventType */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-type-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-type', 'Create') : Yii::t('event-type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,36 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\EventTypeSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-type-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Keresés</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'name') ?>
</div>
</div>
</div>
<div class="panel-footer">
<?= Html::submitButton(Yii::t('event-type', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\EventType */
$this->title = Yii::t('event-type', 'Create Event Type');
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-type-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,36 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\EventTypeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('event-type', 'Event Types');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-type-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('event-type', 'Create Event Type'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'name',
'created_at:datetime',
'updated_at:datetime',
['class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}'
],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\EventType */
$this->title = Yii::t('event-type', 'Update Event Type:') . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('event-type', 'Update');
?>
<div class="event-type-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\EventType */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-type-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('event-type', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('event-type', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('event-type', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'created_at',
'updated_at',
],
]) ?>
</div>

View File

@ -0,0 +1,54 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-form">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'startDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose' => true,
'format' => 'yyyy.mm.dd hh:ii'
],
'options' => [
'autocomplete' => 'off'
]
]);
?>
<?= $form->field($model, 'endDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose' => true,
'format' => 'yyyy.mm.dd hh:ii'
],
'options' => [
'autocomplete' => 'off'
]
])
?>
<?= $form->field($model, 'seat_count')->textInput() ?>
<?= $form->field($model, 'id_room')->dropDownList(\common\models\Room::roomOptions(false, true)) ?>
<?= $form->field($model, 'id_trainer')->dropDownList(\common\models\Trainer::trainerOptions(false, true)) ?>
<?= $form->field($model, 'id_event_type')->dropDownList(\common\models\EventType::eventTypeOptions(false, true)) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('event', 'Create') : Yii::t('event', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\CardEventRegistrationForm */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-registration-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'card_number')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-registration', 'Create') : Yii::t('event-registration', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,74 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\EventSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Keresés</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'id') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'startDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
],
'options' => [
'autocomplete' => 'off'
]
]); ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'endDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
],
'options' => [
'autocomplete' => 'off'
]
])
?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'roomName')->dropDownList(\common\models\Room::roomOptions(true)) ?>
</div>
</div>
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'trainerName')->dropDownList(\common\models\Trainer::trainerOptions(true)) ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?php echo $form->field($model, 'eventTypeName')->dropDownList(\common\models\EventType::eventTypeOptions(true)) ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
</div>
</div>
</div>
<div class="panel-footer">
<?= Html::submitButton(Yii::t('event', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,74 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Esemény</h3>
</div>
<div class="panel-body">
<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',
'created_at:datetime',
'updated_at:datetime',
'deleted_at:datetime',
],
]);
} 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')
],
'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 view";
} ?>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<?php try {
echo DetailView::widget([
'model' => $model,
'attributes' => [
'seat_count',
'eventRegistrationCount',
'openSeatCount',
],
]);
} catch (Exception $e) {
echo "Failed to render view";
} ?>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
$this->title = Yii::t('event', 'Create Event');
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,123 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\EventSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('event', 'Events');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('event', 'Create Event'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'event_id',
'label' => \Yii::t('event', 'ID')
],
[
'attribute' => 'event_type_name',
'label' => \Yii::t('event', 'Id Event Type')
],
[
'attribute' => 'event_start',
'label' => \Yii::t('event', 'Start'),
'format' => 'datetime'
],
[
'attribute' => 'event_end',
'label' => \Yii::t('event', 'End'),
'format' => 'time'
],
[
'attribute' => 'event_seat_count',
'label' => \Yii::t('event', 'Seat Count')
],
[
'attribute' => 'registration_count',
'label' => \Yii::t('event', 'Registration Count')
],
[
'attribute' => 'room_name',
'label' => \Yii::t('event', 'Room Name')
],
[
'attribute' => 'trainer_name',
'label' => \Yii::t('event', 'Trainer Name')
],
[
'attribute' => 'event_created_at',
'label' => \Yii::t('event', 'Created At'),
'format' => 'datetime'
],
[
'attribute' => 'event_updated_at',
'label' => \Yii::t('event', 'Updated At'),
'format' => 'datetime'
],
[
'attribute' => 'event_deleted_at',
'label' => \Yii::t('event', 'Deleted At'),
'format' => 'datetime'
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update} {reserve-card}',
'urlCreator' => function ($action, $model, $key, $index) {
$params = ['id' => $model['event_id']];
$params[0] = "event" . '/' . $action;
return \yii\helpers\Url::toRoute($params);
},
'buttons' => [
'view' => function ($url, $model, $key) {
$options = [
'title' => Yii::t('yii', 'View'),
'aria-label' => Yii::t('yii', 'View'),
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, $options);
},
'update' => function ($url, $model, $key) {
$options = [
'title' => Yii::t('yii', 'Update'),
'aria-label' => Yii::t('yii', 'Update'),
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, $options);
},
'delete' => function ($url, $model, $key) {
$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-trash"></span>', $url, $options);
},
'reserve-card' => function ($url, $model, $key) {
$options = [
'title' => Yii::t('yii', 'Register'),
'aria-label' => Yii::t('yii', 'Register'),
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-user"></span>', $url, $options);
}
]
],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\CardEventRegistrationForm */
$this->title = Yii::t('event-registration', 'Create Event Registration');
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-registration-create">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_view', ['model' => $event]); ?>
<?= $this->render('_form_register_card', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,20 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
$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');
?>
<div class="event-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,168 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
$this->title = \Yii::t('event', 'Event Details');
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
function isReservationOpen($model)
{
$canceled = isset($model['event_registration_canceled_at']);
$deleted = isset($model['event_registration_deleted_at']);
return !$canceled && !$deleted;
}
function getCommonColumnsHtmlOptions($model)
{
$options = [];
if (!isReservationOpen($model)) {
$options['style'] = 'text-decoration: line-through;';
}
return $options;
}
?>
<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']) ?>
<?php
if ( $model->canReserve()){
echo Html::a(Yii::t('event', 'Reservation'), ['reserve-card', 'id' => $model->id], ['class' => 'btn btn-primary']);
}
?>
<?php
if ($model->canDelete()) {
echo 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>
<?php echo $this->render('_view', ['model' => $model]); ?>
<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([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'card_number',
'label' => \Yii::t('event', 'Card Number'),
'contentOptions' => function ($model) {
return getCommonColumnsHtmlOptions($model);
},
'format' => 'raw',
'value' => function ($model, $key, $index, $column) {
return Html::a($model['card_number'], ['card/view', 'id' => $model['card_id_card']]);
}
],
[
'attribute' => 'customer_name',
'label' => \Yii::t('event', 'Customer Name'),
'contentOptions' => function ($model) {
return getCommonColumnsHtmlOptions($model);
},
'format' => 'raw',
'value' => function ($model, $key, $index, $column) {
return Html::a($model['customer_name'], ['customer/view', 'id' => $model['customer_id_customer']]);
}
],
[
'attribute' => 'customer_email',
'label' => \Yii::t('event', 'Customer Email'),
'contentOptions' => function ($model) {
return getCommonColumnsHtmlOptions($model);
}
],
[
'attribute' => 'event_registration_created_at',
'label' => \Yii::t('event', 'Event Registration Created At'),
'contentOptions' => function ($model) {
return getCommonColumnsHtmlOptions($model);
}
],
[
'attribute' => 'event_registration_canceled_at',
'format' => 'datetime',
'label' => \Yii::t('event', 'Canceled At'),
'contentOptions' => function () {
$options = [];
return $options;
}
],
[
'attribute' => 'event_registration_deleted_at',
'format' => 'datetime',
'label' => \Yii::t('event', 'Deleted At'),
'contentOptions' => function () {
$options = [];
return $options;
},
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{cancel-registration} {delete-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('event', 'Cancel'),
'aria-label' => Yii::t('event', 'Cancel'),
'data-confirm' => Yii::t('event', 'Are you sure you want to cancel this item? Usage count won\'t be restored!'),
'data-method' => 'post',
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-ban-circle"></span>', $url, $options);
},
'delete-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('event', 'Are you sure you want to delete this item? Usage count will be restored!'),
'data-method' => 'post',
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options);
},
]
],
]
]);
} catch (Exception $e) {
echo "Failed to render registrations";
}
?>
</div>
</div>
</div>

View File

@ -0,0 +1,25 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Room */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="room-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'seat_count')->textInput(['type' => 'number']) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('room', 'Create') : Yii::t('room', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,48 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\RoomSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="room-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?php
// ///////////////////////////////////////
// Search Pane
// ///////////////////////////////////////
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Keresés</h3>
</div>
<div class="panel-body">
<?php
// ///////////////////////////////////////
// Search fields
// ///////////////////////////////////////
?>
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'name') ?>
</div>
</div>
</div>
<div class="panel-footer">
<?php
// ///////////////////////////////////////
// Search button
// ///////////////////////////////////////
?>
<?= Html::submitButton(Yii::t('room', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Room */
$this->title = Yii::t('room', 'Create Room');
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="room-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,37 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\RoomSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('room', 'Rooms');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="room-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('room', 'Create Room'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'name',
'seat_count',
'created_at:datetime',
'updated_at:datetime',
['class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}'
],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Room */
$this->title = Yii::t('room', 'Update Room: ') . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('room', 'Update');
?>
<div class="room-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,39 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Room */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="room-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('room', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('room', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('room', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'seat_count',
'created_at',
'updated_at',
],
]) ?>
</div>

View File

@ -33,6 +33,7 @@ use yii\helpers\ArrayHelper;
<?= mkTitle("Alkalmak")?>
<?= $form->field($model, 'max_usage_count')->textInput() ?>
<?= $form->field($model, 'max_reservation_count')->textInput() ?>
<?= mkTitle("Érvényességi idő belállítások")?>
<div class="row">

View File

@ -21,49 +21,54 @@ $this->params['breadcrumbs'][] = $this->title;
</p>
<?php }?>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'name',
[
'attribute' => 'type',
'value' => $model->typeHuman
],
'max_usage_count',
[
'attribute' => 'time_unit_count',
],
[
'attribute' => 'time_unit_type',
'value' => $model->timeUnitHuman
],
'price_brutto',
[
'attribute' => 'id_account',
'value' => $model->accountName,
],
[
'attribute' => 'flag_student',
'value' => ( $model->isStudent() ? Yii::t('common', 'Yes' ) : Yii::t('common', 'No' ) ),
],
[
'attribute' => 'status',
'value' => $model->statusHuman
],
[
'attribute' => 'door_allowed',
'value' => ( $model->isDoor() ? Yii::t('common', 'Yes' ) : Yii::t('common', 'No' ) ),
//'visible' => \common\components\Helper::isTicketTypeDoorAllowedCheckOn()
<?php try {
echo DetailView::widget([
'model' => $model,
'attributes' => [
'name',
[
'attribute' => 'type',
'value' => $model->typeHuman
],
'max_usage_count',
'max_reservation_count',
[
'attribute' => 'time_unit_count',
],
[
'attribute' => 'time_unit_type',
'value' => $model->timeUnitHuman
],
'price_brutto',
[
'attribute' => 'id_account',
'value' => $model->accountName,
],
[
'attribute' => 'flag_student',
'value' => ($model->isStudent() ? Yii::t('common', 'Yes') : Yii::t('common', 'No')),
],
[
'attribute' => 'status',
'value' => $model->statusHuman
],
[
'attribute' => 'door_allowed',
'value' => ($model->isDoor() ? Yii::t('common', 'Yes') : Yii::t('common', 'No')),
//'visible' => \common\components\Helper::isTicketTypeDoorAllowedCheckOn()
],
'created_at:datetime',
'updated_at:datetime',
[
'attribute' => 'installment_enabled',
'value' => ($model->isInstallment() ? Yii::t('common', 'Yes') : Yii::t('common', 'No')),
],
'installment_money',
'installment_count',
],
'created_at:datetime',
'updated_at:datetime',
[
'attribute' => 'installment_enabled',
'value' => ( $model->isInstallment() ? Yii::t('common', 'Yes' ) : Yii::t('common', 'No' ) ),
],
'installment_money',
'installment_count',
],
]) ?>
]);
} catch (Exception $e) {
echo "Failed to render ticket type";
} ?>
</div>

View File

@ -0,0 +1,20 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Trainer */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="trainer-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'active')->checkbox() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('trainer', 'Create') : Yii::t('trainer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,49 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\TrainerSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Keresés</h3>
</div>
<div class="panel-body">
<div class="trainer-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'name') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'phone') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'email') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?php echo $form->field($model, 'active')->dropDownList([
'' => \Yii::t("trainer","All"),
\common\models\Trainer::ACTIVE_OFF => \Yii::t("trainer","active_off"),
\common\models\Trainer::ACTIVE_ON => \Yii::t("trainer","active_on"),
]) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('trainer', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Trainer */
$this->title = Yii::t('trainer', 'Create Trainer');
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="trainer-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,37 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TrainerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('trainer', 'Trainers');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="trainer-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('trainer', 'Create Trainer'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'name',
'phone',
'email:email',
['attribute' => 'active' , 'value' => function ($model){ return \common\models\Trainer::prettyPrintActive($model->active) ;} ],
'created_at:datetime',
'updated_at:datetime',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Trainer */
$this->title = Yii::t('trainer', 'Update Trainer:' ) . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('trainer', 'Update');
?>
<div class="trainer-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,44 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Trainer */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="trainer-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('trainer', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('trainer', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('trainer', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'phone',
'email:email',
[
'attribute' => 'active',
'value' => \common\models\Trainer::prettyPrintActive($model->active)
],
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
php /home/fitnessa/public_html/fitness-web/yii ticket/index
#php /home/fitnessa/public_html/fitness-web/yii ticket/daily
php /home/fitnessa/public_html/fitness-web/yii ticket/daily

View File

@ -1,3 +1,5 @@
-0.1.26
- add group training
-0.1.25
- fix update inactive card
-0.1.24
@ -176,7 +178,7 @@
-0.0.51
- fix storno @transfers -> delete from carts on storno
-0.0.50
- Delete contract on admin
- Delete contract on admin
-0.0.49
- contract - add started_at
- receptions/account-state/mixed
@ -205,7 +207,7 @@
-0.0.41
- add button kulcs "visszaad"
- fix ReceptionFomr#getFirstKey method
- reception read card/key number field : if card with key is read,
- reception read card/key number field : if card with key is read,
then redirect to product/sale
-0.0.40
- fix contract pdf design
@ -247,14 +249,14 @@
-0.0.26
- Fix GiroUzenetsorszam case sensitive class/file name match
-0.0.25
- add reception key changes,
- add money movent storno,
- add reception key changes,
- add money movent storno,
- status displays
- ticket installmetn request, ugiro, beszed, detsta
- ticket installmetn request, ugiro, beszed, detsta
-0.0.24
- add transfer payment_method
-0.0.23
- fix small bugs
- fix small bugs
-0.0.22
- fix product barcode unique on admin site
- When checking ticket, use status = Active
@ -287,7 +289,7 @@
-0.0.14
- add hidden account
- add cart payout/delete per row
-
-
-0.0.13
- add new profile rocho-net
-0.0.12
@ -305,7 +307,7 @@
add rfid_key to card and key
add typeahead to reception product/sale
add admin transaction/summary
fix admin transaction/index
fix admin transaction/index
-0.0.8
fix account state on reception
add keys

View File

@ -8,6 +8,12 @@
namespace common\components;
use DateInterval;
use DateTime;
use DateTimeZone;
use Exception;
use Yii;
use yii\base\InvalidConfigException;
use yii\i18n\Formatter;
class DateUtil
@ -16,12 +22,13 @@ class DateUtil
* Get UTC today @00:00:00 .
* Helper method to generate date for mysql
*
* @return \DateTime
* @return DateTime
* @throws Exception
*/
public static function todayStart( ){
$d2 = new \DateTime();
$d2->setTimezone( new \DateTimeZone( "UTC" ) );
$d2->setTime(0, 0, 0);
$d2 = new DateTime();
$d2->setTimezone( new DateTimeZone('UTC') );
$d2->setTime(0, 0);
return $d2;
}
@ -29,13 +36,14 @@ class DateUtil
* Get UTC t @00:00:00 .
* Helper method to generate date for mysql
*
* @return \DateTime
* @return DateTime
* @throws Exception
*/
public static function tomorrowStart( ){
$d2 = new \DateTime();
$d2->add(new \DateInterval('P1D'));
$d2->setTimezone( new \DateTimeZone( "UTC" ) );
$d2->setTime(0, 0, 0);
$d2 = new DateTime();
$d2->add(new DateInterval('P1D'));
$d2->setTimezone( new DateTimeZone('UTC') );
$d2->setTime(0, 0);
return $d2;
}
@ -44,11 +52,11 @@ class DateUtil
public static function addMonth($timestamp, $monthCount = 1)
{
if ($timestamp instanceof \DateTime) {
if ($timestamp instanceof DateTime) {
$d1 = $timestamp;
} else {
$d1 = new \DateTime();
$d1 = new DateTime();
if (isset($timestamp)) {
$d1->setTimestamp($timestamp);
@ -63,28 +71,34 @@ class DateUtil
$day = $d1->format('d');
$year += floor($monthToAdd / 12);
$monthToAdd = $monthToAdd % 12;
$monthToAdd %= 12;
$month += $monthToAdd;
if ($month > 12) {
$year++;
$month = $month % 12;
if ($month === 0)
$month %= 12;
if ($month === 0) {
$month = 12;
}
}
if (!checkdate($month, $day, $year)) {
$d2 = \DateTime::createFromFormat('Y-n-j', $year . '-' . $month . '-1');
$d2 = DateTime::createFromFormat('Y-n-j', $year . '-' . $month . '-1');
$d2->modify('last day of');
} else {
$d2 = \DateTime::createFromFormat('Y-n-d', $year . '-' . $month . '-' . $day);
$d2 = DateTime::createFromFormat('Y-n-d', $year . '-' . $month . '-' . $day);
}
$d2->setTime(0, 0, 0);
$d2->setTime(0, 0);
return $d2;
}
/**
* @param $dateTimeObject
* @return string
* @throws InvalidConfigException
*/
public static function formatUtc($dateTimeObject)
{
$formatter = new Formatter;
@ -93,6 +107,11 @@ class DateUtil
return $formatter->asDatetime($dateTimeObject);
}
/**
* @param $dateTimeObject
* @return string
* @throws InvalidConfigException
*/
public static function formatDateUtc($dateTimeObject)
{
$formatter = new Formatter;
@ -103,9 +122,27 @@ class DateUtil
public static function parseDate($dateString){
$date = \DateTime::createFromFormat("Y.m.d", $dateString, new \DateTimeZone( 'UTC'));
$date->setTime(0, 0, 0);
$date = DateTime::createFromFormat('Y.m.d', $dateString, new DateTimeZone( 'UTC'));
$date->setTime(0, 0);
return $date;
}
}
/**
* @param integer $weekDay Numeric representation of the day of the week. @See https://www.php.net/manual/en/function.date.php
* @return string
*/
public static function getLocalDayName($weekDay){
$translations = [
0 => Yii::t('common', 'Sunday'),
1 => Yii::t('common', 'Monday'),
2 => Yii::t('common', 'Tuesday'),
3 => Yii::t('common', 'Wednesday'),
4 => Yii::t('common', 'Thursday'),
5 => Yii::t('common', 'Friday'),
6 => Yii::t('common', 'Saturday'),
7 => Yii::t('common', 'Sunday'),
];
return $translations[$weekDay];
}
}

View File

@ -0,0 +1,131 @@
<?php
namespace common\components;
class HttpStatus
{
// const CONTINUE = 100;
const SWITCHING_PROTOCOLS = 101;
const PROCESSING = 102; // RFC2518
const OK = 200;
const CREATED = 201;
const ACCEPTED = 202;
const NON_AUTHORITATIVE_INFORMATION = 203;
const NO_CONTENT = 204;
const RESET_CONTENT = 205;
const PARTIAL_CONTENT = 206;
const MULTI_STATUS = 207; // RFC4918
const ALREADY_REPORTED = 208; // RFC5842
const IM_USED = 226; // RFC3229
const MULTIPLE_CHOICES = 300;
const MOVED_PERMANENTLY = 301;
const FOUND = 302;
const SEE_OTHER = 303;
const NOT_MODIFIED = 304;
const USE_PROXY = 305;
const RESERVED = 306;
const TEMPORARY_REDIRECT = 307;
const PERMANENTLY_REDIRECT = 308; // RFC7238
const BAD_REQUEST = 400;
const UNAUTHORIZED = 401;
const PAYMENT_REQUIRED = 402;
const FORBIDDEN = 403;
const NOT_FOUND = 404;
const METHOD_NOT_ALLOWED = 405;
const NOT_ACCEPTABLE = 406;
const PROXY_AUTHENTICATION_REQUIRED = 407;
const REQUEST_TIMEOUT = 408;
const CONFLICT = 409;
const GONE = 410;
const LENGTH_REQUIRED = 411;
const PRECONDITION_FAILED = 412;
const REQUEST_ENTITY_TOO_LARGE = 413;
const REQUEST_URI_TOO_LONG = 414;
const UNSUPPORTED_MEDIA_TYPE = 415;
const REQUESTED_RANGE_NOT_SATISFIABLE = 416;
const EXPECTATION_FAILED = 417;
const I_AM_A_TEAPOT = 418; // RFC2324
const UNPROCESSABLE_ENTITY = 422; // RFC4918
const LOCKED = 423; // RFC4918
const FAILED_DEPENDENCY = 424; // RFC4918
const RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817
const UPGRADE_REQUIRED = 426; // RFC2817
const PRECONDITION_REQUIRED = 428; // RFC6585
const TOO_MANY_REQUESTS = 429; // RFC6585
const REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
const INTERNAL_SERVER_ERROR = 500;
const NOT_IMPLEMENTED = 501;
const BAD_GATEWAY = 502;
const SERVICE_UNAVAILABLE = 503;
const GATEWAY_TIMEOUT = 504;
const VERSION_NOT_SUPPORTED = 505;
const VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295
const INSUFFICIENT_STORAGE = 507; // RFC4918
const LOOP_DETECTED = 508; // RFC5842
const NOT_EXTENDED = 510; // RFC2774
const NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
}

View File

@ -4,17 +4,18 @@ namespace common\components;
use \Yii;
class RoleDefinition{
public static function roleLabels(){
return [
'reception' => Yii::t('common/role' ,'Reception'),
'admin' => Yii::t('common/role' ,'Administrator'),
'employee' => Yii::t('common/role' ,'Employee'),
'Trainer' => Yii::t('common/role' ,'Edző'),
];
}
public static function getRoleLabel($role){
$result = null;
$roleLabels = self::roleLabels();
@ -23,8 +24,8 @@ class RoleDefinition{
}
return $result;
}
public static function roleDefinitions(){
return [
'employee' => [
@ -38,8 +39,8 @@ class RoleDefinition{
],
];
}
public static function getRoleDefinition($role){
$defs = self::roleDefinitions();
$result = null;
@ -49,14 +50,14 @@ class RoleDefinition{
$result = $defs[$role];
return $result;
}
public static function getRolesCanAllow($role){
$result = [];
$def = self::getRoleDefinition($role);
if ( isset($def)){
$result = $def['canAllow'];
}
return $result;
}
@ -75,11 +76,11 @@ class RoleDefinition{
}
return $result;
}
public static function isAdmin(){
return self::can('admin');
}
public static function isReception(){
return self::can('reception');
}
@ -87,7 +88,16 @@ class RoleDefinition{
public static function isEmployee(){
return self::can('employee');
}
public static function isTrainer(){
return self::can('trainer');
}
public static function isLoggedUser(){
return self::isTrainer() || self::isAdmin() || self::isEmployee()
|| self::isReception();
}
/*
* [
* 'role1' => 'template1',
@ -104,5 +114,5 @@ class RoleDefinition{
}
return $result;
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -3,4 +3,5 @@ Yii::setAlias('common', dirname(__DIR__));
Yii::setAlias('frontend', dirname(dirname(__DIR__)) . '/frontend');
Yii::setAlias('backend', dirname(dirname(__DIR__)) . '/backend');
Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('rest', dirname(dirname(__DIR__)) . '/rest');
Yii::setAlias('rest', dirname(dirname(__DIR__)) . '/rest');
Yii::setAlias('customerapi', dirname(dirname(__DIR__)) . '/customerapi');

View File

@ -5,7 +5,7 @@ return [
'supportEmail' => 'rocho02@gmail.com',
'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.1.25',
'version' => 'v0.1.26',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global
@ -21,7 +21,7 @@ return [
'ugiro_kezdemenyezo_szamlaszam' => '000000000000000',//5860025215371128
'ugiro_kezdemenyezo_azonosito' => 'A25006285',//
//a recepicó kosár csak az aktuális user által kiadott termékeket tartalmazza
//vagy mindent
//vagy mindent
//értékek user|all
// * - user: a felhasználó csak azokat a termékeket látja a kosrába, amiket ő rakott bele
// - all: a felhasználó minden kosrában lévő terméket lát, még azokat is , amiket nem ő rakott bele
@ -38,7 +38,7 @@ return [
'backend_skin' => 'skin-red', //skin-green
/**User cart module on/off*/
'user_cart_on' => true,
/**
/**
* a termék eladás oldalon hol legyen az alaéprtelmezett focus
* a vonalkód mezőn vagy az autocomplete mezőn
barcode | autocomplete */

View File

@ -0,0 +1,25 @@
<?php
use yii\helpers\Html;
use yii\helpers\Url;
use common\components\Helper;
?>
<h1 style="font-size: 12px;">Kedves <?php echo $model->customer->name?>!</h1>
<p style="font-size: 12px;">
Az Ön új jelszava:
</p>
<ul style="font-size: 12px;">
<li>
"<?php echo $model->plainPassword ?>"
</li>
</ul>
<p style="font-size: 12px;">
Üdvözlettel:
</p>
<p style="font-size: 12px;">
<?php echo $model->companyName ?>
</p>
<p>
Ez egy automatikus e-mail üzenet, amelyre nem tud válaszolni.
</p>
<?php
?>

View File

@ -0,0 +1,267 @@
<?php
namespace common\manager;
use common\models\Card;
use common\models\CardEventRegistrationForm;
use common\models\Customer;
use common\models\Event;
use common\models\EventRegistration;
use common\models\Ticket;
use customerapi\models\available\EventInterval;
use customerapi\models\registrations\EventRegistrationAvailable;
use customerapi\models\details\EventRegistrationView;
use Exception;
use Yii;
use yii\base\BaseObject;
use yii\db\ActiveRecord;
use yii\db\Query;
use yii\web\BadRequestHttpException;
use yii\web\NotFoundHttpException;
use yii\web\ServerErrorHttpException;
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.17.
* Time: 6:12
*/
class EventRegistrationManager extends BaseObject
{
const CARD_NOT_FOUND = 1;
const CUSTOMER_NOT_FOUND = 2;
const TICKET_NOT_FOUND = 3;
const NO_FREE_SEATS = 4;
const EVENT_TYPE_NOT_FOUND = 5;
const TICKET_INSUFFICIENT = 6;
const UNKNOWN_ERROR = 7;
const MAX_SEAT_COUNT_EXCEEDED = 8;
const EVENT_UNAVAILABLE = 9;
const ALREADY_REGISTERED = 10;
public static $STATES = [
self::CARD_NOT_FOUND => 'CARD_NOT_FOUND',
self::CUSTOMER_NOT_FOUND => 'CUSTOMER_NOT_FOUND',
self::TICKET_NOT_FOUND => 'TICKET_NOT_FOUND',
self::NO_FREE_SEATS => 'NO_FREE_SEATS',
self::EVENT_TYPE_NOT_FOUND => 'EVENT_TYPE_NOT_FOUND',
self::TICKET_INSUFFICIENT => 'TICKET_INSUFFICIENT',
self::UNKNOWN_ERROR => 'UNKNOWN_ERROR',
self::MAX_SEAT_COUNT_EXCEEDED => 'MAX_SEAT_COUNT_EXCEEDED',
self::EVENT_UNAVAILABLE => 'EVENT_UNAVAILABLE',
self::ALREADY_REGISTERED => 'ALREADY_REGISTERED',
];
/**
* @param CardEventRegistrationForm $cardEventForm
* @throws Exception
*/
public function registerCard($cardEventForm)
{
$db = Yii::$app->db;
$tx = $db->beginTransaction();
try {
if ($cardEventForm->validate()) {
$requiresTicket = false;
/** @var Card $card */
$card = Card::readCard($cardEventForm->card_number, false);
if (!isset($card)) {
throw new NotFoundHttpException('Card not found: ' . $cardEventForm->card_number, self::CARD_NOT_FOUND);
}
if ($card->isFree()) {
throw new NotFoundHttpException('Customer not found', self::CUSTOMER_NOT_FOUND);
}
$activeTickets = $card->getActiveTickets();
if (count($activeTickets) === 0) {
throw new NotFoundHttpException('Ticket not found1', self::TICKET_NOT_FOUND);
}
/** @var Event $event */
$event = Event::find()->andWhere(['id' => $cardEventForm->event_id])->one();
if (!isset($event)) {
throw new NotFoundHttpException('Event not found: ' . $cardEventForm->event_id);
}
if ( isset($event->deleted_at)){
throw new BadRequestHttpException('Event deleted', self::EVENT_UNAVAILABLE);
}
if (!$event->hasFreeSeats()) {
throw new BadRequestHttpException('No free seats', self::NO_FREE_SEATS);
}
$eventType = $event->eventType;
if (!isset($eventType)) {
throw new ServerErrorHttpException('Event type not found', self::EVENT_TYPE_NOT_FOUND);
}
//detect if customer is already registered to event
/** @var EventRegistration[] $registrations */
$registrations = $event->getActiveEventRegistrations()->all();
foreach ($registrations as $registration ){
if ($registration->id_customer == $card->customer->id_customer){
throw new BadRequestHttpException("Already registered", self::ALREADY_REGISTERED);
}
}
$selectedTicket = $eventType->findTicketAllowingEventType($activeTickets);
if (!isset($selectedTicket)) {
throw new NotFoundHttpException('Ticket not found2', self::TICKET_INSUFFICIENT);
}
$selectedTicket->consumeReservationCount(1);
$selectedTicket->save();
$registration = new EventRegistration();
$registration->id_event = $event->id;
$registration->id_card = $card->id_card;
$registration->id_ticket = $selectedTicket->id_ticket;
$registration->id_customer = $card->customer->id_customer;
try {
$registration->save(false);
} catch (\yii\db\Exception $exception) {
throw new ServerErrorHttpException('Failed to save', self::UNKNOWN_ERROR);
}
$cardEventForm->registration = $registration;
}
$tx->commit();
} catch (Exception $exception) {
$tx->rollBack();
throw $exception;
}
}
public function createFindRegistrationsQuery($idEvent)
{
$query = new Query();
$query->select([
'event_registration.id as event_registration_id',
'event_registration.created_at as event_registration_created_at',
'event_registration.canceled_at as event_registration_canceled_at',
'event_registration.deleted_at as event_registration_deleted_at',
'card.id_card as card_id_card',
'card.number as card_number',
'customer.id_customer as customer_id_customer',
'customer.name as customer_name',
'customer.email as customer_email',
]);
$query->from(EventRegistration::tableName());
$query->innerJoin(Event::tableName(), 'event_registration.id_event = event.id');
$query->innerJoin(Card::tableName(), 'event_registration.id_card = card.id_card');
$query->innerJoin(Customer::tableName(), 'customer.id_customer_card = card.id_card');
$query->andWhere(['event_registration.id_event' => $idEvent]);
return $query;
}
/**
* @param $idRegistration
* @return array|EventRegistration|ActiveRecord|null
* @throws NotFoundHttpException
*/
public function loadRegistration($idRegistration)
{
$registration = EventRegistration::find()->andWhere(['id' => $idRegistration])->one();
if ( $registration === null) {
throw new NotFoundHttpException('The requested registration does not exist.');
}
return $registration;
}
/**
* @param EventRegistration $registration
* @throws ServerErrorHttpException
*/
public function cancelRegistration($registration)
{
if (isset($registration->canceled_at)) {
throw new ServerErrorHttpException('The registration is already canceled');
}
if (isset($registration->deleted_at)) {
throw new ServerErrorHttpException('The reservation is already deleted');
}
$registration->canceled_at = date('Y-m-d H:i:s');
$registration->save(false);
}
/**
* @param EventRegistration $registration
* @return bool
* @throws \yii\base\Exception
*/
public function deleteRegistration($registration)
{
if (isset($registration->deleted_at)) {
return false;
}
// $ticket = Ticket::findOne(['id_ticket' => $registration->id_ticket]);
// if( !isset($ticket ) ) {
// throw new \yii\base\Exception('Ticket not found: ' . $registration->id_ticket);
// }
//
// $ticket->restoreReservationCount(1);
// $ticket->save(false);
$registration->deleted_at = date('Y-m-d H:i:s');
return $registration->save(false);
}
/**
* Delete an event
* @param Event $event
* @throws Exception
* @throws Throwable
*/
public function deleteEvent($event)
{
$db = Yii::$app->db;
$tx = $db->beginTransaction();
try {
$registrations = $event->getEventRegistrations()->all();
// ////////////////////////////////
// if event has no registrations
// we can simply delete it from db
// ////////////////////////////////
if ( count($registrations) === 0 ) {
$event->delete();
} else {
// /////////////////////////////
// otherwise we mark the event deleted
// and we have to delete the registrations
// /////////////////////////////
$event->deleted_at = date('Y-m-d H:i:s');
$event->save(false);
foreach ($registrations as $registration) {
if (!isset($registration->deleted_at)) {
/** @var EventRegistration $registration */
$this->deleteRegistration($registration);
}
}
}
$tx->commit();
} catch (Exception $e) {
$tx->rollBack();
throw $e;
}
}
}

View 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: ",
];

View File

@ -29,7 +29,7 @@ return [
'Inactive' => 'Inaktív',
'Invalid account (inactive)!' => 'Érvénytelen kassza (inaktív)!',
'Invalid account!' => 'Érvénytelen kassza!',
'Max Usage Count' => 'Akalmak',
'Max Usage Count' => 'Belépések száma (f. villa)',
'Month' => 'Hónap',
'Name' => 'Név',
'Normal' => 'Normál',
@ -45,4 +45,5 @@ return [
'Type' => 'Típus',
'Update' => 'Módosítás',
'Updated At' => 'Módosítás ideje',
'Max Reservation Count' => 'Foglalások száma (csop. edzés)',
];

View File

@ -0,0 +1,32 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.06.
* Time: 7:55
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Seat Count' => 'Férőhelyek száma',
'Create Event Registration' => 'Új regisztráció',
'Update Event Registration:' => 'Regisztráció módosítása:',
'Event Registrations' => 'Regisztrációk',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'All' => 'Mind',
'Unknown Error' => "Ismeretlen Hiba",
'CARD_NOT_FOUND' => 'Kártya nem található',
'CUSTOMER_NOT_FOUND' => 'Vendég nem található',
'TICKET_NOT_FOUND' => 'Nincs aktív bérlet',
'NO_FREE_SEATS' => 'Nincs szabad hely',
'EVENT_TYPE_NOT_FOUND' => 'Az esemény típusa ismereten',
'TICKET_INSUFFICIENT' => 'Nem található az eseményre jogosító aktív bérlet',
];

View File

@ -0,0 +1,24 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.06.
* Time: 7:55
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Create Event Type' => 'Új esemény Típus',
'Update Event Type:' => 'Esemény Típus adatainak módosítása:',
'Event Types' => 'Esemény Típusok',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'All' => 'Mind',
];

View File

@ -0,0 +1,50 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.06.
* Time: 7:55
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Seat Count' => 'Férőhelyek száma',
'Create Event' => 'Új esemény',
'Update Event:' => 'Esemény adatainak módosítása:',
'Events' => 'Események',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'All' => 'Mind',
'Start' => 'Esemény kezdete',
'End' => 'Esemény vége',
'Room Name' => 'Terem',
'Trainer Name' => 'Edző',
'Event start' => 'Esemény Kezdete',
'Event end' => 'Esemény vége',
'Id Room' => 'Terem',
'Id Trainer' => 'Edző',
'Id Event Type' => 'Esemény Típus',
'Registration Count' => 'Résztvevők',
'Card Number' => 'Kártyaszám',
'Customer Name' => 'Vendég Neve',
'Customer Email' => 'Vendég E-Mail címe',
'Canceled At' => 'Sztornó dátum, idő',
'Register' => 'Regisztráció',
'Event Registration Created At' => 'Regisztráció dátum, idő',
'Event Registration Count' => 'Foglalások száma',
'Open Seat Count' => 'Szabad helyek száma',
'Cancel' => 'Lemond',
'Deleted At' => 'Törlés dátum, idő',
'Are you sure you want to cancel this item? Usage count won\'t be restored!' => 'Biztos benne, hogy lemondja ezt az foglalást? A foglalás nem kerül vissza a bérletre!',
'Are you sure you want to delete this item? Usage count will be restored!' => 'Biztos benne, hogy törli ezt az foglalást? A foglalás vissza fog kerülni a bérletre!',
'Reservation' => 'Foglalás',
'Event Details' => "Esemény részletei"
];

View File

@ -0,0 +1,25 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.06.
* Time: 7:55
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Seat Count' => 'Férőhelyek száma',
'Create Room' => 'Új terem',
'Update Room:' => 'Terem adatainak módosítása:',
'Rooms' => 'Termek',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'All' => 'Mind',
];

View File

@ -0,0 +1,38 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yii message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Phone' => 'Telefon',
'Email' => 'E-Mail',
'Password' => 'Jelszó',
'Active' => 'Aktív',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Create Trainer' => 'Új edző',
'Trainers' => 'Edzők',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'active_on' => 'Aktív',
'active_off' => 'Inaktív',
'Update Trainer:' => 'Edző adatainak módosítása:',
'All' => 'Mind',
];

View File

@ -24,7 +24,7 @@ use common\components\Helper;
*/
class Card extends \common\models\BaseFitnessActiveRecord
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
const STATUS_INACTIVE = 20;
@ -34,8 +34,8 @@ class Card extends \common\models\BaseFitnessActiveRecord
const TYPE_BARCODE = 30;
const TYPE_OLD = 40;
const TYPE_EMPLOYEE = 50;
public static $FLAG_TICKET = 0; //has valid ticket
public static $FLAG_DOOR = 1; //door in/out order
public static $FLAG_KEY = 2; //key status
@ -121,8 +121,8 @@ class Card extends \common\models\BaseFitnessActiveRecord
'updated_at' => Yii::t('common/card', 'Updated At'),
];
}
public function validateAscii($attribute, /** @noinspection PhpUnusedParameterInspection */
$params){
if ( !$this->hasErrors($this->$attribute)){
@ -131,7 +131,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
Yii::info(" $attribute converted to: " . $this->$attribute);
}
}
static function statuses() {
/** @noinspection PhpUndefinedClassInspection */
return [
@ -140,7 +140,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
self::STATUS_INACTIVE => 'Inaktív',
];
}
public function getStatusHuman(){
$result = null;
$s = self::statuses();
@ -155,7 +155,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
public static function toTypeName($type , $def = ""){
return Helper::getArrayValue(self::types(), $type, $def);
}
static function types() {
/** @noinspection PhpUndefinedClassInspection */
return [
@ -166,7 +166,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
self::TYPE_EMPLOYEE => Yii::t('common/card', 'Munkatárs'),
];
}
public function getTypeHuman(){
$result = null;
$s = self::types();
@ -175,20 +175,24 @@ class Card extends \common\models\BaseFitnessActiveRecord
}
return $result;
}
public function isInactive(){
return $this->status == self::STATUS_DELETED;
}
/**
* Load card from the DB , where the number equals with card number or RFID number
* @param number|string $number the card number or the RFID number
* @param null|boolean $free optional. if set, append free or not free condition.
* @return \common\models\Card|null the card or null, if not found with given conditions
*/
public static function readCard($number,$free = null){
$card = null;
$query = Card::find()
->leftJoin(Customer::tableName(), 'card.id_card = customer.id_customer_card ' );
// ->andWhere(['number'=>$number ]);
Card::addCardNumberCondition($query, $number);
if ( isset($free) ){
if ( $free == true){
$query->andWhere('customer.id_customer is null');
@ -196,20 +200,20 @@ class Card extends \common\models\BaseFitnessActiveRecord
$query->andWhere('customer.id_customer is not null');
}
}
$cards = $query->all();
if ( count($cards) == 1){
$card = $cards[0];
}
return $card;
}
public function getCustomer(){
return $this->hasOne(Customer::className(), ['id_customer_card' => 'id_card']);
}
public function getCustomerName(){
$name = null;
if ( $this->customer != null){
@ -232,7 +236,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
['and', ['in',$field_rfid_key ,[ $number ] ],"trim(coalesce(card.rfid_key, '')) <>'' "],
]);
}
public static function updateCardFlagTicket($id){
if ( !isset($id)){
return ;
@ -255,7 +259,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
}
}
public function beforeSave($insert) {
if (parent::beforeSave($insert)){
$this->flag = Helper::setBit( $this->flag , Card::$FLAG_STATUS, ( $this->status != Card::STATUS_ACTIVE ) );
@ -263,8 +267,8 @@ class Card extends \common\models\BaseFitnessActiveRecord
}
return false;
}
public function getFlagText(){
return Helper::getArrayValue(DoorLog::getCardFlagTexts(), $this->validity, "Ismeretlen");
}
@ -317,4 +321,12 @@ class Card extends \common\models\BaseFitnessActiveRecord
\Yii::$app->db->createCommand(self::$SQL_UPDATE_FLAG_STATUS_ACTIVE)->execute();
}
public function isFree(){
return !isset($this->customer);
}
public function getActiveTickets(){
return Ticket::readActive($this);
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace common\models;
use common\components\Helper;
use yii\base\Model;
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.17.
* Time: 6:14
*/
class CardEventRegistrationForm extends Model
{
public $card_number;
public $event_id;
public $registration;
public function rules()
{
return [
[['card_number'], 'required' ],
[['card_number'], 'validateFormat' ]
];
}
public function validateFormat(){
$this->card_number = Helper::fixAsciiChars( $this->card_number );
}
public function getIsNewRecord(){
return true;
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'card_number' => \Yii::t('event', 'Card Number'),
];
}
}

View File

@ -123,13 +123,20 @@ class Collection extends \common\models\BaseFitnessActiveRecord
return $result;
}
/**
*
* */
*
* @param string $mode
* @param $start
* @param $end
* @param $idUser
* @param $types
* @param $idAccount
* @return Query
*/
public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$types,$idAccount){
$query = new Query();
$query->innerJoin("account",'account.id_account = collection.id_account' );
@ -168,7 +175,7 @@ public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$ty
}
public static function mkTotalsResultWithAllAvailableAccount($queryResult,$accounts,$accountMap,$idAccount){
public static function mkTotalsResultWithAllAvailableAccount($queryResult,$accounts,$idAccount){
$totals = [];
$totals['total'] = 0;
@ -228,7 +235,7 @@ public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$ty
public static function mkReceptionTotal( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap){
$result = [];
$queryResult = self::exTotalQuery('reception', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $accountMap, $idAccount);
$result = self::mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $idAccount);
return $result;
}
}

View File

@ -59,7 +59,7 @@ class CollectionCreate extends \common\models\Collection
if (parent::beforeSave($insert)) {
$this->id_user = Yii::$app->user->id;
$this->created_by = Yii::$app->user->id;
$paidAt = Transfer::mkPaidAtTotals($this->timestampStart, $this->timestampEnd, $this->user->id, null, $this->account->id_account, $this->accounts, $this->accountMap);
$paidAt = Transfer::mkPaidAtTotals($this->timestampStart, $this->timestampEnd, $this->user->id, null, $this->account->id_account, $this->accounts );
$this->money = $paidAt['total'];
return true;
} else {

View File

@ -19,6 +19,7 @@ use common\components\Helper;
* @property integer $part_count
* @property integer $part_required
* @property integer $id_ticket_type
* @property integer $id_discount
* @property string $expired_at
* @property string $created_at
* @property string $updated_at

View File

@ -1,7 +1,12 @@
<?php
namespace common\models;
use common\components\Helper;
use Yii;
use yii\base\Exception;
use yii\base\InvalidConfigException;
use yii\base\NotSupportedException;
use yii\web\IdentityInterface;
/**
* This is the model class for table "customer".
@ -33,23 +38,26 @@ use Yii;
* @property integer towel_count
* @property \common\models\User user
* @property mixed bank_account
* @property string password_plain
* @property string password_hash
* @property string auth_key
*/
class Customer extends BaseFitnessActiveRecord
class Customer extends BaseFitnessActiveRecord implements IdentityInterface
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
const SEX_UNKNOWN = 0;
const SEX_MAN = 10;
const SEX_WOMAN = 20;
public static $ENABLED = 1;
public $photo_data;
/**
* @inheritdoc
*/
@ -57,7 +65,7 @@ class Customer extends BaseFitnessActiveRecord
{
return 'customer';
}
/**
* @inheritdoc
@ -109,16 +117,16 @@ class Customer extends BaseFitnessActiveRecord
'birth_place' => Yii::t('common/customer', 'Születési hely'),
];
}
static function statuses() {
return [
self::STATUS_ACTIVE => Yii::t('common/account', 'Active'),
self::STATUS_DELETED => Yii::t('common/account', 'Inactive'),
];
}
public function getStatusHuman(){
$result = null;
$s = self::statuses( );
@ -127,7 +135,7 @@ class Customer extends BaseFitnessActiveRecord
}
return $result;
}
static function sexes() {
return [
self::SEX_UNKNOWN => Yii::t('common/customer', 'Unknown sex'),
@ -135,7 +143,7 @@ class Customer extends BaseFitnessActiveRecord
self::SEX_WOMAN => Yii::t('common/customer', 'Woman'),
];
}
public function getSexHuman(){
$result = null;
$s = self::sexes( );
@ -144,12 +152,12 @@ class Customer extends BaseFitnessActiveRecord
}
return $result;
}
public function isInactive(){
return $this->status == self::STATUS_DELETED;
}
public function getCard(){
return $this->hasOne ( Card::className (), [
'id_card' => 'id_customer_card'
@ -165,7 +173,7 @@ class Customer extends BaseFitnessActiveRecord
'id_image' => 'id_image'
] );
}
public function getCustomerCardNumber(){
$result = null;
$card = $this->card;
@ -182,23 +190,153 @@ class Customer extends BaseFitnessActiveRecord
}
return $result;
}
public function getFullAddress(){
$zip = $this->zip;
$city = $this->city;
$address = $this->address;
$result = $zip . " " .$city . ", ". $address;
return $result;
}
public function afterSave($insert, $changedAttributes){
if ( !$insert ){
Card::updateCardFlagTicket($this->id_customer_card);
}
}
/**
* Finds an identity by the given ID.
* @param string|integer $id the ID to be looked for
* @return Customer
* Null should be returned if such an identity cannot be found
* or the identity is not in an active state (disabled, deleted, etc.)
*/
public static function findIdentity($id)
{
return self::findOne(['email' => $id]);
}
/**
* Finds an identity by the given token.
* @param mixed $token the token to be looked for
* @param mixed $type the type of the token. The value of this parameter depends on the implementation.
* For example, [[\yii\filters\auth\HttpBearerAuth]] will set this parameter to be `yii\filters\auth\HttpBearerAuth`.
* @return void the identity object that matches the given token.
* Null should be returned if such an identity cannot be found
* or the identity is not in an active state (disabled, deleted, etc.)
* @throws NotSupportedException
*/
public static function findIdentityByAccessToken($token, $type = null)
{
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
}
/**
* Returns an ID that can uniquely identify a user identity.
* @return string|integer an ID that uniquely identifies a user identity.
*/
public function getId()
{
return $this->id_customer;
}
/**
* Returns a key that can be used to check the validity of a given identity ID.
*
* The key should be unique for each individual user, and should be persistent
* so that it can be used to check the validity of the user identity.
*
* The space of such keys should be big enough to defeat potential identity attacks.
*
* This is required if [[User::enableAutoLogin]] is enabled.
* @return string a key that is used to check the validity of a given identity ID.
* @see validateAuthKey()
*/
public function getAuthKey()
{
// todo: add authkey to customer
}
/**
* Validates the given auth key.
*
* This is required if [[User::enableAutoLogin]] is enabled.
* @param string $authKey the given auth key
* @return boolean whether the given auth key is valid.
* @see getAuthKey()
*/
public function validateAuthKey($authKey)
{
return $this->getAuthKey() === $authKey;
}
/**
* @param $password
* @return bool
* @throws \yii\base\InvalidConfigException
*/
public function validatePassword($password)
{
return Yii::$app->security->validatePassword($password, $this->password_hash);
}
/**
* Generates password hash from password and sets it to the model
*
* @param string $password
* @throws Exception
* @throws \yii\base\InvalidConfigException
*/
public function setPassword($password)
{
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
// \Yii::info("pwd", $this->password_hash);
// echo $this->password_hash;
}
/**
* Generates "remember me" authentication key
* @throws InvalidConfigException if OpenSSL extension is needed but not installed.*@throws \yii\base\Exception
* @throws Exception
*/
public function generateAuthKey()
{
$this->auth_key = Yii::$app->security->generateRandomString();
}
/**
* Generates new password reset token
*/
public function generatePasswordResetToken()
{
$this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
}
/**
* Removes password reset token
*/
public function removePasswordResetToken()
{
$this->password_reset_token = null;
}
/**
* @throws InvalidConfigException
* @throws Exception
*/
public function setDefaultPassword(){
$hasEmail = isset($this->email) && $this->email !== '';
$hasBirthday = isset($this->birthdate) ;
if ( $hasEmail && $hasBirthday){
$customerBirthDate = new \DateTime($this->birthdate);
$this->setPassword($customerBirthDate->format('Ymd'));
}
}
}

242
common/models/Event.php Normal file
View File

@ -0,0 +1,242 @@
<?php
namespace common\models;
use customerapi\models\details\EventEquipmentTypeAssignmentView;
use DateTime;
use DateTimeZone;
use Exception;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "event".
*
* @property integer $id
* @property integer $start
* @property integer $end
* @property integer $id_room
* @property integer $id_trainer
* @property integer $id_event_type
* @property integer $seat_count
* @property string $created_at
* @property string $updated_at
* @property string $deleted_at
* @property integer $active
* @property EventType $eventType
* @property Trainer $trainer
* @property Room $room
* @property EventRegistration[] $eventRegistrations
*/
class Event extends ActiveRecord
{
public $startDateString;
public $endDateString;
public $timestampStart;
public $timestampEnd;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['startDateString',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'start', 'timeZone' => 'UTC'],
[['endDateString',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'end' , 'timeZone' => 'UTC'],
[['id_trainer','id_room', 'id_event_type','seat_count'], 'required'],
[['id_trainer','id_room', 'id_event_type','seat_count'], 'integer'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('event', 'ID'),
'start' => Yii::t('event', 'Start'),
'end' => Yii::t('event', 'End'),
'id_room' => Yii::t('event', 'Id Room'),
'id_trainer' => Yii::t('event', 'Id Trainer'),
'id_event_type' => Yii::t('event', 'Id Event Type'),
'created_at' => Yii::t('event', 'Created At'),
'updated_at' => Yii::t('event', 'Updated At'),
'deleted_at' => Yii::t('event', 'Deleted At'),
'trainerName' => Yii::t('event', 'Trainer Name'),
'roomName' => Yii::t('event', 'Room Name'),
'eventTypeName' => Yii::t('event', 'Típus'),
'event_start' => Yii::t('event', 'Start'),
'event_end' => Yii::t('event', 'End'),
'startDateString' => Yii::t('event', 'Start'),
'endDateString' => Yii::t('event', 'End'),
'status' => Yii::t('event', 'Status'),
'seat_count' => Yii::t('event', 'Seat Count'),
'eventRegistrationCount' => Yii::t('event', 'Event Registration Count'),
'openSeatCount' => Yii::t('event', 'Open Seat Count'),
];
}
/**
* @throws Exception
*/
public function afterFind()
{
parent::afterFind(); // TODO: Change the autogenerated stub
$format = 'Y.m.d H:i';
$date = new DateTime();
$date->setTimestamp($this->start);
$date->setTimezone(new DateTimeZone('UTC'));
$this->startDateString = $date->format($format);
$date->setTimestamp($this->end);
$this->endDateString = $date->format($format);
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::class,
'value' => static function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
/** @noinspection PhpUnused */
public function getEventType(){
return $this->hasOne($this->getEventTypeClass(),['id' => 'id_event_type']);
}
/** @noinspection PhpUnused */
public function getTrainer(){
return $this->hasOne($this->getTrainerClass(),['id' => 'id_trainer']);
}/** @noinspection PhpUnused */
/**
* @return Room|ActiveQuery
*/
public function getRoom() {
return $this->hasOne($this->getRoomClass(),['id' => 'id_room']);
}/** @noinspection PhpUnused */
/**
* @return Card|ActiveQuery
*/
public function getCard() {
return $this->hasOne(Card::class,['id_card' => 'id_card']);
}
/**
* @return EventRegistration[]|ActiveQuery
*/
public function getEventRegistrations(){
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
*/
public function getActiveEventRegistrations(){
return $this->hasMany(EventRegistration::class,['id_event' => 'id'])->andWhere(
[
'event_registration.canceled_at' => null,
'event_registration.deleted_at' => null,
]
);
}
/**
* @return EventRegistration[]|ActiveQuery
*/
public function getActiveEventRegistrationsForCustomer(){
return $this->hasMany(EventRegistration::class,['id_event' => 'id'])->andWhere(
[
'event_registration.canceled_at' => null,
'event_registration.deleted_at' => null,
'event_registration.id_customer' => \Yii::$app->user->id
]
);
}
/**
* @return integer
*/
public function getEventRegistrationCount(){
return count($this->getActiveEventRegistrations()->all());
}
protected function getEquipmentTypeAssignmentsClass()
{
return EventEquipmentTypeAssignment::class;
}
/** @noinspection PhpUnused */
public function getOpenSeatCount(){
return $this->seat_count - $this->getEventRegistrationCount();
}
public function hasFreeSeats(){
$registrationCount = count($this->eventRegistrations) ;
$seatCount = $this->seat_count;
if ( !isset($seatCount ) || $seatCount === 0){
$seatCount = PHP_INT_MAX;
}
return $registrationCount < $seatCount ;
}
public function canReserve(){
if ( isset($this->deleted_at)){
return false;
}
if ( !$this->hasFreeSeats()){
return false;
}
return true;
}
public function canDelete(){
if ( isset($this->deleted_at)){
return false;
}
return true;
}
protected function getTrainerClass(){
return Trainer::class;
}
protected function getEventTypeClass(){
return EventType::class;
}
protected function getRoomClass(){
return Room::class;
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "event_equipment_type".
*
* @property integer $id
* @property string $name
* @property string $created_at
* @property string $updated_at
*
* @property EventEquipmentTypeAssignment[] $eventEquipmentTypeAssignments
* @property EventRegistrationEquipmentTypeAssignment[] $eventRegistrationEquipmentTypeAssignments
*/
class EventEquipmentType extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event_equipment_type';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name'], 'required'],
[['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
*/
public function attributeLabels()
{
return [
'id' => Yii::t('common/event-equipment-type', 'ID'),
'name' => Yii::t('common/event-equipment-type', 'Name'),
'created_at' => Yii::t('common/event-equipment-type', 'Created At'),
'updated_at' => Yii::t('common/event-equipment-type', 'Updated At'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getEventEquipmentTypeAssignments()
{
return $this->hasMany(EventEquipmentTypeAssignment::className(), ['id_event_equipment_type' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getEventRegistrationEquipmentTypeAssignments()
{
return $this->hasMany(EventRegistrationEquipmentTypeAssignment::className(), ['id_event_equipment_type' => 'id']);
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "event_equipment_type_assignment".
*
* @property integer $id
* @property integer $id_event
* @property integer $id_event_equipment_type
* @property integer $count
* @property string $created_at
* @property string $updated_at
*
* @property Event $idEvent
* @property EventEquipmentType $idEventEquipmentType
*/
class EventEquipmentTypeAssignment extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event_equipment_type_assignment';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_event', 'id_event_equipment_type', 'count'], 'integer'],
[['created_at', 'updated_at'], 'required'],
[['created_at', 'updated_at'], 'safe']
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('common/event', 'ID'),
'id_event' => Yii::t('common/event', 'Id Event'),
'id_event_equipment_type' => Yii::t('common/event', 'Id Event Equipment Type'),
'count' => Yii::t('common/event', 'Count'),
'created_at' => Yii::t('common/event', 'Created At'),
'updated_at' => Yii::t('common/event', 'Updated At'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getEvent()
{
return $this->hasOne(Event::className(), ['id' => 'id_event']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getEventEquipmentType()
{
return $this->hasOne(EventEquipmentType::className(), ['id' => 'id_event_equipment_type']);
}
}

View File

@ -0,0 +1,138 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "event_registration".
*
* @property integer $id
* @property integer $id_event
* @property integer $id_customer
* @property integer $id_card
* @property integer $id_ticket
* @property string $created_at
* @property string $updated_at
* @property string $canceled_at
* @property string $deleted_at
*/
class EventRegistration extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event_registration';
}
/**
* @inheritdocd
*/
public function rules()
{
return [
[['id_event', 'id_customer'], 'integer'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('event-registration', 'ID'),
'id_event' => Yii::t('event-registration', 'Id Event'),
'id_customer' => Yii::t('event-registration', 'Id Customer'),
'created_at' => Yii::t('event-registration', 'Created At'),
'updated_at' => Yii::t('event-registration', 'Updated At'),
'canceled_at' => Yii::t('event-registration', 'Canceled At'),
'deleted_at' => Yii::t('event-registration', 'Deleted At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public function getEvent(){
return $this->hasOne($this->getEventClass(),['id' => 'id_event']);
}
public function getCustomer(){
return $this->hasOne($this->getCustomerClass(),['id' => 'id_customer']);
}
public function getEventClass(){
return Event::class;
}
public function getCustomerClass(){
return Customer::class;
}
/**
* @param EventRegistration $eventRegistration
*/
public static function isActive($eventRegistration){
if ( !isset($eventRegistration ) ){
return false;
}
if ( isset($eventRegistration->canceled_at ) ){
return false;
}
if ( isset($eventRegistration->deleted_at ) ){
return false;
}
return true;
}
/**
* @param EventRegistration $eventRegistration
*/
public static function isForCustomer($eventRegistration,$idCustomer){
if ( !isset($eventRegistration ) ){
return false;
}
if ( !isset($eventRegistration->id_customer ) ){
return false;
}
return $eventRegistration->id_customer == $idCustomer;
}
/**
* @param EventRegistration[] $eventRegistrations
*/
public static function filterActive($eventRegistrations){
return array_filter($eventRegistrations, EventRegistration::class.'::isActive' );
}
/**
* @param EventRegistration[] $eventRegistrations
*/
public static function filterForCustomer($eventRegistrations,$idCustomer){
$result = [];
foreach ($eventRegistrations as $eventRegistration){
if ( EventRegistration::isForCustomer($eventRegistration,$idCustomer)){
$result[] = $eventRegistration;
}
}
return $result;
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "event_registration_equipment_type_assignment".
*
* @property integer $id
* @property integer $id_event_equipment_type
* @property integer $id_event_registration
* @property string $created_at
* @property string $updated_at
*
* @property EventRegistration $idEventRegistration
* @property EventEquipmentType $idEventEquipmentType
*/
class EventRegistrationEquipmentTypeAssignment extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event_registration_equipment_type_assignment';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_event_equipment_type', 'id_event_registration'], 'integer'],
[['created_at', 'updated_at'], 'required'],
[['created_at', 'updated_at'], 'safe']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('common/event', 'ID'),
'id_event_equipment_type' => Yii::t('common/event', 'Id Event Equipment Type'),
'id_event_registration' => Yii::t('common/event', 'Id Event Registration'),
'created_at' => Yii::t('common/event', 'Created At'),
'updated_at' => Yii::t('common/event', 'Updated At'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getIdEventRegistration()
{
return $this->hasOne(EventRegistration::className(), ['id' => 'id_event_registration']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getIdEventEquipmentType()
{
return $this->hasOne(EventEquipmentType::className(), ['id' => 'id_event_equipment_type']);
}
}

107
common/models/EventType.php Normal file
View File

@ -0,0 +1,107 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "event_type".
*
* @property integer $id
* @property string $name
* @property string $created_at
* @property string $updated_at
*/
class EventType extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event_type';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name'], 'required'],
[['name'], 'unique'],
[['name'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('event-type', 'ID'),
'name' => Yii::t('event-type', 'Name'),
'created_at' => Yii::t('event-type', 'Created At'),
'updated_at' => Yii::t('event-type', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public function asOptions(){
$items = ArrayHelper::map(EventType::find()->all(),'id','name');
return ArrayHelper::merge(['' => \Yii::t('event-type','All')],$items);
}
public static function eventTypeOptions($all = false, $emptyString = false){
$items = ArrayHelper::map(EventType::find()->all(),'id','name');
$extra = [];
if ( $all ) {
$extra = ['' => \Yii::t('event-type','All')];
}
if ( $emptyString ) {
$extra = ['' => '' ];
}
return ArrayHelper::merge($extra,$items);
}
/**
* Find the first ticket, which allows this event type
* @param \common\models\Ticket[] $tickets the list of active tickets
* @return Ticket|null
*/
public function findTicketAllowingEventType($tickets){
if (!isset($tickets)){
return null;
}
if ( sizeof($tickets) == 0 ){
return null;
}
$possibleTickets = [];
foreach ($tickets as $ticket ){
if ( $ticket->hasOpenReservationCount() ){
$possibleTickets[] = $ticket;
}
}
if ( sizeof($possibleTickets) == 0 ){
return null;
}
// TODO: implement bossiness logic to select ticket
return $possibleTickets[0];
}
}

83
common/models/Room.php Normal file
View File

@ -0,0 +1,83 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "room".
*
* @property integer $id
* @property string $name
* @property integer $seat_count
* @property string $created_at
* @property string $updated_at
*/
class Room extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'room';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'seat_count'], 'required'],
[['seat_count'], 'integer'],
[['name'], 'unique'],
[['name'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('room', 'ID'),
'name' => Yii::t('room', 'Name'),
'seat_count' => Yii::t('room', 'Seat Count'),
'created_at' => Yii::t('room', 'Created At'),
'updated_at' => Yii::t('room', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public function asOptions(){
$items = ArrayHelper::map(Room::find()->all(),'id','name');
return ArrayHelper::merge(['' => \Yii::t('event-type','All')],$items);
}
public static function roomOptions($all = false, $emtpyString = false){
$items = ArrayHelper::map(Room::find()->all(),'id','name');
$extra = [];
if ( $all ) {
$extra = ['' => \Yii::t('room','All')];
}
if ( $emtpyString ) {
$extra = ['' => '' ];
}
return ArrayHelper::merge($extra,$items);
}
}

View File

@ -2,10 +2,12 @@
namespace common\models;
use common\manager\EventRegistrationManager;
use Yii;
use yii\db\Query;
use yii\db\Expression;
use common\components\Helper;
use yii\web\HttpException;
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
@ -33,6 +35,8 @@ use common\components\Helper;
* @property int id_contract
* @property integer $original_price
* @property string $original_end;
* @property integer $reservation_count
* @property integer $max_reservation_count
*
* @property \common\models\Card card
* @property \common\models\Ticket transfer
@ -44,7 +48,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
const STATUS_INACTIVE = 20;
public static $SQL_UPDATE = "UPDATE card as c1
left JOIN ( select ticket.id_card as id_card , max(ticket.id_ticket) as id_ticket
from ticket
@ -64,7 +68,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
, c1.flag = case when c1.type = 50 then ( c1.flag & ~(1 << 0) ) when t.id_card is null then ( c1.flag | 1 << 0 ) else ( c1.flag & ~(1 << 0) ) end
, c1.id_ticket_current = case when t.id_ticket is null then null else t.id_ticket end
where c1.status = 10";
public static $SQL_UPDATE_CARD = "UPDATE card as c1
left JOIN ( select ticket.id_card as id_card , max(ticket.id_ticket) as id_ticket
from ticket
@ -137,11 +141,11 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
[['start', 'end', 'created_at', 'updated_at'], 'safe'],
[['comment'], 'required'],
[['comment'], 'string', 'max' => 255],
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
];
}
@ -172,12 +176,12 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
'original_end' => Yii::t('common/transfer', 'Eredeti érvényesség vége'),
];
}
public function getCard(){
return $this->hasOne( Card::className(), ["id_card" =>"id_card" ] );
}
public function getContract(){
return $this->hasOne( Contract::className(), ["id_contract" =>"id_contract" ] );
}
@ -185,7 +189,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
public function getTransfer(){
return $this->hasOne( Transfer::className(), ["id_object" =>"id_ticket"] )->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
}
public function getCardNumber(){
$result = "";
/** @noinspection PhpUndefinedFieldInspection */
@ -195,11 +199,11 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
}
return $result;
}
public function getCustomer(){
return $this->hasOne( Customer::className(), ["id_customer_card" =>"id_card" ] )->via('card');
}
public function getCustomerName(){
$result = "";
/** @noinspection PhpUndefinedFieldInspection */
@ -213,14 +217,14 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
public function getUser(){
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
}
public function getTicketType(){
return $this->hasOne( TicketType::className(), ["id_ticket_type" =>"id_ticket_type" ] );
}
public function getDiscount(){
return $this->hasOne( Discount::className(), ["id_discount" =>"id_discount" ] );
}
public function getAccount() {
return $this->hasOne ( Account::className (), [
'id_account' => 'id_account'
@ -273,10 +277,10 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
* @return array|\yii\db\ActiveRecord[]
*/
public static function readActive($card, $validOnDay = null){
if ( $card == null )
return [];
$query = Ticket::find();
if (!isset( $validOnDay ) ){
$today = date('Y-m-d');
@ -288,11 +292,11 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
$query->andWhere( 'ticket.start <= :today' ,[ 'today' => $today] );
$query->andWhere( 'ticket.end >= :today' ,[ 'today' => $today] );
$query->andWhere( 'ticket.status = :status' ,[ 'status' => Ticket::STATUS_ACTIVE] );
$query->orderBy([ "ticket.created_at" =>SORT_DESC] );
$query->orderBy([ "ticket.created_at" =>SORT_DESC] );
$result = $query->all();
return $result;
}
/**
@ -301,10 +305,10 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
* @return array|\yii\db\ActiveRecord[]
*/
public static function readUnpaid($card){
if ( $card == null )
return [];
$query = Ticket::find();
$query->innerJoin("transfer", "transfer.id_object = ticket.id_ticket ");
$today = date('Y-m-d');
@ -316,39 +320,39 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
$query->andWhere( ["transfer.type" => Transfer::TYPE_TICKET] );
$query->andWhere( [ "transfer.status" => Transfer::STATUS_NOT_PAID ]);
$query->orderBy([ "ticket.created_at" =>SORT_DESC] );
$result = $query->all();
return $result;
}
public static function mkStatisticQuery($start,$end,$id_card = null){
$query = new Query();
$query->addSelect( [
new Expression( 'ticket_type.id_ticket_type as id'),
new Expression( 'ticket_type.name as name'),
new Expression( 'coalesce( count(ticket.id_ticket),0) as total'),
new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlValidRule('ticket.start', 'ticket.end', ':start', ':end') . " then 1 else 0 end) , 0) as valid" ), //valid
new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then 1 else 0 end) , 0) as created" ),//created
new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then transfer.money else 0 end) , 0) as created_money" ),//created_money
new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND " . Helper::sqlExpireRule('ticket.start', 'ticket.end', ':start', ":end") . " then 1 else 0 end) , 0) as expired" ),
]);
$query->from('ticket_type');
$query->innerJoin('ticket', 'ticket.id_ticket_type = ticket_type.id_ticket_type');
$query->innerJoin('transfer', 'ticket.id_ticket = transfer.id_object and transfer.type = '. Transfer::TYPE_TICKET );
Helper::queryAccountConstraint($query, 'ticket.id_account');
$query->andFilterWhere(['id_card' =>$id_card]);
$query->andWhere(
[
'or',
@ -357,23 +361,23 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
Helper::queryExpireRule('ticket.start', 'ticket.end', $start, $end),
]
);
$query->groupBy("ticket_type.id_ticket_type, ticket_type.name");
$query->params([':start' => $start, ':end' => $end]);
return $query;
}
public static function statuses( ) {
return [
Ticket::STATUS_ACTIVE => 'Aktív',
Ticket::STATUS_DELETED => 'Törölve',
Ticket::STATUS_INACTIVE => 'Inaktív',
Ticket::STATUS_ACTIVE => 'Aktív',
Ticket::STATUS_DELETED => 'Törölve',
Ticket::STATUS_INACTIVE => 'Inaktív',
];
}
public static function toStatusName($id_status){
$result = "Ismeretlen";
$statuses = Ticket::statuses();
@ -382,23 +386,23 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
}
return $result;
}
public function getStatusName(){
return static::toStatusName($this->status);
}
public function isDeleted(){
return $this->status == Ticket::STATUS_DELETED;
}
/**csoportos beszedéses a bérlet*/
public function isInstallmentTicket(){
return ( isset($this->part_count) && $this->part_count > 0 );
}
/**
* Apply request
*
*
* @var \common\models\TicketInstallmentRequest $request megbízás
* */
public function applyTicketInstallmentRequest( $request ) {
@ -410,12 +414,12 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
}
$this->recalclulate();
}else if ( $request->isStatusRejected() ){
$this->status = static::STATUS_INACTIVE;
$this->status = static::STATUS_INACTIVE;
}
}
}
/*
* *
* *
* @param common\models\TicketInstallmentRequest $request megbízás
*/
public function setPartRequired($request){
@ -427,7 +431,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
}
}
}
/**
* Csoportos beszedéses bérlet érvényességének újraszámolása
* */
@ -441,11 +445,35 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
}
}
}
public function hasOpenReservationCount(){
return $this->reservation_count < $this->max_reservation_count;
}
/**
* @param $count
* @throws HttpException
*/
public function consumeReservationCount($count){
$newReservationCount = $this->reservation_count + $count;
if ( $newReservationCount > $this->max_reservation_count ){
throw new HttpException(400, 'Max ticket seat count exceeded',EventRegistrationManager::MAX_SEAT_COUNT_EXCEEDED);
}
$this->reservation_count = $newReservationCount;
}
public function restoreReservationCount($usagesToRestore){
$this->reservation_count -= $usagesToRestore;
if ( $this->reservation_count < 0 ){
$this->reservation_count = 0;
}
}
public function afterSave($insert, $changedAttributes) {
Card::updateCardFlagTicket($this->id_card);;
}
public function afterDelete(){
Card::updateCardFlagTicket($this->id_card);;
}

View File

@ -24,13 +24,22 @@ use yii\helpers\ArrayHelper;
* @property integer door_allowed
* @property string $created_at
* @property string $updated_at
* @property integer $max_reservation_count
* @property \common\models\Account $account
* @property string $typeHuman
* @property string $timeUnitHuman
* @property string $accountName
*/
class TicketType extends \common\models\BaseFitnessActiveRecord {
class TicketType extends BaseFitnessActiveRecord
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
CONST TIME_UNIT_DAY = 10;//nap
CONST TIME_UNIT_MONTH = 20;//hónap
CONST TIME_UNIT_MONTH_REFERENCE = 30; //tárgy hónap
// day
CONST TIME_UNIT_DAY = 10;
// month
CONST TIME_UNIT_MONTH = 20;
// subject month
CONST TIME_UNIT_MONTH_REFERENCE = 30;
const TYPE_NORMAL = 10;
const TYPE_DEFAULT = self::TYPE_NORMAL;
@ -57,7 +66,7 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
public function rules()
{
return [
[['name', 'id_account','time_unit_count','type' ,'time_unit_type' ,'max_usage_count','price_brutto'], 'required'],
[['name', 'id_account','time_unit_count','type' ,'time_unit_type' ,'max_usage_count','max_reservation_count','price_brutto'], 'required'],
////////////////
//price brutto
////////////////
@ -76,6 +85,10 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
////////////////
[['max_usage_count',], 'integer','min' => 0 , 'max' => 10000],
////////////////
//max_reservation_count
////////////////
[['max_reservation_count',], 'integer','min' => 0 , 'max' => 10000],
////////////////
//flag_student
////////////////
[['flag_student',], 'integer'],
@ -140,6 +153,7 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
'installment_count' => Yii::t('common/ticket_type', 'Havi részletek száma'),
'installment_money' => Yii::t('common/ticket_type', 'Havi részlet összege'),
'door_allowed' => Yii::t('common/ticket_type', 'Forgóvilla'),
'max_reservation_count' => Yii::t('common/ticket_type', 'Max Reservation Count'),
];
}
@ -169,7 +183,7 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
}
public function getTimeUnitHuman() {
$result = null;
$s = self::timeUnitTypes ( $this->time_unit_type );
$s = self::timeUnitTypes( );
if (array_key_exists ( $this->time_unit_type, $s )) {
$result = $s [$this->time_unit_type];
}
@ -210,7 +224,7 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
}
public function validateIdAccount($attribute,$params){
public function validateIdAccount($attribute){
$account = null;
if ( !$this->hasErrors("id_account")){
$account = Account::findOne($this->$attribute);
@ -233,9 +247,12 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
}
}
/**
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
* */
/**
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
* @param null $forceIncludeObjectWithId
* @param null $account
* @return array|\yii\db\ActiveRecord[]|null
*/
public static function read($forceIncludeObjectWithId = null, $account = null){
$ticketTypes = null;

94
common/models/Trainer.php Normal file
View File

@ -0,0 +1,94 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "trainer".
*
* @property integer $id
* @property string $name
* @property string $phone
* @property string $email
* @property string $password
* @property integer $active
* @property string $created_at
* @property string $updated_at
*/
class Trainer extends \yii\db\ActiveRecord
{
const ACTIVE_ON = 1;
const ACTIVE_OFF = 0;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'trainer';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['active'], 'integer'],
[['name', 'email'], 'string', 'max' => 255],
[['phone'], 'string', 'max' => 20],
[['name','phone','email'] , 'required'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('trainer', 'ID'),
'name' => Yii::t('trainer', 'Name'),
'phone' => Yii::t('trainer', 'Phone'),
'email' => Yii::t('trainer', 'Email'),
'password' => Yii::t('trainer', 'Password'),
'active' => Yii::t('trainer', 'Active'),
'created_at' => Yii::t('trainer', 'Created At'),
'updated_at' => Yii::t('trainer', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public static function prettyPrintActive($active){
if ( $active == Trainer::ACTIVE_ON ){
return \Yii::t("trainer",'active_on');
}
return \Yii::t("trainer",'active_off');
}
public static function trainerOptions($all = false, $emptyString = false){
$items = ArrayHelper::map(Trainer::find()->all(),'id','name');
$extra = [];
if ( $all ) {
$extra = ['' => \Yii::t('trainer','All')];
}
if ( $emptyString ) {
$extra = ['' => '' ];
}
return ArrayHelper::merge($extra,$items);
}
}

View File

@ -3,11 +3,8 @@
namespace common\models;
use Yii;
use yii\base\Object;
use yii\helpers\ArrayHelper;
use yii\behaviors\TimestampBehavior;
use common\components\AccountAwareBehavior;
use common\components\UserAwareBehavior;
use common\components\DiscountAwareBehavior;
use common\components\CustomerAwareBehavior;
use yii\db\Query;
@ -604,12 +601,17 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
}
return $status;
}
public function beforeDelete() {
/**
* @return bool
* @throws \yii\db\StaleObjectException
*/
public function beforeDelete() {
parent::beforeDelete ();
if ($this->type == Transfer::TYPE_TICKET) {
$ticket = $this->ticket;
if ($ticket != null) {
$ticket->delete ();
$ticket->delete();
}
} else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) {
/** @noinspection PhpUndefinedFieldInspection */
@ -816,11 +818,10 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
* an array, wchic contains items. each item has to key - value pairs: [ id_account => 0, money => 0 ]
*
* @param $accounts
* @param $accountMap
* @param $idAccount
* @return array
*/
public static function mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $accountMap, $idAccount) {
public static function mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $idAccount) {
$totals = [ ];
$totals ['total'] = 0;
@ -867,6 +868,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
* @param $types
* @param $idAccount
* @return array
* @throws \yii\db\Exception
*/
public static function exTotalQuery($mode, $start, $end, $idUser, $types, $idAccount) {
$query = self::mkTotalQuery ( $mode, $start, $end, $idUser, $types, $idAccount );
@ -885,45 +887,56 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
* @param $accounts
* @param $accountMap
* @return array
* @throws \yii\db\Exception
*/
public static function mkPaidAtTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
public static function mkPaidAtTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
/** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'paid_at', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
return $result;
}
/**
* find all transfers in the period ( doesn't matter if paid or not )
*/
public static function mkCreatedAtTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
/**
* find all transfers in the period ( doesn't matter if paid or not )
* @throws \yii\db\Exception
*/
public static function mkCreatedAtTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
/** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'created_at', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
return $result;
}
/**
* find transfers which were created but not paid in the period
*/
public static function mkCreatedAtNotPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
/**
* find transfers which were created but not paid in the period
* @throws \yii\db\Exception
*/
public static function mkCreatedAtNotPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
/** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'created_at_not_paid', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
return $result;
}
/**
* find transfers which were created and paid in the period
*/
public static function mkCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
/**
* find transfers which were created and paid in the period
* @param $start
* @param $end
* @param $idUser
* @param $types
* @param $idAccount
* @param $accounts
* @return array
* @throws \yii\db\Exception
*/
public static function mkCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
/** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'created_at_paid', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
return $result;
}
@ -937,22 +950,35 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
* @param $accounts
* @param $accountMap
* @return array
* @throws \yii\db\Exception
*/
public static function mkPaidAtNotCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
public static function mkPaidAtNotCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
/** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'paid_at_not_created_at', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
return $result;
}
public static function mkTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
/**
* @param $start
* @param $end
* @param $idUser
* @param $types
* @param $idAccount
* @param $accounts
* @param $accountMap
* @return array
* @throws \yii\db\Exception
*/
public static function mkTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
$result = [ ];
$result ['paid_at'] = self::mkPaidAtTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
$result ['created_at'] = self::mkCreatedAtTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
$result ['created_at_not_paid'] = self::mkCreatedAtNotPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
$result ['created_at_paid'] = self::mkCreatedAtPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
$result ['paid_at_not_created_at'] = self::mkPaidAtNotCreatedAtPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
$result ['paid_at'] = self::mkPaidAtTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
$result ['created_at'] = self::mkCreatedAtTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
$result ['created_at_not_paid'] = self::mkCreatedAtNotPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
$result ['created_at_paid'] = self::mkCreatedAtPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
$result ['paid_at_not_created_at'] = self::mkPaidAtNotCreatedAtPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
return $result;
}
@ -1220,6 +1246,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
$ticket->id_discount = null; // contract.id_discount
$ticket->start = $request->request_target_time_at;
$ticket->end = date ( 'Y-m-d', strtotime ( $request->request_target_time_at . " +1 month -1 day" ) );
$ticket->max_reservation_count = $ticketType->max_reservation_count;
$ticket->max_usage_count = $ticketType->max_usage_count;
$ticket->usage_count = 0;
$ticket->status = Ticket::STATUS_INACTIVE;

View File

@ -161,6 +161,8 @@ class User extends ActiveRecord implements IdentityInterface
* Generates password hash from password and sets it to the model
*
* @param string $password
* @throws \yii\base\Exception
* @throws \yii\base\InvalidConfigException
*/
public function setPassword($password)
{

View File

@ -0,0 +1,16 @@
<?php
namespace common\modules\event;
class EventModule extends \yii\base\Module
{
public $controllerNamespace = 'common\modules\event\controllers';
public $mode;
public function init()
{
parent::init();
// custom initialization code goes here
}
}

Some files were not shown because too many files have changed in this diff Show More