From 4872abbb2090f3a1828016d360a6581ca2b0d50c Mon Sep 17 00:00:00 2001 From: rocho Date: Mon, 30 Nov 2015 19:21:27 +0100 Subject: [PATCH 1/4] =?UTF-8?q??= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/main.php | 4 ++-- backend/controllers/KeyController.php | 2 +- backend/models/KeySearch.php | 1 + backend/views/key/_form.php | 7 +++--- backend/views/key/_search.php | 14 ++++++------ backend/views/key/create.php | 2 +- backend/views/key/index.php | 27 ++++++++++++++++------- common/messages/hu/backend/key.php | 8 +++++++ common/messages/hu/common/key.php | 11 ++++++++++ common/models/Key.php | 31 ++++++++++++++++++++++----- 10 files changed, 81 insertions(+), 26 deletions(-) create mode 100644 common/messages/hu/backend/key.php create mode 100644 common/messages/hu/common/key.php diff --git a/backend/config/main.php b/backend/config/main.php index af688c7..d88d098 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -14,12 +14,12 @@ return [ 'bootstrap' => ['log'], 'modules' => [], 'components' => [ - 'request' => [ + /*'request' => [ 'csrfParam' => '_backendCSRF', 'csrfCookie' => [ 'path' => '/backend/web', ], - ], + ],*/ 'user' => [ 'identityClass' => 'common\models\User', 'enableAutoLogin' => true, diff --git a/backend/controllers/KeyController.php b/backend/controllers/KeyController.php index c07709c..9d2efb7 100644 --- a/backend/controllers/KeyController.php +++ b/backend/controllers/KeyController.php @@ -38,7 +38,7 @@ class KeyController extends Controller // backend/views/kex/index.php return $this->render('index', [ 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, + 'dataProvider' => $dataProvider, //csomagoló osztály a queryhez ]); } diff --git a/backend/models/KeySearch.php b/backend/models/KeySearch.php index 79eeb5b..72f9773 100644 --- a/backend/models/KeySearch.php +++ b/backend/models/KeySearch.php @@ -57,6 +57,7 @@ class KeySearch extends Key $query->andFilterWhere([ 'id_key' => $this->id_key, + 'number' => $this->number, 'status' => $this->status, 'type' => $this->type, 'created_at' => $this->created_at, diff --git a/backend/views/key/_form.php b/backend/views/key/_form.php index 0f26488..3f4d051 100644 --- a/backend/views/key/_form.php +++ b/backend/views/key/_form.php @@ -2,6 +2,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; +use common\models\Key; /* @var $this yii\web\View */ /* @var $model common\models\Key */ @@ -14,13 +15,13 @@ use yii\widgets\ActiveForm; field($model, 'number')->textInput(['maxlength' => true]) ?> - field($model, 'status')->textInput() ?> + field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?> field($model, 'type')->textInput() ?> - field($model, 'created_at')->textInput() ?> + field($model, 'created_at')->textInput() ?> - field($model, 'updated_at')->textInput() ?> + field($model, 'updated_at')->textInput() ?>
isNewRecord ? Yii::t('backend/key', 'Create') : Yii::t('backend/key', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> diff --git a/backend/views/key/_search.php b/backend/views/key/_search.php index 6610f21..06395b2 100644 --- a/backend/views/key/_search.php +++ b/backend/views/key/_search.php @@ -2,6 +2,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; +use common\models\Key; /* @var $this yii\web\View */ /* @var $model backend\models\KeySearch */ @@ -15,21 +16,22 @@ use yii\widgets\ActiveForm; 'method' => 'get', ]); ?> - field($model, 'id_key') ?> + field($model, 'id_key') ?> - field($model, 'number') ?> + field($model, 'number') ?> + field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?> - field($model, 'status') ?> + field($model, 'status') ?> - field($model, 'type') ?> + field($model, 'type') ?> - field($model, 'created_at') ?> + field($model, 'created_at') ?> field($model, 'updated_at') ?>
'btn btn-primary']) ?> - 'btn btn-default']) ?> + 'btn btn-default']); /* Reset gomb */ ?>
diff --git a/backend/views/key/create.php b/backend/views/key/create.php index 19177f7..47bc7c7 100644 --- a/backend/views/key/create.php +++ b/backend/views/key/create.php @@ -12,7 +12,7 @@ $this->params['breadcrumbs'][] = $this->title; ?>
-

