doorcardpass && door move manager logging
This commit is contained in:
@@ -2,18 +2,17 @@
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
use common\components\DateUtil;
|
||||
use common\components\Helper;
|
||||
use common\manager\DoorCardPassManager;
|
||||
use common\models\Card;
|
||||
use common\models\DoorCardPass;
|
||||
use Yii;
|
||||
use common\models\City;
|
||||
use backend\models\CitySearch;
|
||||
use yii\web\BadRequestHttpException;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\base\BaseObject;
|
||||
use yii\db\Query;
|
||||
use yii\helpers\Json;
|
||||
|
||||
/**
|
||||
* CityController implements the CRUD actions for City model.
|
||||
@@ -39,11 +38,12 @@ class DoorCardPassController extends Controller
|
||||
if (!isset($card)){
|
||||
throw new BadRequestHttpException("card id not found");
|
||||
}
|
||||
$model = new DoorCardPass();
|
||||
$model->id_card = $idCard;
|
||||
$model->save(false);
|
||||
|
||||
$this->redirect('customer/reception');
|
||||
$doorCardPassManager = new DoorCardPassManager();
|
||||
$doorCardPassManager->createNewDoorCardPass($idCard);
|
||||
$doorCardPassManager->updateDoorCardPassStateForCard($idCard);
|
||||
|
||||
$this->redirect(['customer/reception', 'number' => $card->number]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,5 +72,5 @@ class DoorCardPassController extends Controller
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,8 +10,53 @@ use frontend\components\HtmlHelper;
|
||||
/* @var $model frontend\models\ReceptionForm */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['door-card-pass/allow', 'number' => $model->getCardNumber()],
|
||||
<?php
|
||||
|
||||
if (! ( isset($model) && isset($model->card))){
|
||||
return;
|
||||
}
|
||||
$activeCardPasses = \common\models\DoorCardPass::find()
|
||||
->andWhere(
|
||||
[
|
||||
'id_card' => $model->card->id_card,
|
||||
'invalidated_at' => null ,
|
||||
|
||||
// [ '>=', $field , $start ]
|
||||
|
||||
|
||||
]
|
||||
)->andWhere(
|
||||
['>=', 'valid_until_at', \common\components\DateUtil::formatDateTimeUtc(\common\components\DateUtil::utcDateTime())],
|
||||
)
|
||||
->orderBy(['valid_until_at' => SORT_DESC ])->all();
|
||||
|
||||
if (count($activeCardPasses) > 0){
|
||||
$cardPass = $activeCardPasses[0];
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
echo "Forgó kapun beléphet eddig: " ;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
echo $cardPass->valid_until_at ;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}else {
|
||||
?>
|
||||
<div>
|
||||
Nincs érvényes forgó kapu belépő
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
$form = ActiveForm::begin([
|
||||
'action' => ['door-card-pass/allow-card', 'idCard' => $model->card->id_card],
|
||||
'method' => 'post',
|
||||
]); ?>
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user