add discount crud + model (kedvezmény)

This commit is contained in:
2015-09-21 08:45:41 +02:00
parent 0fed98d239
commit 2e7b52e5a3
12 changed files with 581 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Discount;
/* @var $this yii\web\View */
/* @var $model common\models\Discount */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="discount-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->checkbox( ['value' => 10, 'label' => Yii::t('common/discount', "Active") ]) ?>
<?= $form->field($model, 'type')->dropDownList(Discount::types()) ?>
<?= $form->field($model, 'value')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/discount', 'Create') : Yii::t('common/discount', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\DiscountSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="discount-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_warehouse') ?>
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'status') ?>
<?= $form->field($model, 'type') ?>
<?= $form->field($model, 'value') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/discount', 'Search'), ['class' => 'btn btn-primary']) ?>
</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\Discount */
$this->title = Yii::t('common/discount', 'Create Discount');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/discount', 'Discounts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="discount-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@@ -0,0 +1,43 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\DiscountSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/discount', 'Discounts');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="discount-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('common/discount', 'Create Discount'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
'name',
[
'attribute' => 'status',
'value' => 'statusHuman',
],
[
'attribute' => 'type',
'value' => 'typeHuman',
],
'value',
'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\Discount */
$this->title = Yii::t('common/discount', 'Update {modelClass}: ', [
'modelClass' => 'Discount',
]) . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/discount', 'Discounts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_warehouse]];
$this->params['breadcrumbs'][] = Yii::t('common/discount', 'Update');
?>
<div class="discount-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@@ -0,0 +1,43 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Discount */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/discount', 'Discounts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="discount-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('common/discount', 'Update'), ['update', 'id' => $model->id_warehouse], ['class' => 'btn btn-primary']) ?>
<?=
/* Html::a(Yii::t('common/discount', 'Delete'), ['delete', 'id' => $model->id_warehouse], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('common/discount', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
])*/
?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_warehouse',
'name',
'status',
'type',
'value',
'created_at',
'updated_at',
],
]) ?>
</div>