<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\ProcurementSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('common/procurement', 'Procurements');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="procurement-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?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']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
        	[
        		'attribute' => 'id_warehouse',
        		'value' => 'wareHouseName'
        			
    		],
        	[
        		'attribute' => 'id_user',
        		'value' => 'userName'
        			
    		],
        	[
        		'attribute' => 'id_product',
        		'value' => 'productName'
        			
    		],
            'count',
            'stock',
            'purchase_price',
            'created_at:datetime',

            [
            	'class' => 'yii\grid\ActionColumn',
            	'template' => '{view} {update}',
            	'buttons' => [
		        	'update' => function ($url, $model, $key) {
		        		return Html::a('Módosít',$url, ['class' =>'btn btn-xs btn-primary' ]);
				    },
		        	'view' => function ($url, $model, $key) {
		        	return Html::a('Részletek',$url, ['class' =>'btn btn-xs btn-primary' ]);
				    }
    			]
    		],
        ],
    ]); ?>

</div>
