Finish 29 (account/kassza)
This commit is contained in:
commit
0fed98d239
@ -36,6 +36,7 @@ class AdminMenuStructure{
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
$items[] = ['label' => 'Raktárak', 'url' =>['/warehouse/index']];
|
$items[] = ['label' => 'Raktárak', 'url' =>['/warehouse/index']];
|
||||||
|
$items[] = ['label' => 'Kasszák', 'url' =>['/account/index']];
|
||||||
|
|
||||||
if ( count($items) > 0 ){
|
if ( count($items) > 0 ){
|
||||||
$userMainMenu = ['label' => 'Beállítások', 'url' => null,
|
$userMainMenu = ['label' => 'Beállítások', 'url' => null,
|
||||||
|
|||||||
121
backend/controllers/AccountController.php
Normal file
121
backend/controllers/AccountController.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use common\models\Account;
|
||||||
|
use backend\models\AccountSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AccountController implements the CRUD actions for Account model.
|
||||||
|
*/
|
||||||
|
class AccountController extends Controller
|
||||||
|
{
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['post'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Account models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new AccountSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single Account model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Account model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new Account();
|
||||||
|
$model->status = Account::STATUS_ACTIVE;
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id_account]);
|
||||||
|
} else {
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing Account model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id_account]);
|
||||||
|
} else {
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Account model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
// public function actionDelete($id)
|
||||||
|
// {
|
||||||
|
// $this->findModel($id)->delete();
|
||||||
|
|
||||||
|
// return $this->redirect(['index']);
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the Account model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return Account the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = Account::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -97,15 +97,15 @@ class WarehouseController extends Controller
|
|||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function actionDelete($id)
|
// public function actionDelete($id)
|
||||||
{
|
// {
|
||||||
$warehouse = $this->findModel($id);
|
// $warehouse = $this->findModel($id);
|
||||||
|
|
||||||
$warehouse->updateAttributes(['status' => Warehouse::STATUS_DELETED]);
|
// $warehouse->updateAttributes(['status' => Warehouse::STATUS_DELETED]);
|
||||||
|
|
||||||
|
|
||||||
return $this->redirect(['index']);
|
// return $this->redirect(['index']);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the Warehouse model based on its primary key value.
|
* Finds the Warehouse model based on its primary key value.
|
||||||
|
|||||||
121
backend/models/AccountController.php
Normal file
121
backend/models/AccountController.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use common\models\Account;
|
||||||
|
use backend\models\AccountSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AccountController implements the CRUD actions for Account model.
|
||||||
|
*/
|
||||||
|
class AccountController extends Controller
|
||||||
|
{
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['post'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Account models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new AccountSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single Account model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Account model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new Account();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id_account]);
|
||||||
|
} else {
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing Account model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id_account]);
|
||||||
|
} else {
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Account model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionDelete($id)
|
||||||
|
{
|
||||||
|
$this->findModel($id)->delete();
|
||||||
|
|
||||||
|
return $this->redirect(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the Account model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return Account the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = Account::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
70
backend/models/AccountSearch.php
Normal file
70
backend/models/AccountSearch.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AccountSearch represents the model behind the search form about `common\models\Account`.
|
||||||
|
*/
|
||||||
|
class AccountSearch extends Account
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id_account', 'status', 'type'], 'integer'],
|
||||||
|
[['name', 'created_at', 'updated_at'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Account::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id_account' => $this->id_account,
|
||||||
|
'status' => $this->status,
|
||||||
|
'type' => $this->type,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'name', $this->name]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
29
backend/views/account/_form.php
Normal file
29
backend/views/account/_form.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use common\models\Account;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Account */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="account-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'status')->checkbox( ['value' => 10, 'label' => Yii::t('common/account', "Active") ]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'type')->dropDownList(Account::types()) ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/account', 'Create') : Yii::t('common/account', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
37
backend/views/account/_search.php
Normal file
37
backend/views/account/_search.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\AccountSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="account-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_account') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'name') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'status') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'type') ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'created_at') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'updated_at') ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('common/account', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::resetButton(Yii::t('common/account', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/account/create.php
Normal file
21
backend/views/account/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Account */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/account', 'Create Account');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/account', 'Accounts'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="account-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
44
backend/views/account/index.php
Normal file
44
backend/views/account/index.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\AccountSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/account', 'Accounts');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="account-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('common/account', 'Create Account'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'attribute' => 'status',
|
||||||
|
'value' => 'statusHuman',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'type',
|
||||||
|
'value' => 'typeHuman',
|
||||||
|
],
|
||||||
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view} {update}'
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
23
backend/views/account/update.php
Normal file
23
backend/views/account/update.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Account */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/account', 'Update {modelClass}: ', [
|
||||||
|
'modelClass' => Yii::t('common/account', 'Account'),
|
||||||
|
]) . ' ' . $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/account', 'Accounts'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_account]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('common/account', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="account-update">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
48
backend/views/account/view.php
Normal file
48
backend/views/account/view.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Account */
|
||||||
|
|
||||||
|
$this->title = $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/account', 'Accounts'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="account-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('common/account', 'Update'), ['update', 'id' => $model->id_account], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?php
|
||||||
|
/*Html::a(Yii::t('common/account', 'Delete'), ['delete', 'id' => $model->id_account], [
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
'data' => [
|
||||||
|
'confirm' => Yii::t('common/account', 'Are you sure you want to delete this item?'),
|
||||||
|
'method' => 'post',
|
||||||
|
],
|
||||||
|
]) */
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'attribute' => 'status',
|
||||||
|
'label' => Yii::t('common/account', "Active"),
|
||||||
|
'value' => $model->statusHuman
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'type',
|
||||||
|
'value' => $model->typeHuman
|
||||||
|
],
|
||||||
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -6,7 +6,7 @@ use yii\helpers\Html;
|
|||||||
/* @var $model common\models\Warehouse */
|
/* @var $model common\models\Warehouse */
|
||||||
|
|
||||||
$this->title = Yii::t('common/warehouse', 'Update {modelClass}: ', [
|
$this->title = Yii::t('common/warehouse', 'Update {modelClass}: ', [
|
||||||
'modelClass' => 'Warehouse',
|
'modelClass' => Yii::t("common/warehouse", "Warehouse"),
|
||||||
]) . ' ' . $model->name;
|
]) . ' ' . $model->name;
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/warehouse', 'Warehouses'), 'url' => ['index']];
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/warehouse', 'Warehouses'), 'url' => ['index']];
|
||||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_warehouse]];
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_warehouse]];
|
||||||
|
|||||||
38
common/messages/hu/common/account.php
Normal file
38
common/messages/hu/common/account.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'Accounts' => 'Kasszák',
|
||||||
|
'Account' => 'Kassza',
|
||||||
|
'Active' => 'Aktív',
|
||||||
|
'Create' => 'Inaktív',
|
||||||
|
'Create Account' => 'Új kassza',
|
||||||
|
'Created At' => 'Létrehozás ideje',
|
||||||
|
'Id Account' => 'Azonosító',
|
||||||
|
'Inactive' => 'Inaktív',
|
||||||
|
'Name' => 'Név',
|
||||||
|
'Only the name is visible' => 'Csak a név látható',
|
||||||
|
'Reset' => '',
|
||||||
|
'Search' => 'Keresés',
|
||||||
|
'Status' => 'Státusz',
|
||||||
|
'Type' => 'Típus',
|
||||||
|
'Update' => 'Módosítás',
|
||||||
|
'Update {modelClass}: ' => '{modelClass} módosítása: ',
|
||||||
|
'Updated At' => 'Módosítás ideje',
|
||||||
|
'Visible for all' => 'Mindenkinek látható',
|
||||||
|
];
|
||||||
@ -31,4 +31,5 @@ return [
|
|||||||
'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',
|
||||||
'Warehouses' => 'Raktárak',
|
'Warehouses' => 'Raktárak',
|
||||||
|
'Warehouse' => 'Raktár',
|
||||||
];
|
];
|
||||||
|
|||||||
106
common/models/Account.php
Normal file
106
common/models/Account.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "account".
|
||||||
|
*
|
||||||
|
* @property integer $id_account
|
||||||
|
* @property string $name
|
||||||
|
* @property integer $status
|
||||||
|
* @property integer $type
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*/
|
||||||
|
class Account extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
|
||||||
|
const STATUS_DELETED = 0;
|
||||||
|
const STATUS_ACTIVE = 10;
|
||||||
|
|
||||||
|
const TYPE_ALL = 0;
|
||||||
|
const TYPE_VALUE_HIDDEN = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'account';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[ 'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['name', 'type'], 'required'],
|
||||||
|
[['name', ], 'unique'],
|
||||||
|
[['status', 'type'], 'integer'],
|
||||||
|
[['name'], 'string', 'max' => 64]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id_account' => Yii::t('common/account', 'Id Account'),
|
||||||
|
'name' => Yii::t('common/account', 'Name'),
|
||||||
|
'status' => Yii::t('common/account', 'Status'),
|
||||||
|
'type' => Yii::t('common/account', 'Type'),
|
||||||
|
'created_at' => Yii::t('common/account', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('common/account', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
static function statuses() {
|
||||||
|
return [
|
||||||
|
self::STATUS_ACTIVE => Yii::t('common/account', 'Active'),
|
||||||
|
self::STATUS_DELETED => Yii::t('common/account', 'Inactive'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatusHuman(){
|
||||||
|
$result = null;
|
||||||
|
$s = self::statuses($this->status);
|
||||||
|
if ( array_key_exists($this->status, $s)){
|
||||||
|
$result = $s[$this->status];
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function types() {
|
||||||
|
return [
|
||||||
|
self::TYPE_ALL => Yii::t('common/account', 'Visible for all'),
|
||||||
|
self::TYPE_VALUE_HIDDEN => Yii::t('common/account', 'Only the name is visible'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypeHuman(){
|
||||||
|
$result = null;
|
||||||
|
$s = self::types($this->type);
|
||||||
|
if ( array_key_exists($this->type, $s)){
|
||||||
|
$result = $s[$this->status];
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
console/migrations/m150920_191201_add__table__account.php
Normal file
40
console/migrations/m150920_191201_add__table__account.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m150920_191201_add__table__account extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$tableOptions = null;
|
||||||
|
if ($this->db->driverName === 'mysql') {
|
||||||
|
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||||
|
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->createTable('{{%account}}', [
|
||||||
|
'id_account' => $this->primaryKey(),
|
||||||
|
'name' => $this->string(64)->notNull(),
|
||||||
|
'status' => $this->smallInteger()->notNull()->defaultValue(10),
|
||||||
|
'type' => $this->integer(11)->notNull(),
|
||||||
|
'created_at' => $this->timestamp()->notNull(),
|
||||||
|
'updated_at' => $this->timestamp()->notNull(),
|
||||||
|
], $tableOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user