title) ?>

+

Új kulcs létrehozás title)*/ ?>

render('_form', [ 'model' => $model, diff --git a/backend/views/key/index.php b/backend/views/key/index.php index c8ab4cc..7f9479c 100644 --- a/backend/views/key/index.php +++ b/backend/views/key/index.php @@ -2,6 +2,7 @@ use yii\helpers\Html; use yii\grid\GridView; +use common\models\Key; /* @var $this yii\web\View */ /* @var $searchModel backend\models\KeySearch */ @@ -11,23 +12,33 @@ $this->title = Yii::t('backend/key', 'Keys'); $this->params['breadcrumbs'][] = $this->title; ?>
-asdf +

title) ?>

- render('_search', ['model' => $searchModel]); ?> + render('_search', ['model' => $searchModel]); /* ezt megcsinálni hogy csak numberre lehessen itt a fitness-web/backend/views/key/_search.php töltődik be */?>

- 'btn btn-success']) ?> + 'btn btn-success']); + ?>

$dataProvider, - 'filterModel' => $searchModel, + //'filterModel' => $searchModel, // ezt nem szeretjük 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'id_key', + // ['class' => 'yii\grid\SerialColumn'], + // 'id_key', 'number', - 'status', + [ + 'attribute' => 'status', + 'value' => function ($model, $key, $index, $column){ + $statuszok = Key::statuses(); + $result = $statuszok[$model->status]; + return $result; + } + ], + //'status', 'type', 'created_at', // 'updated_at', diff --git a/common/messages/hu/backend/key.php b/common/messages/hu/backend/key.php new file mode 100644 index 0000000..a57a6b4 --- /dev/null +++ b/common/messages/hu/backend/key.php @@ -0,0 +1,8 @@ + 'Kulcsok', + 'Create Key' => 'Új kulcs', + 'Search' => 'Keresés', + 'Reset' => 'Mégsem' +]; +?> diff --git a/common/messages/hu/common/key.php b/common/messages/hu/common/key.php new file mode 100644 index 0000000..4ca4bc0 --- /dev/null +++ b/common/messages/hu/common/key.php @@ -0,0 +1,11 @@ + 'Aktív', + 'Inactive' => 'Inaktív', + 'Number' => 'Név, szám', + 'Status' => 'Státusz', + 'Search' => 'Keresés', + 'Type' => 'Típus', + 'Created At' => 'Létrehozva', +]; +?> diff --git a/common/models/Key.php b/common/models/Key.php index 985a764..de7cb24 100644 --- a/common/models/Key.php +++ b/common/models/Key.php @@ -3,6 +3,7 @@ namespace common\models; use Yii; +use yii\behaviors\TimestampBehavior; /** * This is the model class for table "key". @@ -16,6 +17,8 @@ use Yii; */ class Key extends \yii\db\ActiveRecord { + const STATUS_DELETED = 0; + const STATUS_ACTIVE = 10; /** * @inheritdoc */ @@ -30,15 +33,26 @@ class Key extends \yii\db\ActiveRecord public function rules() { return [ - [['status', 'type'], 'integer'], - [['created_at', 'updated_at'], 'required'], - [['created_at', 'updated_at'], 'safe'], - [['number'], 'string', 'max' => 255] + [['status', 'type'], 'integer'], //csak szám + //[['created_at', 'updated_at'], 'required'],//kötelezőek + //[['created_at', 'updated_at'], 'safe'], //bármi lehet + [['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() { @@ -51,4 +65,11 @@ class Key extends \yii\db\ActiveRecord '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'), + ]; + } } From 783d889ec7b8aae110792a2ce31aa9a293613686 Mon Sep 17 00:00:00 2001 From: rocho Date: Tue, 1 Dec 2015 17:55:28 +0100 Subject: [PATCH 2/4] =?UTF-8?q?kulcsok=20=C3=BAj=20=C3=A9s=20szerkeszt?= =?UTF-8?q?=C3=A9si=20n=C3=A9zetek=20ford=C3=ADt=C3=A1sa,=20leg=C3=B6rd?= =?UTF-8?q?=C3=BCl=C5=91=20lista=20alkalmaz=C3=A1sa=20type-ra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/models/KeySearch.php | 5 +++-- backend/views/key/_form.php | 4 ++-- backend/views/key/_search.php | 11 ++++++++--- backend/views/key/create.php | 2 +- backend/views/key/index.php | 7 +++++-- backend/views/key/update.php | 1 + common/messages/hu/backend/key.php | 8 +++++++- common/models/Key.php | 9 +++++++++ 8 files changed, 36 insertions(+), 11 deletions(-) diff --git a/backend/models/KeySearch.php b/backend/models/KeySearch.php index 72f9773..a35af44 100644 --- a/backend/models/KeySearch.php +++ b/backend/models/KeySearch.php @@ -18,8 +18,9 @@ class KeySearch extends Key public function rules() { return [ - [['id_key', 'status', 'type'], 'integer'], - [['number', 'created_at', 'updated_at'], 'safe'], + /*[['id_key', 'status', 'type'], 'integer'], + [['number', 'created_at', 'updated_at'], 'safe'],*/ + [['number'], 'safe'] ]; } diff --git a/backend/views/key/_form.php b/backend/views/key/_form.php index 3f4d051..bd62298 100644 --- a/backend/views/key/_form.php +++ b/backend/views/key/_form.php @@ -17,14 +17,14 @@ use common\models\Key; field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?> - field($model, 'type')->textInput() ?> + field($model, 'type')->dropDownList( Key::types() /* array(10=>"kulcs") // <--ez így ok */ ) /* $form->field($model, 'type')->textInput() */ ?> field($model, 'created_at')->textInput() ?> field($model, 'updated_at')->textInput() ?>
- isNewRecord ? Yii::t('backend/key', 'Create') : Yii::t('backend/key', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> + isNewRecord ? Yii::t('backend/key', 'Create Save') : Yii::t('backend/key', 'Update Save'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
diff --git a/backend/views/key/_search.php b/backend/views/key/_search.php index 06395b2..a69436c 100644 --- a/backend/views/key/_search.php +++ b/backend/views/key/_search.php @@ -10,7 +10,10 @@ use common\models\Key; ?> diff --git a/backend/views/key/create.php b/backend/views/key/create.php index 47bc7c7..39bcb99 100644 --- a/backend/views/key/create.php +++ b/backend/views/key/create.php @@ -1,7 +1,7 @@ title = Yii::t('backend/key', 'Keys'); $this->params['breadcrumbs'][] = $this->title; ?> -
+

title) ?>

render('_search', ['model' => $searchModel]); /* ezt megcsinálni hogy csak numberre lehessen itt a fitness-web/backend/views/key/_search.php töltődik be */?> @@ -43,7 +43,10 @@ $this->params['breadcrumbs'][] = $this->title; 'created_at', // 'updated_at', - ['class' => 'yii\grid\ActionColumn'], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{view} {update}', + ], ], ]); ?> diff --git a/backend/views/key/update.php b/backend/views/key/update.php index e3b223b..10fab8e 100644 --- a/backend/views/key/update.php +++ b/backend/views/key/update.php @@ -1,6 +1,7 @@ 'Kulcsok', + 'Key' => 'Kulcs', 'Create Key' => 'Új kulcs', 'Search' => 'Keresés', - 'Reset' => 'Mégsem' + 'Reset' => 'Mégsem', + 'Update {modelClass}: ' => 'Szerkesztés {modelClass}: ', + 'Update' => 'Szerkesztés', + 'Update Save' => 'Mentés', + 'Create Save' => 'Mentés', + ]; ?> diff --git a/common/models/Key.php b/common/models/Key.php index de7cb24..f4e8b77 100644 --- a/common/models/Key.php +++ b/common/models/Key.php @@ -19,6 +19,8 @@ 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 */ @@ -72,4 +74,11 @@ class Key extends \yii\db\ActiveRecord self::STATUS_DELETED => Yii::t('common/key', 'Inactive'), ]; } + + public static function types(){ + return [ + self::TYPE_NORMAL => Yii::t('common/key', 'Key'), + ]; + } + } From 78e36664ab0ab59d66b62a43fc556912be980350 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Tue, 8 Dec 2015 22:28:16 +0100 Subject: [PATCH 3/4] add migration add column id_key to customer --- ...ter__table__customer__add__column__key.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 console/migrations/m151208_212339_alter__table__customer__add__column__key.php diff --git a/console/migrations/m151208_212339_alter__table__customer__add__column__key.php b/console/migrations/m151208_212339_alter__table__customer__add__column__key.php new file mode 100644 index 0000000..2a4cca8 --- /dev/null +++ b/console/migrations/m151208_212339_alter__table__customer__add__column__key.php @@ -0,0 +1,30 @@ +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() + { + } + */ +} From b42e6f78e6b7860be28b859ba0c96e0537ec7e91 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Fri, 11 Dec 2015 23:15:53 +0100 Subject: [PATCH 4/4] add card type 'old', fix frontend notes --- common/messages/hu/common/card.php | 1 + common/models/Card.php | 2 ++ frontend/views/account-state/_notes.php | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/messages/hu/common/card.php b/common/messages/hu/common/card.php index 1e3d4b7..e4dfa5a 100644 --- a/common/messages/hu/common/card.php +++ b/common/messages/hu/common/card.php @@ -37,4 +37,5 @@ return [ 'Update' => 'Módosítás', 'Update {modelClass}: ' => '{modelClass} módosítása:', 'Updated At' => 'Módosítás ideje', + 'OLD' => 'Régi Rendszer' ]; diff --git a/common/models/Card.php b/common/models/Card.php index 6468ed1..28e8af6 100644 --- a/common/models/Card.php +++ b/common/models/Card.php @@ -23,6 +23,7 @@ class Card extends \common\models\BaseFitnessActiveRecord const TYPE_RFID = 10; const TYPE_QRCODE = 20; const TYPE_BARCODE = 30; + const TYPE_OLD = 40; /** * @inheritdoc @@ -82,6 +83,7 @@ class Card extends \common\models\BaseFitnessActiveRecord self::TYPE_RFID => Yii::t('common/card', 'RFID'), self::TYPE_QRCODE => Yii::t('common/card', 'QRCODE'), self::TYPE_BARCODE => Yii::t('common/card', 'BARCODE'), + self::TYPE_OLD => Yii::t('common/card', 'OLD'), ]; } diff --git a/frontend/views/account-state/_notes.php b/frontend/views/account-state/_notes.php index fa614dd..a93f7f4 100644 --- a/frontend/views/account-state/_notes.php +++ b/frontend/views/account-state/_notes.php @@ -6,9 +6,9 @@ field($model, 'banknote_10_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '10']) ?> - field($model, 'banknote_20_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '15']) ?> + field($model, 'banknote_20_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '20']) ?> - field($model, 'banknote_50_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '20']) ?> + field($model, 'banknote_50_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '50']) ?>
field($model, 'banknote_100_ft')->textInput([ 'class' => 'form-control note-input text-right', 'data-value' => '100']) ?>