add changes to backend transfers2
This commit is contained in:
@@ -8,6 +8,7 @@ use frontend\models\MoneyMovementSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use common\models\Account;
|
||||
|
||||
/**
|
||||
* MoneyMovementController implements the CRUD actions for MoneyMovement model.
|
||||
@@ -61,12 +62,19 @@ class MoneyMovementController extends Controller
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new MoneyMovement();
|
||||
|
||||
|
||||
$model->id_user = Yii::$app->user->id;
|
||||
$model->type = MoneyMovement::TYPE_OUT;
|
||||
|
||||
$accounts = Account::read();
|
||||
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_money_movement]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ class TransferMoneyMovementSearch extends Transfer
|
||||
{
|
||||
$query = Transfer::find();
|
||||
|
||||
$query->andWhere(['type' => Transfer::TYPE_MONEY_MOVEMENT_OUT]);
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
@@ -69,7 +71,6 @@ class TransferMoneyMovementSearch extends Transfer
|
||||
'rate' => $this->rate,
|
||||
'id_user' => $this->id_user,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'comment', $this->comment]);
|
||||
|
||||
@@ -2,27 +2,28 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use frontend\components\HtmlHelper;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\MoneyMovement */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
<?php
|
||||
|
||||
$accountOptions = HtmlHelper::mkAccountOptions($accounts);
|
||||
|
||||
?>
|
||||
<div class="money-movement-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'id_account')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'id_user')->textInput() ?>
|
||||
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'type')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'money')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'comment')->textInput(['maxlength' => true]) ?>
|
||||
<?= $form->field($model, 'comment')->textarea(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend/money-movement', 'Create') : Yii::t('backend/money-movement', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
|
||||
@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,6 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'value' => $model->userName
|
||||
],
|
||||
'name',
|
||||
'type',
|
||||
'money:integer',
|
||||
'comment',
|
||||
'created_at:datetime',
|
||||
|
||||
Reference in New Issue
Block a user