add backend door log
This commit is contained in:
parent
fa0eba3a11
commit
c0d36c525e
@ -138,10 +138,6 @@ class AdminMenuStructure{
|
||||
$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 ] ];
|
||||
// $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'] ];
|
||||
$this->menuItems[] = ['label' => 'Események', 'url' => $this->emptyUrl,
|
||||
'items' => $items
|
||||
];
|
||||
@ -152,13 +148,20 @@ class AdminMenuStructure{
|
||||
/////////////////////////////
|
||||
$items = [];
|
||||
$items[] = ['label' => 'Hírlevelek', 'url' => ['/newsletter/index' , 'NewsletterSearch[start]' =>$todayDatetime,'NewsletterSearch[end]' => $tomorrowDatetime ] ];
|
||||
// $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'] ];
|
||||
$this->menuItems[] = ['label' => 'Hírlevél', 'url' => $this->emptyUrl,
|
||||
'items' => $items
|
||||
];
|
||||
/////////////////////////////
|
||||
// Development
|
||||
/////////////////////////////
|
||||
if ( Yii::$app->user ){
|
||||
$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
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use backend\models\DoorMoveForm;
|
||||
use common\components\Helper;
|
||||
use common\models\Card;
|
||||
use common\models\Ticket;
|
||||
use Yii;
|
||||
use common\models\DoorLog;
|
||||
use backend\models\DoorLogSearch;
|
||||
@ -61,6 +65,72 @@ class DoorLogController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionIn( )
|
||||
{
|
||||
$model = new DoorMoveForm();
|
||||
if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
|
||||
$log = new DoorLog();
|
||||
//5559 9719
|
||||
|
||||
$log->id_card = 9719;
|
||||
$log->id_customer = 5559;
|
||||
$log->id_ticket_current = $model->id_ticket;
|
||||
$log->direction = 3;
|
||||
$log->id_key = 1;
|
||||
$log->type = 0;
|
||||
$log->source_app = DoorLog::$SOURCE_APP_FITNESS_ADMIN;
|
||||
$log->id_account = null;
|
||||
$log->card_flag = 0;
|
||||
$log->flag_out = 0;
|
||||
|
||||
$log->save(false);
|
||||
Helper::flash("success", "Belépett " .$model->id_ticket);
|
||||
return $this->redirect(['in']);
|
||||
}else{
|
||||
$model->id_ticket = $this->findTicket();
|
||||
return $this->render('move', [
|
||||
'model' => $model
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionOut()
|
||||
{
|
||||
$model = new DoorMoveForm();
|
||||
if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
|
||||
$log = new DoorLog();
|
||||
$log->id_card = 9719;
|
||||
$log->id_customer = 5559;
|
||||
$log->id_ticket_current = $model->id_ticket;
|
||||
$log->direction = 1;
|
||||
$log->id_key = null;
|
||||
$log->type = 0;
|
||||
$log->source_app = DoorLog::$SOURCE_APP_FITNESS_ADMIN;
|
||||
$log->id_account = null;
|
||||
$log->card_flag = 0;
|
||||
$log->flag_out = 0;
|
||||
|
||||
$log->save(false);
|
||||
Helper::flash("success", "Kilépett " .$model->id_ticket );
|
||||
return $this->redirect(['out']);
|
||||
}else{
|
||||
$model->id_ticket = $this->findTicket();
|
||||
return $this->render('move', [
|
||||
'model' => $model
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function findTicket(){
|
||||
$idCard = 9719;
|
||||
$card = Card::findOne($idCard);
|
||||
$tickets = Ticket::readActive($card);
|
||||
if ( count($tickets) > 0 ){
|
||||
return $tickets[0]->id_ticket;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DoorLog model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
|
||||
31
backend/models/DoorMoveForm.php
Normal file
31
backend/models/DoorMoveForm.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use common\models\Card;
|
||||
use common\models\Customer;
|
||||
use common\models\Ticket;
|
||||
use common\models\Account;
|
||||
use yii\web\UploadedFile;
|
||||
|
||||
/**
|
||||
* ContactForm is the model behind the contact form.
|
||||
* @property integer id_ticket
|
||||
*/
|
||||
class DoorMoveForm extends Model{
|
||||
|
||||
public $id_ticket;
|
||||
public $message;
|
||||
|
||||
public function rules(){
|
||||
return [
|
||||
[['id_ticket'], 'required'],
|
||||
[['id_ticket'], 'integer']
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
24
backend/views/door-log/_form_move.php
Normal file
24
backend/views/door-log/_form_move.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\DoorLog */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="door-log-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'id_ticket')->textInput() ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton( Yii::t('common/door_log', 'Create') ) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
20
backend/views/door-log/move.php
Normal file
20
backend/views/door-log/move.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\DoorLog */
|
||||
|
||||
$this->title = "Move";
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/door_log', 'Door Logs'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/door_log', 'Update');
|
||||
?>
|
||||
<div class="door-log-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form_move', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
@ -19,6 +19,9 @@ use yii\helpers\ArrayHelper;
|
||||
* @property integer $id_account
|
||||
* @property string $created_at
|
||||
* @property string $source_app
|
||||
* @property integer id_ticket_current
|
||||
* @property integer card_flag
|
||||
* @property integer flag_out
|
||||
*/
|
||||
class DoorLog extends \yii\db\ActiveRecord
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@ class DoorlogController extends Controller{
|
||||
$log->id_ticket_current = $ticket;
|
||||
$log->direction = 3;
|
||||
$log->id_key = 1;
|
||||
$log->type = 0;
|
||||
$log->type = 5;
|
||||
$log->source_app = DoorLog::$SOURCE_APP_FITNESS_ADMIN;
|
||||
$log->id_account = null;
|
||||
$log->card_flag = 0;
|
||||
@ -60,7 +60,7 @@ class DoorlogController extends Controller{
|
||||
$log->id_ticket_current = $ticket;
|
||||
$log->direction = 1;
|
||||
$log->id_key = null;
|
||||
$log->type = 0;
|
||||
$log->type = 7;
|
||||
$log->source_app = DoorLog::$SOURCE_APP_FITNESS_ADMIN;
|
||||
$log->id_account = null;
|
||||
$log->card_flag = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user