Add waste

This commit is contained in:
2016-05-08 08:56:42 +02:00
parent a6fdfb1c83
commit f8e1f90a8e
28 changed files with 1075 additions and 102 deletions

View File

@@ -0,0 +1,30 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Waste */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="waste-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'productIdentifier')->textInput(['autocomplete' => 'off'])->label('Írja be a termék nevét') ?>
<?= $form->field($model, 'id_product')->hiddenInput()->label(false) ?>
<?= $form->field($model, 'count')->textInput() ?>
<?= $form->field($model, 'comment')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton( Yii::t('common/waste', 'Létrehoz') , ['class' => 'btn btn-success' ]) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,69 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Product;
use common\models\User;
use yii\helpers\ArrayHelper;
use kartik\widgets\DatePicker;
/* @var $this yii\web\View */
/* @var $model backend\models\WasteSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
function mkOptions($options){
// $o = $options;
$all = ['' => Yii::t('common/product','All' ) ];
$o = $all + $options;
return $o;
}
$products = mkOptions( ArrayHelper::map( Product::find()->all() ,'id_product','name') );
$users = mkOptions( ArrayHelper::map( User::find()->all() ,'id','username') );
?>
<div class="waste-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'id_user')->dropDownList($users) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'id_product')->dropDownList($products) ?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'date_start')->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label("Időintervallum kezdete") ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'date_end') ->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ->label("Időintervallum vége") ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/waste', 'Keresés'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,51 @@
<?php
use yii\helpers\Html;
use backend\assets\WasteCreateAsset;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model common\models\Waste */
$this->title = Yii::t('common/waste', 'Új selejt');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/waste', 'Selejtek'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
WasteCreateAsset::register($this);
$options = [];
$options['products'] = $products;
$options['url_product_find'] = Url::toRoute(['product/find']);
$this->registerJs(' new WasteCreate( '. json_encode($options) .' );');
?>
<div class="waste-create">
<h1><?= Html::encode($this->title) ?></h1>
<div class="row">
<div class="col-md-6">
<table class="table table-striped">
<tr>
<th>Terméknév</th>
<td class="product-name"></td>
</tr>
<tr>
<th>Mennyiség</th>
<td class="product-stock"></td>
</tr>
<tr>
<th>Termék kategória</th>
<td class="product-category"></td>
</tr>
</table>
</div>
</div>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@@ -0,0 +1,51 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\WasteSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/waste', 'Selejtek');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="waste-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('common/waste', 'Új selejt'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => "waste_created_at",
'label' => "Létrehozva"
],
[
'attribute' => "user_username",
'label' => "Felhasználó"
],
[
'attribute' => "product_name",
'label' => "Termék"
],
[
'attribute' => "waste_count",
'label' => "Mennyiség"
],
[
'attribute' => "waste_comment",
'label' => "Megjegyzés"
],
// ['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\Waste */
$this->title = Yii::t('common/waste', 'Update {modelClass}: ', [
'modelClass' => 'Waste',
]) . ' ' . $model->id_waste;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/waste', 'Wastes'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_waste, 'url' => ['view', 'id' => $model->id_waste]];
$this->params['breadcrumbs'][] = Yii::t('common/waste', 'Update');
?>
<div class="waste-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\Waste */
$this->title = $model->id_waste;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/waste', 'Wastes'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="waste-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('common/waste', 'Update'), ['update', 'id' => $model->id_waste], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('common/waste', 'Delete'), ['delete', 'id' => $model->id_waste], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('common/waste', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_waste',
'count',
'id_product',
'stock_before',
'stock_after',
'id_user',
'comment',
'created_at',
'updated_at',
],
]) ?>
</div>