add changes to account state
This commit is contained in:
@@ -45,7 +45,8 @@ class AdminMenuStructure{
|
||||
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'] ];
|
||||
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index'] ];
|
||||
$items[] = ['label' => 'Pénznem', 'url' => ['/currency/index'] ];
|
||||
$items[] = ['label' => 'Transfer', 'url' => ['/transfer/index'] ];
|
||||
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index'] ];
|
||||
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
||||
|
||||
if ( count($items) > 0 ){
|
||||
$userMainMenu = ['label' => 'Beállítások', 'url' => null,
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
namespace backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\Account;
|
||||
use backend\models\AccountSearch;
|
||||
use common\models\AccountState;
|
||||
use backend\models\AccountStateSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use common\models\Account;
|
||||
use common\models\User;
|
||||
|
||||
/**
|
||||
* AccountController implements the CRUD actions for Account model.
|
||||
* AccountStateController implements the CRUD actions for AccountState model.
|
||||
*/
|
||||
class AccountController extends Controller
|
||||
class AccountStateController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
@@ -27,22 +29,29 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Account models.
|
||||
* Lists all AccountState models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new AccountSearch();
|
||||
$searchModel = new AccountStateSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
$accounts = Account::read();
|
||||
$users = User::read();
|
||||
|
||||
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'accounts' => $accounts,
|
||||
'users' => $users,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Account model.
|
||||
* Displays a single AccountState model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -54,16 +63,16 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Account model.
|
||||
* Creates a new AccountState model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new Account();
|
||||
$model = new AccountState();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_account]);
|
||||
return $this->redirect(['view', 'id' => $model->id_account_state]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
@@ -72,7 +81,7 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing Account model.
|
||||
* Updates an existing AccountState model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
@@ -82,7 +91,7 @@ class AccountController extends Controller
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_account]);
|
||||
return $this->redirect(['view', 'id' => $model->id_account_state]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
@@ -91,7 +100,7 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing Account model.
|
||||
* Deletes an existing AccountState model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
@@ -104,15 +113,15 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Account model based on its primary key value.
|
||||
* Finds the AccountState 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
|
||||
* @return AccountState the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = Account::findOne($id)) !== null) {
|
||||
if (($model = AccountState::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
@@ -11,12 +11,15 @@ use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\base\Object;
|
||||
use backend\models\UserUpdate;
|
||||
use common\models\Account;
|
||||
use common\models\UserAccountAssignment;
|
||||
|
||||
/**
|
||||
* UserController implements the CRUD actions for User model.
|
||||
*/
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
@@ -37,6 +40,8 @@ class UserController extends Controller
|
||||
{
|
||||
$searchModel = new UserSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
@@ -64,14 +69,35 @@ class UserController extends Controller
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new UserCreate();
|
||||
|
||||
$accounts = Account::readAccounts();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
$this->updateAccountAssignments($model);
|
||||
|
||||
// return $this->redirect(['view', 'id' => $model->id]);
|
||||
|
||||
}
|
||||
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAccountAssignments($model){
|
||||
|
||||
echo "saving accounts";
|
||||
UserAccountAssignment::deleteAll(['id_user' => $model->id]);
|
||||
foreach ( $model->selected_accounts as $id_account ){
|
||||
echo "saving account";
|
||||
$uaa = new UserAccountAssignment();
|
||||
$uaa->id_user = $model->id;
|
||||
$uaa->id_account = $id_account;
|
||||
$uaa->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,14 +113,29 @@ class UserController extends Controller
|
||||
if ( $model == null ){
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
|
||||
$accounts = Account::readAccounts();
|
||||
|
||||
$this->applyAccounts($model);
|
||||
|
||||
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
$this->updateAccountAssignments($model);
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
}
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function applyAccounts($model ){
|
||||
$assignedAccounts = $model->userAccountAssignments;
|
||||
foreach ($assignedAccounts as $acc ){
|
||||
$model->selected_accounts[] = $acc->id_account;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
82
backend/models/AccountStateSearch.php
Normal file
82
backend/models/AccountStateSearch.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\AccountState;
|
||||
|
||||
/**
|
||||
* AccountStateSearch represents the model behind the search form about `common\models\AccountState`.
|
||||
*/
|
||||
class AccountStateSearch extends AccountState
|
||||
{
|
||||
|
||||
public $type;
|
||||
public $start;
|
||||
public $end;
|
||||
|
||||
public $timestampStart;
|
||||
public $timestampEnd;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[[ 'id_account', 'type', 'id_user'], 'integer'],
|
||||
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 = AccountState::find();
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
'sort' => false,
|
||||
]);
|
||||
|
||||
$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->orderBy(['created_at' => SORT_DESC]);
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_user' => $this->id_user,
|
||||
'id_account' => $this->id_account,
|
||||
'type' => $this->type,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere([ '>=', 'created_at', $this->timestampStart ] );
|
||||
$query->andFilterWhere([ '<', 'created_at', $this->timestampEnd ] );
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@ class TransferSearch extends Transfer
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
// $query->distinct();
|
||||
$selectObjectName = "";
|
||||
$selectObjectName .= " case when transfer.type = " .self::TYPE_PRODUCT ." then product.name else ticket_type.name end as object_name";
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ class UserCreate extends User{
|
||||
|
||||
public $password_plain;
|
||||
public $password_repeat;
|
||||
public $selected_accounts = [];
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -16,11 +17,17 @@ class UserCreate extends User{
|
||||
{
|
||||
return [
|
||||
[['username','email','password_plain','password_repeat'], 'required' ],
|
||||
['selected_accounts',function ($attribute, $params) {
|
||||
if (!is_array($this->$attribute)) {
|
||||
$this->addError($attribute, 'Invalid array');
|
||||
}
|
||||
}
|
||||
],
|
||||
['email' ,'email' ],
|
||||
['email' ,'unique' ],
|
||||
['username' ,'unique' ],
|
||||
[['password_plain' ,'password_repeat'] ,'string','min' =>6 ],
|
||||
[['password_repeat'] ,'validatePasswordRepeat' ]
|
||||
[['password_repeat'] ,'validatePasswordRepeat' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use common\models\User;
|
||||
class UserUpdate extends User {
|
||||
public $password_plain;
|
||||
public $password_repeat;
|
||||
public $selected_accounts = [];
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -21,9 +22,16 @@ class UserUpdate extends User {
|
||||
['email' ,'unique' , 'targetClass' => User::className(), 'targetAttribute' => 'email'],
|
||||
['username' ,'unique', 'targetClass' => User::className(), 'targetAttribute' => 'username'],
|
||||
[['password_plain' ,'password_repeat'] ,'string','min' =>6 ],
|
||||
[['password_repeat'] ,'validatePasswordRepeat' ]
|
||||
[['password_repeat'] ,'validatePasswordRepeat' ],
|
||||
['selected_accounts',function ($attribute, $params) {
|
||||
if (!is_array($this->$attribute)) {
|
||||
$this->addError($attribute, 'Invalid array');
|
||||
}
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @formatter:on
|
||||
*/
|
||||
|
||||
55
backend/views/account-state/_form.php
Normal file
55
backend/views/account-state/_form.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\AccountState */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="account-state-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'id_account')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'type')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'money')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_5_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_10_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_20_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_50_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_100_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_200_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_500_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_1000_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_2000_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_5000_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_10000_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'banknote_20000_ft')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'comment')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'prev_state')->textInput() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend/account-state', 'Create') : Yii::t('backend/account-state', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
13
backend/views/account-state/_item_view.php
Normal file
13
backend/views/account-state/_item_view.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
use frontend\components\AccountStateBanknoteCountWidget;
|
||||
use yii\base\Widget;
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
echo AccountStateBanknoteCountWidget::widget([
|
||||
'model' => $model,
|
||||
]);
|
||||
?>
|
||||
|
||||
|
||||
68
backend/views/account-state/_search.php
Normal file
68
backend/views/account-state/_search.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use common\models\AccountState;
|
||||
use frontend\components\HtmlHelper;
|
||||
use kartik\widgets\DatePicker;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\AccountStateSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
$accountOptions = ['' => 'Mind'] + HtmlHelper::mkAccountOptions($accounts);
|
||||
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($users,'id','username')
|
||||
?>
|
||||
|
||||
<div class="account-state-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'type')->dropDownList(['' => 'Mind']+AccountState::types()) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'end') ->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('backend/account-state', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
backend/views/account-state/create.php
Normal file
21
backend/views/account-state/create.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\AccountState */
|
||||
|
||||
$this->title = Yii::t('backend/account-state', 'Create Account State');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/account-state', 'Account States'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="account-state-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
39
backend/views/account-state/index.php
Normal file
39
backend/views/account-state/index.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\ListView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\AccountStateSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('backend/account-state', 'Account States');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="account-state-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search', ['model' => $searchModel,'accounts' => $accounts,'users' => $users,]); ?>
|
||||
|
||||
|
||||
<?php /*echo GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
|
||||
'typeName',
|
||||
'money',
|
||||
'created_at:datetime',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}'
|
||||
],
|
||||
],
|
||||
]); */?>
|
||||
|
||||
<?php echo ListView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'itemView' => '_item_view'
|
||||
])?>
|
||||
|
||||
</div>
|
||||
23
backend/views/account-state/update.php
Normal file
23
backend/views/account-state/update.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\AccountState */
|
||||
|
||||
$this->title = Yii::t('backend/account-state', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Account State',
|
||||
]) . ' ' . $model->id_account_state;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/account-state', 'Account States'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id_account_state, 'url' => ['view', 'id' => $model->id_account_state]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('backend/account-state', 'Update');
|
||||
?>
|
||||
<div class="account-state-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
56
backend/views/account-state/view.php
Normal file
56
backend/views/account-state/view.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\AccountState */
|
||||
|
||||
$this->title = $model->id_account_state;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/account-state', 'Account States'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="account-state-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('backend/account-state', 'Update'), ['update', 'id' => $model->id_account_state], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('backend/account-state', 'Delete'), ['delete', 'id' => $model->id_account_state], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('backend/account-state', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_account_state',
|
||||
'id_account',
|
||||
'type',
|
||||
'money',
|
||||
'banknote_5_ft',
|
||||
'banknote_10_ft',
|
||||
'banknote_20_ft',
|
||||
'banknote_50_ft',
|
||||
'banknote_100_ft',
|
||||
'banknote_200_ft',
|
||||
'banknote_500_ft',
|
||||
'banknote_1000_ft',
|
||||
'banknote_2000_ft',
|
||||
'banknote_5000_ft',
|
||||
'banknote_10000_ft',
|
||||
'banknote_20000_ft',
|
||||
'id_user',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'comment',
|
||||
'prev_state',
|
||||
'prev_money',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\grid\GridView;
|
||||
use yii\base\Widget;
|
||||
use yii\base\Object;
|
||||
use yii\data\ArrayDataProvider;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\User */
|
||||
@@ -18,6 +22,41 @@ use yii\widgets\ActiveForm;
|
||||
<?= $form->field($model, 'password_plain')->passwordInput() ?>
|
||||
<?= $form->field($model, 'password_repeat')->passwordInput() ?>
|
||||
|
||||
<?php
|
||||
|
||||
$selectedAccounts = $model->selected_accounts;
|
||||
|
||||
?>
|
||||
|
||||
<h3>Engedélyezett kasszák</h3>
|
||||
<?php echo GridView::widget([
|
||||
'dataProvider' => new ArrayDataProvider( [
|
||||
'allModels' => $accounts,
|
||||
'sort' => false,
|
||||
'pagination' => false,
|
||||
]),
|
||||
'columns' => [
|
||||
[
|
||||
'class' => 'yii\grid\CheckboxColumn',
|
||||
'name' => (new ReflectionClass( $model->classname() ))->getShortName() . '[selected_accounts]',
|
||||
'checkboxOptions' => function ($model, $key, $index, $column) use ($selectedAccounts){
|
||||
$result = [];
|
||||
$result['value'] = $model->id_account ;
|
||||
|
||||
if ( isset($selectedAccounts) ){
|
||||
if ( is_array($selectedAccounts) ){
|
||||
if ( array_search($model->id_account , $selectedAccounts ) !== false){
|
||||
$result['checked'] = 'checked' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
],
|
||||
[ 'attribute' => 'name' ],
|
||||
],
|
||||
])?>
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Mentés') : Yii::t('app', 'Mentés'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,7 @@ $this->params['breadcrumbs'][] = Yii::t('app', 'Update');
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user