Finish version/v.0.0.8

This commit is contained in:
Roland Schneider 2015-12-11 23:37:20 +01:00
commit f6b483a9f9
16 changed files with 153 additions and 36 deletions

View File

@ -38,7 +38,7 @@ class KeyController extends Controller
// backend/views/kex/index.php // backend/views/kex/index.php
return $this->render('index', [ return $this->render('index', [
'searchModel' => $searchModel, 'searchModel' => $searchModel,
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider, //csomagoló osztály a queryhez
]); ]);
} }

View File

@ -18,8 +18,9 @@ class KeySearch extends Key
public function rules() public function rules()
{ {
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']
]; ];
} }
@ -57,6 +58,7 @@ class KeySearch extends Key
$query->andFilterWhere([ $query->andFilterWhere([
'id_key' => $this->id_key, 'id_key' => $this->id_key,
'number' => $this->number,
'status' => $this->status, 'status' => $this->status,
'type' => $this->type, 'type' => $this->type,
'created_at' => $this->created_at, 'created_at' => $this->created_at,

View File

@ -2,6 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use common\models\Key;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Key */ /* @var $model common\models\Key */
@ -14,16 +15,16 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->textInput() ?> <?= $form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?>
<?= $form->field($model, 'type')->textInput() ?> <?= $form->field($model, 'type')->dropDownList( Key::types() /* array(10=>"kulcs") // <--ez így ok */ ) /* $form->field($model, 'type')->textInput() */ ?>
<?= $form->field($model, 'created_at')->textInput() ?> <?php //echo $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?> <?php //echo $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend/key', 'Create') : Yii::t('backend/key', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::submitButton($model->isNewRecord ? Yii::t('backend/key', 'Create Save') : Yii::t('backend/key', 'Update Save'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>

View File

@ -2,6 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use common\models\Key;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model backend\models\KeySearch */ /* @var $model backend\models\KeySearch */
@ -10,28 +11,34 @@ use yii\widgets\ActiveForm;
<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'],
'method' => 'get', 'method' => 'get',
]); ?> ]); ?>
<?= $form->field($model, 'id_key') ?> <?php //echo $form->field($model, 'id_key') ?>
<?= $form->field($model, 'number') ?> <?php echo $form->field($model, 'number') ?>
<?php //$form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?>
<?= $form->field($model, 'status') ?> <?php //echo $form->field($model, 'status') ?>
<?= $form->field($model, 'type') ?> <?php //echo $form->field($model, 'type') ?>
<?= $form->field($model, 'created_at') ?> <?php //echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?> <?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton(Yii::t('backend/key', 'Search'), ['class' => 'btn btn-primary']) ?> <?= Html::submitButton(Yii::t('backend/key', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('backend/key', 'Reset'), ['class' => 'btn btn-default']) ?> <?php //echo Html::resetButton(Yii::t('backend/key', 'Reset'), ['class' => 'btn btn-default']); /* Reset gomb */ ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div><!-- col-md-4 END -->
</div><!-- row END -->
</div> </div>

View File

@ -1,7 +1,7 @@
<?php <?php
use yii\helpers\Html; use yii\helpers\Html;
use common\models\Key;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Key */ /* @var $model common\models\Key */
@ -12,7 +12,7 @@ $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="key-create"> <div class="key-create">
<h1><?= Html::encode($this->title) ?></h1> <h1>Új kulcs létrehozás <?php /*echo Html::encode($this->title)*/ ?></h1>
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,

View File

@ -2,6 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\grid\GridView; use yii\grid\GridView;
use common\models\Key;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel backend\models\KeySearch */ /* @var $searchModel backend\models\KeySearch */
@ -11,28 +12,41 @@ $this->title = Yii::t('backend/key', 'Keys');
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="key-index"> <div class="key-index">
asdf
<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo $this->render('_search', ['model' => $searchModel]); /* ezt megcsinálni hogy csak numberre lehessen itt a fitness-web/backend/views/key/_search.php töltődik be */?>
<p> <p>
<?= Html::a(Yii::t('backend/key', 'Create Key'), ['create'], ['class' => 'btn btn-success']) ?> <?php
// Új kulcs gomb kigenerálása a Yii::t('backend/key' a fitness-web/common/messages/hu/backend/key.php-ba lesz (miután létrehoztam)
echo Html::a(Yii::t('backend/key', 'Create Key'), ['create'], ['class' => 'btn btn-success']);
?>
</p> </p>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel, //'filterModel' => $searchModel, // ezt nem szeretjük
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], // ['class' => 'yii\grid\SerialColumn'],
// 'id_key',
'id_key',
'number', 'number',
'status', [
'attribute' => 'status',
'value' => function ($model, $key, $index, $column){
$statuszok = Key::statuses();
$result = $statuszok[$model->status];
return $result;
}
],
//'status',
'type', 'type',
'created_at', 'created_at',
// 'updated_at', // 'updated_at',
['class' => 'yii\grid\ActionColumn'], [
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}',
],
], ],
]); ?> ]); ?>

View File

@ -1,6 +1,7 @@
<?php <?php
use yii\helpers\Html; use yii\helpers\Html;
use common\models\Key;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Key */ /* @var $model common\models\Key */

View File

@ -1,3 +1,7 @@
-0.0.8
fix account state on reception
add keys
new card type: old
-0.0.7 -0.0.7
disable csrf in frontend and backend disable csrf in frontend and backend
reception account_state javascript fix reception account_state javascript fix

