new balance

This commit is contained in:
2019-06-25 12:37:09 +03:00
parent a783be26d1
commit 2f4f92bdec
16 changed files with 523 additions and 58 deletions

View File

@ -17,12 +17,7 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'type')
->dropDownList(
[
'1' => 'активный',
'0' => 'пассивный',
]
)?>
->dropDownList(\common\models\Balance::getTypeList())?>
<?= $form->field($model, 'summ')->textInput(['maxlength' => 9]) ?>

View File

@ -0,0 +1,33 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\balance\models\BalanceSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="balance-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'type') ?>
<?= $form->field($model, 'summ') ?>
<?= $form->field($model, 'dt_add') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -1,5 +1,6 @@
<?php
use kartik\select2\Select2;
use yii\data\ActiveDataProvider;
use yii\helpers\Html;
use yii\grid\GridView;
@ -21,9 +22,34 @@ $this->params['breadcrumps'][] = $this->title;
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'type',
'summ',
'dt_add',
[
'attribute' => 'type',
'value' => function ($model) {
return \common\models\Balance::getTypeName($model->type);
},
'filter' => kartik\select2\Select2::widget([
'model' => $searchModel,
'attribute' => 'type',
'data' => \common\models\Balance::getTypeList(),
'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]),
],
[
'attribute' => 'summ',
'filter' => \backend\widgets\SummRangeWidget::widget([
'model' => $searchModel,
]),
],
[
'attribute' => 'dt_add',
'value' => 'dt_add',
'filter' => \yii\jui\DatePicker::widget(['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy']),
'format' => 'html',
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>

View File

@ -1,9 +1,11 @@
<?php
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $dataProviderF \yii\data\ActiveDataProvider
/* @var $model backend\modules\balance\models\Balance */
$this->title = 'Баланс №' . $model->id;
@ -12,8 +14,9 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<div class="balance-view">
<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
@ -25,11 +28,30 @@ $this->params['breadcrumbs'][] = $this->title;
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'type',
//'id',
[
'attribute' => 'type',
'value' => function($model){
return \common\models\Balance::getTypeName($model->type);
}
],
'summ',
'dt_add',
],
]) ?>
<h2>Дополнительные сведения</h2>
<?= GridView::widget([
'dataProvider' => $dataProviderF,
'layout' => "{items}",
'columns' => [
'field.name:text:Поле',
[
'attribute' => 'value',
'label' => 'Значение'
],
],
]); ?>
</div>