<?php

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

$SModel=new Subdistrict();

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

$this->title = Yii::t('app', 'Subdistrict');
$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' => 'state',
				'label' => 'State',			
                'value' => function($data) {
                    return $data->getStatemaster($data->state);
                },
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(State::find()->where(['status' =>1])->orderBy('state')->asArray()->all(), 'state', 'state'), 
	            'filterInputOptions'=>['placeholder'=>''],
				'contentOptions' => ['style' => 'width:200px;  min-width:150px;'],
		   ],
		   
		   [
				'attribute' => 'district',
				'label' => 'District',			
                'value' => function($data) {
                    return $data->getDistrictmaster($data->district);
                },
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(District::find()->where(['status' =>1])->orderBy('district')->asArray()->all(), 'district', 'district'), 
	            'filterInputOptions'=>['placeholder'=>''],	
                'contentOptions' => ['style' =>'width:200px;  min-width:150px;'],					
		   ],
		   
			'subdistrict_name',
			[
			'attribute' => 'subdistrict_village',
			 'contentOptions' => ['style' =>'width:225px;  min-width:225px;'],			
			],
			
            [
				'attribute' => 'status',
				'label' => 'Status',
                'contentOptions' => ['style' =>'width:100px;  min-width:100px;'],				 
                        			   
                '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>
