add inventory group

This commit is contained in:
2016-02-29 20:51:54 +01:00
parent 3926498f3e
commit b196b86746
19 changed files with 589 additions and 4 deletions

View File

@@ -0,0 +1,35 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\ProductCategory;
use frontend\components\HtmlHelper;
/* @var $this yii\web\View */
/* @var $model common\models\InventoryGroup */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$cats = ProductCategory::read();
$cats = HtmlHelper::mkOptions($cats, 'id_product_category');
?>
<div class="inventory-group-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'id_product_category')->dropDownList($cats) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/inventory_group', 'Létrehoz') : Yii::t('common/inventory_group', 'Módosít'), ['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\InventoryGroupSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="inventory-group-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_inventory_group') ?>
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'id_product_category') ?>
<?= $form->field($model, 'status') ?>
<?= $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/inventory_group', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('common/inventory_group', '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\InventoryGroup */
$this->title = Yii::t('common/inventory_group', 'Create Inventory Group');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory_group', 'Inventory Groups'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="inventory-group-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@@ -0,0 +1,40 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\InventoryGroupSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/inventory_group', 'Leltár csoportok');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="inventory-group-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('common/inventory_group', 'Új leltár csoport'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id_inventory_group',
'name',
[
'attribute' => 'id_product_category',
'value' => 'productCategoryName'
],
'created_at:datetime',
['class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}'
],
],
]); ?>
</div>

View File

@@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\InventoryGroup */
$this->title = Yii::t('common/inventory_group', 'Leltár csoport módosítása' );
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory_group', 'Inventory Groups'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_inventory_group]];
$this->params['breadcrumbs'][] = Yii::t('common/inventory_group', 'Update');
?>
<div class="inventory-group-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@@ -0,0 +1,59 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\grid\GridView;
use yii\base\Widget;
/* @var $this yii\web\View */
/* @var $model common\models\InventoryGroup */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory_group', 'Leltár csoportok'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="inventory-group-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('common/inventory_group', 'Módosít'), ['update', 'id' => $model->id_inventory_group], ['class' => 'btn btn-primary']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_inventory_group',
'name',
'id_product_category',
'created_at',
],
]) ?>
<h2>Termékek a csoportban</h2>
<?php echo GridView::widget([
'dataProvider' => $products,
'columns' => [
[
'attribute' =>'id_product',
'label' => 'Termék azon'
],
[
'attribute' =>'name',
'label' => 'Termék neve'
],
[
'attribute' =>'id_account',
'value' => 'accountName',
'label' => 'Kassza'
]
]
])?>
</div>

View File

@@ -3,6 +3,7 @@
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\InventoryGroup;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
@@ -13,6 +14,9 @@ use yii\helpers\ArrayHelper;
$account_options = ArrayHelper::map($accounts, 'id_account', 'name');
$product_category_options = ArrayHelper::map($categories, 'id_product_category', 'name');
$inventory_groups = InventoryGroup::find()->andWhere(['status' => InventoryGroup::STATUS_ACTIVE])->all();
$inventory_groups = ['' => ''] + ArrayHelper::map($inventory_groups, "id_inventory_group", "name");
?>
<div class="product-form">
@@ -23,6 +27,8 @@ $product_category_options = ArrayHelper::map($categories, 'id_product_category',
<?= $form->field($model, 'id_account')->dropDownList($account_options) ?>
<?= $form->field($model, 'id_product_category')->dropDownList($product_category_options) ?>
<?= $form->field($model, 'id_inventory_group')->dropDownList($inventory_groups) ?>
<?= $form->field($model, 'product_number')->textInput(['maxlength' => true]) ?>

View File

@@ -32,6 +32,10 @@ $this->params['breadcrumbs'][] = $this->title;
'statusHuman',
'stock',
[
'attribute' => 'id_inventory_group',
'value' => $model->getInventoryGroupName(),
],
[
'attribute' => 'description',
'value' => nl2br($model->description),
'format' => 'raw'
@@ -40,5 +44,10 @@ $this->params['breadcrumbs'][] = $this->title;
'updated_at:datetime',
],
]) ?>
<?php
?>
</div>