View File

@ -3,5 +3,5 @@ return [
'adminEmail' => 'rocho02@gmail.com', 'adminEmail' => 'rocho02@gmail.com',
'supportEmail' => 'rocho02@gmail.com', 'supportEmail' => 'rocho02@gmail.com',
'user.passwordResetTokenExpire' => 3600, 'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.7' 'version' => 'v0.0.8'
]; ];

View File

@ -0,0 +1,14 @@
<?php
return [
'Keys' => 'Kulcsok',
'Key' => 'Kulcs',
'Create Key' => 'Új kulcs',
'Search' => 'Keresés',
'Reset' => 'Mégsem',
'Update {modelClass}: ' => 'Szerkesztés {modelClass}: ',
'Update' => 'Szerkesztés',
'Update Save' => 'Mentés',
'Create Save' => 'Mentés',
];
?>

View File

@ -37,4 +37,5 @@ 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'
]; ];

View File

@ -0,0 +1,11 @@
<?php
return [
'Active' => 'Aktív',
'Inactive' => 'Inaktív',
'Number' => 'Név, szám',
'Status' => 'Státusz',
'Search' => 'Keresés',
'Type' => 'Típus',
'Created At' => 'Létrehozva',
];
?>

View File

@ -23,6 +23,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
const TYPE_RFID = 10; const TYPE_RFID = 10;
const TYPE_QRCODE = 20; const TYPE_QRCODE = 20;
const TYPE_BARCODE = 30; const TYPE_BARCODE = 30;
const TYPE_OLD = 40;
/** /**
* @inheritdoc * @inheritdoc
@ -82,6 +83,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
self::TYPE_RFID => Yii::t('common/card', 'RFID'), self::TYPE_RFID => Yii::t('common/card', 'RFID'),
self::TYPE_QRCODE => Yii::t('common/card', 'QRCODE'), self::TYPE_QRCODE => Yii::t('common/card', 'QRCODE'),
self::TYPE_BARCODE => Yii::t('common/card', 'BARCODE'), self::TYPE_BARCODE => Yii::t('common/card', 'BARCODE'),
self::TYPE_OLD => Yii::t('common/card', 'OLD'),
]; ];
} }

View File

@ -3,6 +3,7 @@
namespace common\models; namespace common\models;
use Yii; use Yii;
use yii\behaviors\TimestampBehavior;
/** /**
* This is the model class for table "key". * This is the model class for table "key".
@ -16,6 +17,10 @@ use Yii;
*/ */
class Key extends \yii\db\ActiveRecord class Key extends \yii\db\ActiveRecord
{ {
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
const TYPE_NORMAL = 10;
const TYPE_DEFAULT = self::TYPE_NORMAL;
/** /**
* @inheritdoc * @inheritdoc
*/ */
@ -30,15 +35,26 @@ class Key extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['status', 'type'], 'integer'], [['status', 'type'], 'integer'], //csak szám
[['created_at', 'updated_at'], 'required'], //[['created_at', 'updated_at'], 'required'],//kötelezőek
[['created_at', 'updated_at'], 'safe'], //[['created_at', 'updated_at'], 'safe'], //bármi lehet
[['number'], 'string', 'max' => 255] [['number'], 'string', 'max' => 255],
[['number' ], 'unique'],
];
}
public function behaviors()
{
return [
[ 'class' => TimestampBehavior::className(), //mentés előtt kitölti a save methódus meghívása előtt kitölti a created... mezőket
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
]; ];
} }
/** /**
* @inheritdoc * @inheritdoc Minden modelnak van egy Attribut labels függvénye ami modelhez tartalmazza a fordítások
*/ */
public function attributeLabels() public function attributeLabels()
{ {
@ -51,4 +67,18 @@ class Key extends \yii\db\ActiveRecord
'updated_at' => Yii::t('common/key', 'Updated At'), 'updated_at' => Yii::t('common/key', 'Updated At'),
]; ];
} }
static function statuses() {
return [
self::STATUS_ACTIVE => Yii::t('common/key', 'Active'), // t - translate a key a kategoria common/messages/hu/common/key.php mappa (létre kell hozni a fájlt)
self::STATUS_DELETED => Yii::t('common/key', 'Inactive'),
];
}
public static function types(){
return [
self::TYPE_NORMAL => Yii::t('common/key', 'Key'),
];
}
} }

View File

@ -0,0 +1,30 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151208_212339_alter__table__customer__add__column__key extends Migration
{
public function up()
{
$this->addColumn("customer", "id_key", "int");
}
public function down()
{
echo "m151208_212339_alter__table__customer__add__column__key cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -6,9 +6,9 @@
<?= $form->field($model, 'banknote_10_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '10']) ?> <?= $form->field($model, 'banknote_10_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '10']) ?>
<?= $form->field($model, 'banknote_20_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '15']) ?> <?= $form->field($model, 'banknote_20_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '20']) ?>
<?= $form->field($model, 'banknote_50_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '20']) ?> <?= $form->field($model, 'banknote_50_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '50']) ?>
</div> </div>
<div class='col-md-4'> <div class='col-md-4'>
<?= $form->field($model, 'banknote_100_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '100']) ?> <?= $form->field($model, 'banknote_100_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '100']) ?>