add changes feature/33

This commit is contained in:
2015-09-24 10:06:10 +02:00
parent 1eae1b3000
commit fcc18d79f6
14 changed files with 621 additions and 2 deletions

View File

@@ -0,0 +1,42 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
/* @var $accounts common\models\Account[] */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$account_options = ArrayHelper::map($accounts, 'id_account', 'name');
?>
<div class="product-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_account')->dropDownList($account_options) ?>
<?= $form->field($model, 'product_number')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'barcode')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'purchase_price')->input('number') ?>
<?= $form->field($model, 'sale_price')->input('number')?>
<?= $form->field($model, 'profit_margins')->textInput() ?>
<?= $form->field($model, 'status')->checkbox( ['value' => 10, 'label' => Yii::t('common/product', "Active") ]) ?>
<?= $form->field($model, 'description')->textarea(['maxlength' => true])->hint( Yii::t( 'common/prodcut', "Max 255 character")) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ticket_type', 'Create') : Yii::t('common/ticket_type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,49 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\ProductSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="product-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_product') ?>
<?= $form->field($model, 'id_product_type') ?>
<?= $form->field($model, 'id_account') ?>
<?= $form->field($model, 'product_number') ?>
<?= $form->field($model, 'barcode') ?>
<?php // echo $form->field($model, 'purchase_price') ?>
<?php // echo $form->field($model, 'sale_price') ?>
<?php // echo $form->field($model, 'profit_margins') ?>
<?php // echo $form->field($model, 'status') ?>
<?php // echo $form->field($model, 'description') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/ticket_type', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('common/ticket_type', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
/* @var $accounts common\models\Account[] */
$this->title = Yii::t('common/ticket_type', 'Create Product');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_type', 'Products'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
'accounts' => $accounts,
]) ?>
</div>

View File

@@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\ProductSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/ticket_type', 'Products');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('common/ticket_type', 'Create Product'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_product_type',
'value' => 'productCategoryName',
],
[
'attribute' => 'id_account',
'value' => 'accountName',
],
'product_number',
'barcode',
'purchase_price',
'sale_price',
'profit_margins',
'status',
'description',
'created_at:datetime',
'updated_at:datetime',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
$this->title = Yii::t('common/ticket_type', 'Update {modelClass}: ', [
'modelClass' => 'Product',
]) . ' ' . $model->id_product;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_type', 'Products'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_product, 'url' => ['view', 'id' => $model->id_product]];
$this->params['breadcrumbs'][] = Yii::t('common/ticket_type', 'Update');
?>
<div class="product-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@@ -0,0 +1,46 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
$this->title = $model->id_product;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_type', 'Products'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('common/ticket_type', 'Update'), ['update', 'id' => $model->id_product], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('common/ticket_type', 'Delete'), ['delete', 'id' => $model->id_product], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('common/ticket_type', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_product',
'id_product_type',
'id_account',
'product_number',
'barcode',
'purchase_price',
'sale_price',
'profit_margins',
'status',
'description',
'created_at',
'updated_at',
],
]) ?>
</div>