add changes

This commit is contained in:
Roland Schneider 2016-08-08 18:56:55 +02:00
parent c5bfae9ec1
commit f30acbc7d2

View File

@ -9,6 +9,7 @@ use backend\assets\InventoryItemIndexAsset;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel backend\models\InventoryItemSearch */ /* @var $searchModel backend\models\InventoryItemSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */ /* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $model \common\models\Inventory */
$this->title = Yii::t('common/inventory-item', 'Leltár részletei'); $this->title = Yii::t('common/inventory-item', 'Leltár részletei');
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
@ -19,58 +20,51 @@ InventoryItemIndexAsset::register($this);
$options = []; $options = [];
$options['products'] = $productOptions; $options['products'] = $productOptions;
$this->registerJs('inventoryItemIndex.init( '. json_encode($options) .' );'); $this->registerJs('inventoryItemIndex.init( ' . json_encode($options) . ' );');
?> ?>
<style> <style>
.table th{ .table th {
white-space: normal;
}
.table td{
white-space: normal; white-space: normal;
} }
.table td.numeric{ .table td {
white-space: normal;
}
.table td.numeric {
width: 110px; width: 110px;
text-align: right; text-align: right;
} }
</style> </style>
<div class="inventory-item-index"> <div class="inventory-item-index">
<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>
<?= DetailView::widget([ <?= DetailView::widget([
'model' => $model, 'model' => $model,
'attributes' => [ 'attributes' => [
'id_inventory', 'id_inventory',
'name', 'name',
['attribute'=>'id_user', ['attribute' => 'id_user',
'value'=>$model->userName 'value' => $model->userName
], ],
['attribute'=>'id_account', ['attribute' => 'id_account',
'value'=>$model->accountName 'value' => $model->accountName
], ],
['attribute'=>'status', ['attribute' => 'status',
'value'=>$model->getStatusHuman(), 'value' => $model->getStatusHuman(),
'label' => "Állapot" 'label' => "Állapot"
], ],
'created_at:datetime', 'created_at:datetime',
], ],
]) ?> ]) ?>
<?php <?php
if ( $model->isOpen()){ if ($model->isOpen()) {
echo Html::a("Lezárás",['inventory/close' , 'id' => $model->id_inventory ] ,['data-method' =>'post', 'class' => 'btn btn-danger']); echo Html::a("Lezárás", ['inventory/close', 'id' => $model->id_inventory], ['data-method' => 'post', 'class' => 'btn btn-danger']);
} }
?> ?>
<?php echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p> <p>
Magyarázat: Magyarázat:
<ul> <ul>
@ -94,13 +88,10 @@ $this->registerJs('inventoryItemIndex.init( '. json_encode($options) .' );');
</li> </li>
</ul> </ul>
</p> </p>
<p> <p>
<?php echo Html::a("XLS letöltése", Url::current(['InventoryItemSearch[output]' =>'xls']),['class' =>'btn btn-primary'])?> <?php echo Html::a("XLS letöltése", Url::current(['InventoryItemSearch[output]' => 'xls']), ['class' => 'btn btn-primary']) ?>
</p> </p>
<?php <?php
$columns = [ $columns = [
[ [
'attribute' => 'item_name', 'attribute' => 'item_name',
@ -160,33 +151,28 @@ $this->registerJs('inventoryItemIndex.init( '. json_encode($options) .' );');
]; ];
if ($model->isOpen()) {
if ( $model->isOpen() ){
$columns[] = ['class' => 'yii\grid\ActionColumn', $columns[] = ['class' => 'yii\grid\ActionColumn',
'template' => '{update}', 'template' => '{update}',
'urlCreator' => function ($action, $model, $key, $index){ 'buttons' => [
return Url::to(['inventory-item/update', 'id' => $model['item_id_inventory_item' ] ]) ; 'update' => function ($url) {
}, return Html::a('Módosítás', $url, ['class' => 'btn btn-xs btn-success',
'buttons' =>[
'update' =>function ($url, $model, $key) {
return Html::a('Módosítás', $url,['class' => 'btn btn-xs btn-success',
'data' => [ 'data' => [
], ],
]) ; ]);
} }
], ],
'urlCreator' => function($action, $model, $key, $index){ 'urlCreator' => function ($action, $model) {
$result = ""; $result = "";
if ( $action == 'update'){ if ($action == 'update') {
$result = Url::toRoute( [ 'update-item' ,'id' => $model['item_id_inventory_item']]); $result = Url::toRoute(['update-item', 'id' => $model['item_id_inventory_item']]);
} }
return $result; return $result;
} }
] ; ];
} }
echo GridView::widget( [ echo GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'columns' => $columns 'columns' => $columns
]); ]);