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 [
|
||||
[['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.rfid_key', $this->rfid_key]);
|
||||
$query->andFilterWhere(['like', 'customer.name', $this->searchCustomerName]);
|
||||
|
||||
return $dataProvider;
|
||||
|
||||
@ -20,7 +20,8 @@ class KeySearch extends Key
|
||||
return [
|
||||
/*[['id_key', 'status', 'type'], 'integer'],
|
||||
[['number', 'created_at', 'updated_at'], 'safe'],*/
|
||||
[['number'], 'safe']
|
||||
[['number'], 'safe'],
|
||||
[['rfid_key'], 'safe']
|
||||
];
|
||||
}
|
||||
|
||||
@ -59,6 +60,7 @@ class KeySearch extends Key
|
||||
$query->andFilterWhere([
|
||||
'id_key' => $this->id_key,
|
||||
'number' => $this->number,
|
||||
'rfid_key' => $this->rfid_key,
|
||||
'status' => $this->status,
|
||||
'type' => $this->type,
|
||||
'created_at' => $this->created_at,
|
||||
|
||||
@ -14,6 +14,7 @@ use common\models\Card;
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
||||
<?= $form->field($model, 'rfid_key')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'status')->dropDownList(Card::statuses()) ?>
|
||||
|
||||
|
||||
@ -46,6 +46,9 @@ $statusOptions = mkOptions(Card::statuses());
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'searchCustomerName')->textInput() ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'rfid_key')->textInput() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -28,6 +28,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'attribute' => 'number',
|
||||
'value' => 'number'
|
||||
],
|
||||
[
|
||||
'attribute' => 'rfid_key',
|
||||
'value' => 'rfid_key'
|
||||
],
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'value' => 'statusHuman'
|
||||
|
||||
@ -22,6 +22,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'number',
|
||||
'rfid_key',
|
||||
['attribute' => 'status', 'value' => $model->statusHuman],
|
||||
['attribute' => 'type', 'value' => $model->typeHuman],
|
||||
'created_at:datetime',
|
||||
|
||||
@ -14,6 +14,7 @@ use common\models\Key;
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
||||
<?= $form->field($model, 'rfid_key')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?>
|
||||
|
||||
|
||||
@ -11,8 +11,6 @@ use common\models\Key;
|
||||
|
||||
<div class="key-search">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
@ -20,8 +18,14 @@ use common\models\Key;
|
||||
]); ?>
|
||||
|
||||
<?php //echo $form->field($model, 'id_key') ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?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 //echo $form->field($model, 'status') ?>
|
||||
@ -39,6 +43,4 @@ use common\models\Key;
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div><!-- col-md-4 END -->
|
||||
</div><!-- row END -->
|
||||
</div>
|
||||
|
||||
@ -30,6 +30,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
// ['class' => 'yii\grid\SerialColumn'],
|
||||
// 'id_key',
|
||||
'number',
|
||||
'rfid_key',
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'value' => function ($model, $key, $index, $column){
|
||||
@ -39,7 +40,11 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
}
|
||||
],
|
||||
//'status',
|
||||
'type',
|
||||
[
|
||||
'attribute' =>'type',
|
||||
'value' =>'humanType'
|
||||
|
||||
],
|
||||
'created_at',
|
||||
// 'updated_at',
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'attributes' => [
|
||||
'id_key',
|
||||
'number',
|
||||
'rfid_key',
|
||||
'status',
|
||||
'type',
|
||||
'created_at',
|
||||
|
||||
@ -37,5 +37,6 @@ return [
|
||||
'Update' => 'Módosítás',
|
||||
'Update {modelClass}: ' => '{modelClass} módosítása:',
|
||||
'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',
|
||||
'Search' => 'Keresés',
|
||||
'Type' => 'Típus',
|
||||
'Key' => 'Kulcs',
|
||||
'Created At' => 'Létrehozva',
|
||||
'RFID key' => 'RFID szám',
|
||||
];
|
||||
?>
|
||||
|
||||
@ -42,6 +42,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
[['number', 'type','status'], 'required'],
|
||||
[['status', 'type'], 'integer'],
|
||||
[['number'], 'string', 'max' => 20],
|
||||
[['rfid_key'], 'string', 'max' => 25],
|
||||
[['number'], 'unique' ]
|
||||
];
|
||||
}
|
||||
@ -54,6 +55,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
return [
|
||||
'id_card' => Yii::t('common/card', 'Id Card'),
|
||||
'number' => Yii::t('common/card', 'Number'),
|
||||
'rfid_key' => Yii::t('common/card', 'RFID key'),
|
||||
'status' => Yii::t('common/card', 'Status'),
|
||||
'type' => Yii::t('common/card', 'Type'),
|
||||
'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'], 'safe'], //bármi lehet
|
||||
[['number'], 'string', 'max' => 255],
|
||||
[['rfid_key'], 'string', 'max' => 25],
|
||||
[['number' ], 'unique'],
|
||||
];
|
||||
}
|
||||
@ -61,6 +62,7 @@ class Key extends \yii\db\ActiveRecord
|
||||
return [
|
||||
'id_key' => Yii::t('common/key', 'Id Key'),
|
||||
'number' => Yii::t('common/key', 'Number'),
|
||||
'rfid_key' => Yii::t('common/key', 'RFID key'),
|
||||
'status' => Yii::t('common/key', 'Status'),
|
||||
'type' => Yii::t('common/key', 'Type'),
|
||||
'created_at' => Yii::t('common/key', 'Created At'),
|
||||
@ -81,4 +83,13 @@ class Key extends \yii\db\ActiveRecord
|
||||
];
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
$this->addColumn("customer", "id_key", "int");
|
||||
$this->addColumn("key", "id_key", "int");
|
||||
}
|
||||
|
||||
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(){
|
||||
|
||||
$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 ){
|
||||
$this->customer = $this->card->customer;
|
||||
$this->readValidTickets();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user