add account model + crud ( kassza )

This commit is contained in:
2015-09-20 22:02:02 +02:00
parent 5e1835dff5
commit 6163163b1c
16 changed files with 707 additions and 7 deletions

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

@@ -6,7 +6,7 @@ use yii\helpers\Html;
/* @var $model common\models\Warehouse */
$this->title = Yii::t('common/warehouse', 'Update {modelClass}: ', [
'modelClass' => 'Warehouse',
'modelClass' => Yii::t("common/warehouse", "Warehouse"),
]) . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/warehouse', 'Warehouses'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_warehouse]];