Add waste
This commit is contained in:
@@ -54,7 +54,7 @@ $warehouses = mkOptions( ArrayHelper::map( $warehouses ,'id_warehouse','name')
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
])->label("Időintervallum kezdete") ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'date_end') ->widget(DatePicker::classname(), [
|
||||
@@ -62,7 +62,7 @@ $warehouses = mkOptions( ArrayHelper::map( $warehouses ,'id_warehouse','name')
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
])->label("Időintervallum vége") ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
30
backend/views/waste/_form.php
Normal file
30
backend/views/waste/_form.php
Normal 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>
|
||||
69
backend/views/waste/_search.php
Normal file
69
backend/views/waste/_search.php
Normal 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>
|
||||
51
backend/views/waste/create.php
Normal file
51
backend/views/waste/create.php
Normal 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>
|
||||
51
backend/views/waste/index.php
Normal file
51
backend/views/waste/index.php
Normal 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>
|
||||
23
backend/views/waste/update.php
Normal file
23
backend/views/waste/update.php
Normal 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>
|
||||
43
backend/views/waste/view.php
Normal file
43
backend/views/waste/view.php
Normal 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>
|
||||
Reference in New Issue
Block a user