add changes to procurement
This commit is contained in:
54
backend/views/procurement/_form_product.php
Normal file
54
backend/views/procurement/_form_product.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Procurement */
|
||||
/* @var $warehouses common\models\Warehouse[] */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
<?php
|
||||
|
||||
$warehouseOptions = ArrayHelper::map($warehouses, 'id_warehouse', 'name') ;
|
||||
|
||||
?>
|
||||
|
||||
<h3><?= Yii::t('common/product', 'Product') ?> </h3>
|
||||
<?php
|
||||
|
||||
echo DetailView::widget([
|
||||
'model' => $product,
|
||||
'attributes' =>[
|
||||
'productCategoryName',
|
||||
'accountName',
|
||||
'product_number',
|
||||
'barcode',
|
||||
'stock',
|
||||
]
|
||||
]);
|
||||
|
||||
?>
|
||||
|
||||
<div class="procurement-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
|
||||
<?= $form->field($model, 'id_warehouse')->dropDownList($warehouseOptions) ?>
|
||||
|
||||
<?= $form->field($model, 'count')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'purchase_price')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/procurement', 'Create') : Yii::t('common/procurement', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
@@ -2,12 +2,35 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use kartik\widgets\DatePicker;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\ProcurementSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
function mkOptions($options){
|
||||
// $o = $options;
|
||||
|
||||
$all = ['' => Yii::t('common/product','All' ) ];
|
||||
|
||||
// $o[''] = Yii::t('common/product','All' ) ;
|
||||
|
||||
$o = $all + $options;
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
$products = mkOptions( ArrayHelper::map( $products ,'id_product','name') );
|
||||
$users = mkOptions( ArrayHelper::map( $users ,'id','username') );
|
||||
$warehouses = mkOptions( ArrayHelper::map( $warehouses ,'id_warehouse','name') );
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="procurement-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
@@ -15,29 +38,39 @@ use yii\widgets\ActiveForm;
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id_procurement') ?>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_warehouse')->dropDownList($warehouses) ?>
|
||||
</div>
|
||||
<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'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'date_end') ->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= $form->field($model, 'id_warehouse') ?>
|
||||
|
||||
<?= $form->field($model, 'id_user') ?>
|
||||
|
||||
<?= $form->field($model, 'id_product') ?>
|
||||
|
||||
<?= $form->field($model, 'count') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'stock') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'purchase_price') ?>
|
||||
|
||||
<?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/procurement', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton(Yii::t('common/procurement', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
24
backend/views/procurement/create_product.php
Normal file
24
backend/views/procurement/create_product.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Procurement */
|
||||
/* @var $warehouses common\models\Warehouse[] */
|
||||
|
||||
$this->title = Yii::t('common/procurement', 'Create Procurement');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/procurement', 'Procurements'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="procurement-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form_product', [
|
||||
'product' => $product,
|
||||
'model' => $model,
|
||||
'warehouses' => $warehouses
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
@@ -13,7 +13,11 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<div class="procurement-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
<?php echo $this->render('_search', [
|
||||
'model' => $searchModel,
|
||||
'users' => $users,
|
||||
'products' => $products,
|
||||
'warehouses' => $warehouses,]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/procurement', 'Create Procurement'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
@@ -22,26 +26,29 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
[
|
||||
'attribute' => 'id_warehouse',
|
||||
'value' => 'wareHouseName'
|
||||
|
||||
],
|
||||
'id_user',
|
||||
'id_product',
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'value' => 'userName'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_product',
|
||||
'value' => 'productName'
|
||||
|
||||
],
|
||||
'count',
|
||||
'stock',
|
||||
'purchase_price',
|
||||
// 'description',
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}'
|
||||
|
||||
'template' => '{view}',
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
@@ -14,30 +14,35 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/procurement', 'Update'), ['update', 'id' => $model->id_procurement], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('common/procurement', 'Delete'), ['delete', 'id' => $model->id_procurement], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('common/procurement', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_procurement',
|
||||
'id_warehouse',
|
||||
'id_user',
|
||||
'id_product',
|
||||
[
|
||||
'attribute' => 'id_warehouse',
|
||||
'value' => $model->warehouseName,
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'value' => $model->userName,
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_product',
|
||||
'value' => $model->productName,
|
||||
|
||||
],
|
||||
'count',
|
||||
'stock',
|
||||
'purchase_price',
|
||||
'description',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
[
|
||||
'attribute' => 'description',
|
||||
'value' => nl2br($model->description),
|
||||
'format' => 'raw'
|
||||
],
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\ProductSearch */
|
||||
@@ -41,9 +42,31 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'value' => 'statusHuman',
|
||||
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {update}'
|
||||
'stock',
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {update} {procurement}',
|
||||
'buttons' =>[
|
||||
'view' => function ($url, $model, $key) {
|
||||
return Html::a( Yii::t('common/product', 'Details' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
'update' => function ($url, $model, $key) {
|
||||
return Html::a( Yii::t('common/product', 'Update' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
'procurement' => function ($url, $model, $key) {
|
||||
return Html::a( Yii::t('common/product', 'Procurement' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
],
|
||||
'urlCreator' => function ( $action, $model, $key, $index ){
|
||||
$result = '';
|
||||
if ( $action == 'procurement' ){
|
||||
$result = Url::toRoute(['procurement/create-product' , 'id' => $model->id_product]);
|
||||
}else{
|
||||
$result = Url::toRoute(['product/'.$action , 'id' => $model->id_product]);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
@@ -29,6 +29,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'sale_price',
|
||||
'profit_margins',
|
||||
'statusHuman',
|
||||
'stock',
|
||||
[
|
||||
'attribute' => 'description',
|
||||
'value' => nl2br($model->description),
|
||||
|
||||
Reference in New Issue
Block a user