Merge branch 'feature/door_card_pass' into develop

This commit is contained in:
Schneider Roland 2023-02-28 21:49:15 +01:00
commit f4f28d43c1
7 changed files with 233 additions and 5 deletions

View File

@ -541,7 +541,7 @@ class Helper {
public static function isRestAllowVerifyOnly() {
return \Yii::$app->params ['rest_allow_verify_only'] == true;
return \Yii::$app->params ['rest_allow_verify_only'] && \Yii::$app->params ['rest_allow_verify_only'] == true;
}
public static function getDoorEntryStrategy(){

View File

@ -30,7 +30,7 @@ Content-Type: application/json
Authorization: Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE=
{
"cardNumber": "63595944529997.36018993",
"cardNumber": "63f3e0cd399f55.53162649",
"direction": "IN",
"device": "Q",
"validateOnly": false
@ -44,7 +44,7 @@ Content-Type: application/json
Authorization: Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE=
{
"cardNumber": "63595944529997.36018993",
"cardNumber": "63f3e0cd399f55.53162649",
"direction": "OUT",
"device": "Q",
"validateOnly": false
@ -61,7 +61,7 @@ Authorization: Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE=
"cardNumber": "123456",
"direction": "IN",
"device": "C",
"validateOnly": true
"validateOnly": false
}
###

View File

@ -113,6 +113,10 @@ class FrontendMenuStructure
// 'items' => $items
];
$this->menuItems[] = ['label' => 'Kapu',
'url' => ["/door-manager-log/index"]
// 'items' => $items
];
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace frontend\controllers;
use common\manager\DoorManager;
use common\models\DoorManagerLog;
use frontend\models\DoorManagerLogSearch;
use frontend\models\InventorySearch;
use Yii;
use common\models\Log;
use frontend\models\LogSearch;
use yii\data\ArrayDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Card;
use common\models\TicketInstallmentRequest;
use common\models\Ticket;
use common\models\Transfer;
use common\models\Account;
use common\components\Helper;
use common\models\Sale;
use common\models\Product;
use common\models\ShoppingCart;
use common\models\Customer;
use frontend\models\LogForm;
/**
* LogController implements the CRUD actions for Log model.
*/
class DoorManagerLogController extends Controller {
public function actionIndex()
{
$searchModel = new DoorManagerLogSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace frontend\models;
use common\models\DoorManagerLog;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
/**
* InventorySearch represents the model behind the search form about `common\models\Inventory`.
*/
class DoorManagerLogSearch extends DoorManagerLog
{
public $searchTerm;
/**
* @inheritdoc
*/
public function rules()
{
return [
['searchTerm','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 = DoorManagerLog::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' =>[
'defaultOrder' => [ 'created_at' => SORT_DESC ]
]
]);
$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->orFilterWhere([
'like',
'ticket_type_name' , $this->searchTerm,
]);
$query->orFilterWhere([
'like',
'customer_name' , $this->searchTerm,
]);
$query->orFilterWhere([
'like',
'card_number' , $this->searchTerm,
]);
$query->orFilterWhere([
'like',
'key_number' , $this->searchTerm,
]);
return $dataProvider;
}
}

View File

@ -0,0 +1,33 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\InventorySearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="inventory-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'searchTerm') ?>
<!-- --><?php //= $form->field($model, 'id_user') ?>
<!---->
<!-- --><?php //= $form->field($model, 'created_at') ?>
<!---->
<!-- --><?php //= $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/inventory', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('common/inventory', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,64 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\DoorLogManagerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = "Kapu események";
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="inventory-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[ 'attribute' => 'id_door_manager_log', "value" =>"id_door_manager_log", "label" => 'ID' ],
'created_at:datetime',
[ 'attribute' => 'verify_only', "value" =>function ($model) {
return $model->verify_only ? "I" : "N";
}, "label" => 'Teszt' ],
[ 'attribute' => 'original_direction', "value" =>"original_direction", "label" => 'Irány' ],
[ 'attribute' => 'device', "value" =>"device", "label" => 'Eszköz ' ],
[ 'attribute' => 'card_number', "value" =>"card_number", "label" => 'Kártya' ],
[ 'attribute' => 'customer_name', "value" =>"customer_name", "label" => 'Vendég' ],
[ 'attribute' => 'ticket_type_name', "value" =>"ticket_type_name", "label" => 'Bérlet' ],
[ 'attribute' => 'ticket_usage_count', "value" =>"ticket_usage_count", "label" => 'Használat' ],
[ 'attribute' => 'validation_kind', "value" =>"validation_kind", "label" => 'Típus' ],
[ 'attribute' => 'key_number', "value" =>"key_number", "label" => 'Kulcs' ],
[ 'attribute' => 'error', "value" =>"error", "label" => 'Hiba' ],
[ 'attribute' => 'error_code', "value" =>"error_code", "label" => 'Hiba kód' ],
// 'id_door_ma',
// 'name',
// [ 'attribute' => 'id_user', "value" =>"userName" ],
// [ 'attribute' => 'id_user', "value" =>"userName" ],
//
// ['class' => 'yii\grid\ActionColumn',
// 'template' => '{view}',
// 'urlCreator' => function( $action, $model, $key, $index ){
// if ( $action == 'view' ){
// return Url::to(['inventory-item/index' , 'id'=> $model->id_inventory]);
// }
// },
// 'buttons' =>[
// 'view' =>function ($url, $model, $key) {
// return Html::a('Részletek', $url,['class' => 'btn btn-xs btn-primary',
// ]) ;
// }
// ]
//
// ],
],
]); ?>
</div>
8