add rfid_key to card and key
This commit is contained in:
parent
f6b483a9f9
commit
3b2f19b909
@ -23,7 +23,7 @@ class CardSearch extends Card
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['id_card', 'status', 'type'], 'integer'],
|
[['id_card', 'status', 'type'], 'integer'],
|
||||||
[[ 'searchCustomerName', 'number', 'created_at', 'updated_at'], 'safe'],
|
[[ 'searchCustomerName', 'number','rfid_key', 'created_at', 'updated_at'], 'safe'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +72,7 @@ class CardSearch extends Card
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$query->andFilterWhere(['like', 'card.number', $this->number]);
|
$query->andFilterWhere(['like', 'card.number', $this->number]);
|
||||||
|
$query->andFilterWhere(['like', 'card.rfid_key', $this->rfid_key]);
|
||||||
$query->andFilterWhere(['like', 'customer.name', $this->searchCustomerName]);
|
$query->andFilterWhere(['like', 'customer.name', $this->searchCustomerName]);
|
||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
|
|||||||
@ -20,7 +20,8 @@ class KeySearch extends Key
|
|||||||
return [
|
return [
|
||||||
/*[['id_key', 'status', 'type'], 'integer'],
|
/*[['id_key', 'status', 'type'], 'integer'],
|
||||||
[['number', 'created_at', 'updated_at'], 'safe'],*/
|
[['number', 'created_at', 'updated_at'], 'safe'],*/
|
||||||
[['number'], 'safe']
|
[['number'], 'safe'],
|
||||||
|
[['rfid_key'], 'safe']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ class KeySearch extends Key
|
|||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
'id_key' => $this->id_key,
|
'id_key' => $this->id_key,
|
||||||
'number' => $this->number,
|
'number' => $this->number,
|
||||||
|
'rfid_key' => $this->rfid_key,
|
||||||
'status' => $this->status,
|
'status' => $this->status,
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'created_at' => $this->created_at,
|
'created_at' => $this->created_at,
|
||||||
|
|||||||
@ -14,6 +14,7 @@ use common\models\Card;
|
|||||||
<?php $form = ActiveForm::begin(); ?>
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
||||||
|
<?= $form->field($model, 'rfid_key')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'status')->dropDownList(Card::statuses()) ?>
|
<?= $form->field($model, 'status')->dropDownList(Card::statuses()) ?>
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,9 @@ $statusOptions = mkOptions(Card::statuses());
|
|||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'searchCustomerName')->textInput() ?>
|
<?= $form->field($model, 'searchCustomerName')->textInput() ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?= $form->field($model, 'rfid_key')->textInput() ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'attribute' => 'number',
|
'attribute' => 'number',
|
||||||
'value' => 'number'
|
'value' => 'number'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'rfid_key',
|
||||||
|
'value' => 'rfid_key'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'status',
|
'attribute' => 'status',
|
||||||
'value' => 'statusHuman'
|
'value' => 'statusHuman'
|
||||||
|
|||||||
@ -22,6 +22,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'model' => $model,
|
'model' => $model,
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'number',
|
'number',
|
||||||
|
'rfid_key',
|
||||||
['attribute' => 'status', 'value' => $model->statusHuman],
|
['attribute' => 'status', 'value' => $model->statusHuman],
|
||||||
['attribute' => 'type', 'value' => $model->typeHuman],
|
['attribute' => 'type', 'value' => $model->typeHuman],
|
||||||
'created_at:datetime',
|
'created_at:datetime',
|
||||||
|
|||||||
@ -14,6 +14,7 @@ use common\models\Key;
|
|||||||
<?php $form = ActiveForm::begin(); ?>
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
||||||
|
<?= $form->field($model, 'rfid_key')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?>
|
<?= $form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?>
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,6 @@ use common\models\Key;
|
|||||||
|
|
||||||
<div class="key-search">
|
<div class="key-search">
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
|
|
||||||
<?php $form = ActiveForm::begin([
|
<?php $form = ActiveForm::begin([
|
||||||
'action' => ['index'],
|
'action' => ['index'],
|
||||||
@ -20,8 +18,14 @@ use common\models\Key;
|
|||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
<?php //echo $form->field($model, 'id_key') ?>
|
<?php //echo $form->field($model, 'id_key') ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
<?php echo $form->field($model, 'number') ?>
|
<?php echo $form->field($model, 'number') ?>
|
||||||
|
</div><!-- col-md-4 END -->
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?php echo $form->field($model, 'rfid_key') ?>
|
||||||
|
</div><!-- col-md-4 END -->
|
||||||
|
</div><!-- row END -->
|
||||||
<?php //$form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?>
|
<?php //$form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?>
|
||||||
|
|
||||||
<?php //echo $form->field($model, 'status') ?>
|
<?php //echo $form->field($model, 'status') ?>
|
||||||
@ -39,6 +43,4 @@ use common\models\Key;
|
|||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
</div><!-- col-md-4 END -->
|
|
||||||
</div><!-- row END -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -30,6 +30,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
// ['class' => 'yii\grid\SerialColumn'],
|
// ['class' => 'yii\grid\SerialColumn'],
|
||||||
// 'id_key',
|
// 'id_key',
|
||||||
'number',
|
'number',
|
||||||
|
'rfid_key',
|
||||||
[
|
[
|
||||||
'attribute' => 'status',
|
'attribute' => 'status',
|
||||||
'value' => function ($model, $key, $index, $column){
|
'value' => function ($model, $key, $index, $column){
|
||||||
@ -39,7 +40,11 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
//'status',
|
//'status',
|
||||||
'type',
|
[
|
||||||
|
'attribute' =>'type',
|
||||||
|
'value' =>'humanType'
|
||||||
|
|
||||||
|
],
|
||||||
'created_at',
|
'created_at',
|
||||||
// 'updated_at',
|
// 'updated_at',
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'attributes' => [
|
'attributes' => [
|
||||||
'id_key',
|
'id_key',
|
||||||
'number',
|
'number',
|
||||||
|
'rfid_key',
|
||||||
'status',
|
'status',
|
||||||
'type',
|
'type',
|
||||||
'created_at',
|
'created_at',
|
||||||
|
|||||||
@ -37,5 +37,6 @@ return [
|
|||||||
'Update' => 'Módosítás',
|
'Update' => 'Módosítás',
|
||||||
'Update {modelClass}: ' => '{modelClass} módosítása:',
|
'Update {modelClass}: ' => '{modelClass} módosítása:',
|
||||||
'Updated At' => 'Módosítás ideje',
|
'Updated At' => 'Módosítás ideje',
|
||||||
'OLD' => 'Régi Rendszer'
|
'OLD' => 'Régi Rendszer',
|
||||||
|
'RFID key' => 'RFID szám'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -6,6 +6,8 @@ return [
|
|||||||
'Status' => 'Státusz',
|
'Status' => 'Státusz',
|
||||||
'Search' => 'Keresés',
|
'Search' => 'Keresés',
|
||||||
'Type' => 'Típus',
|
'Type' => 'Típus',
|
||||||
|
'Key' => 'Kulcs',
|
||||||
'Created At' => 'Létrehozva',
|
'Created At' => 'Létrehozva',
|
||||||
|
'RFID key' => 'RFID szám',
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
[['number', 'type','status'], 'required'],
|
[['number', 'type','status'], 'required'],
|
||||||
[['status', 'type'], 'integer'],
|
[['status', 'type'], 'integer'],
|
||||||
[['number'], 'string', 'max' => 20],
|
[['number'], 'string', 'max' => 20],
|
||||||
|
[['rfid_key'], 'string', 'max' => 25],
|
||||||
[['number'], 'unique' ]
|
[['number'], 'unique' ]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -54,6 +55,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
return [
|
return [
|
||||||
'id_card' => Yii::t('common/card', 'Id Card'),
|
'id_card' => Yii::t('common/card', 'Id Card'),
|
||||||
'number' => Yii::t('common/card', 'Number'),
|
'number' => Yii::t('common/card', 'Number'),
|
||||||
|
'rfid_key' => Yii::t('common/card', 'RFID key'),
|
||||||
'status' => Yii::t('common/card', 'Status'),
|
'status' => Yii::t('common/card', 'Status'),
|
||||||
'type' => Yii::t('common/card', 'Type'),
|
'type' => Yii::t('common/card', 'Type'),
|
||||||
'created_at' => Yii::t('common/card', 'Created At'),
|
'created_at' => Yii::t('common/card', 'Created At'),
|
||||||
|
|||||||
@ -39,6 +39,7 @@ class Key extends \yii\db\ActiveRecord
|
|||||||
//[['created_at', 'updated_at'], 'required'],//kötelezőek
|
//[['created_at', 'updated_at'], 'required'],//kötelezőek
|
||||||
//[['created_at', 'updated_at'], 'safe'], //bármi lehet
|
//[['created_at', 'updated_at'], 'safe'], //bármi lehet
|
||||||
[['number'], 'string', 'max' => 255],
|
[['number'], 'string', 'max' => 255],
|
||||||
|
[['rfid_key'], 'string', 'max' => 25],
|
||||||
[['number' ], 'unique'],
|
[['number' ], 'unique'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -61,6 +62,7 @@ class Key extends \yii\db\ActiveRecord
|
|||||||
return [
|
return [
|
||||||
'id_key' => Yii::t('common/key', 'Id Key'),
|
'id_key' => Yii::t('common/key', 'Id Key'),
|
||||||
'number' => Yii::t('common/key', 'Number'),
|
'number' => Yii::t('common/key', 'Number'),
|
||||||
|
'rfid_key' => Yii::t('common/key', 'RFID key'),
|
||||||
'status' => Yii::t('common/key', 'Status'),
|
'status' => Yii::t('common/key', 'Status'),
|
||||||
'type' => Yii::t('common/key', 'Type'),
|
'type' => Yii::t('common/key', 'Type'),
|
||||||
'created_at' => Yii::t('common/key', 'Created At'),
|
'created_at' => Yii::t('common/key', 'Created At'),
|
||||||
@ -80,5 +82,14 @@ class Key extends \yii\db\ActiveRecord
|
|||||||
self::TYPE_NORMAL => Yii::t('common/key', 'Key'),
|
self::TYPE_NORMAL => Yii::t('common/key', 'Key'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHumanType(){
|
||||||
|
$result = "";
|
||||||
|
$types = self::types();
|
||||||
|
if ( array_key_exists($this->type, $types) ){
|
||||||
|
$result = $types[$this->type];
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class m151208_212339_alter__table__customer__add__column__key extends Migration
|
|||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
$this->addColumn("customer", "id_key", "int");
|
$this->addColumn("key", "id_key", "int");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m151228_162443_alter__table__key__add__column__rfid__number extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("key", "rfid_key", "varchar(25)");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m151228_162443_alter__table__key__add__column__rfid__number cannot be reverted.\n";
|
||||||
|
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m151228_172909_alter__table__card__add__column__rfid__number extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("card", "rfid_key", "varchar(25)");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m151228_172909_alter__table__card__add__column__rfid__number cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -42,7 +42,7 @@ class ReceptionForm extends Model
|
|||||||
|
|
||||||
public function readCard(){
|
public function readCard(){
|
||||||
|
|
||||||
$this->card = Card::findOne(['number' => $this->number]);
|
$this->card = Card::find()->andWhere(['or',[ 'in','number' , [$this->number]],['in','rfid_key' ,[ $this->number]]])->one();
|
||||||
if ( $this->card != null ){
|
if ( $this->card != null ){
|
||||||
$this->customer = $this->card->customer;
|
$this->customer = $this->card->customer;
|
||||||
$this->readValidTickets();
|
$this->readValidTickets();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user