<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use rmrevin\yii\fontawesome\FA;
use app\models\Block;
use yii\helpers\ArrayHelper;
use app\models\District;

$SModel=new Block();

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Districts');
$this->params['breadcrumbs'][] = $this->title;
$this->params['menu'] = [
	['label' => FA::icon('plus fa-fw'), 'linkOptions' => ['class'=>'btn btn-default', 'title'=>'Create'], 'url' => ['create']],
];
?>
<div class="departments-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
		'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            
			[
				'attribute' => 'district',
				'label' => 'District',			
                'value' => function($data) {
                    return $data->getDistmaster($data->district);
                },
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(District::find()->where(['status' =>1])->andWhere(["<>","district_uid",""])->orderBy('district')->asArray()->all(), 'district', 'district'), 
	            'filterInputOptions'=>['placeholder'=>''],
				'contentOptions' => ['style' => 'width:200px;  min-width:150px;'],
		   ],
            'block',
			'block_id',
			
            [
				'attribute' => 'status',
				'label' => 'Status',
                'contentOptions' => ['style' =>'width:125px;  min-width:125px;'],				 
                        			   
                'value' => function($data) {
                    return $data->getStatusdum();
                },
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>$SModel->statusdum, 
	            'filterInputOptions'=>['placeholder'=>''],
				
			],
			
			
            // 'create_time:datetime',
            // 'create_user',
            // 'update_time:datetime',
            // 'update_user',

            ['class' => 'app\behaviours\ActionColumns'],
        ],
    ]); ?>
</div>
