<?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\Vltransportation;
use app\models\Artcentre;

$SModel=new Vltransportation();

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

$this->title = Yii::t('app', 'Vltransportation');
$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->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:175px;  min-width:125px;'],					
		   ],
		   
		
			[
				'attribute' => 	'artcname',					
                'value' => function($data) {
                    return $data->getArtcname($data->artcname);
                },
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(Artcentre::find()->where(['status' =>1])->orderBy('artcname')->asArray()->all(), 'artcname', 'artcname'), 
	            'filterInputOptions'=>['placeholder'=>''],	
                'contentOptions' => ['style' =>'width:330px;  min-width:330px;'],					
		   ],
		   
		   [
				'attribute' => 	'artccode',							
                'value' => function($data) {
                    return $data->getArtcmaster($data->artccode);
                },
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(Artcentre::find()->where(['status' =>1])->orderBy('artccode')->asArray()->all(), 'artccode', 'artccode'), 
	            'filterInputOptions'=>['placeholder'=>''],	
                'contentOptions' => ['style' =>'width:135px;  min-width:135px;'],					
		   ],
		   
		  [
			'attribute' => 'boxid',
			 'contentOptions' => ['style' =>'width:115px;  min-width:115px;'],			
			],	
           
		   [
					'attribute' =>'cdate',
				    'label' => 'Consignment Date',
					'format' => 'date',
					'contentOptions' => ['style' =>'width:250px;  min-width:250px;'],
					'filterType'=>GridView::FILTER_DATE,
		            'filterWidgetOptions' => ['pluginOptions' => ['autoclose' => true, 'startDate' => '01-01-1900', 'endDate' => '0', 'format' => strtolower(Yii::$app->formatter->dateFormat), 'orientation' => 'bottom']],
					
			],
		   /*
		      [
					'attribute' => 'record_date',
				    'label' => 'Record Date',
					'format' => 'date',
					'contentOptions' => ['style' =>'width:250px;  min-width:250px;'],
					'filterType'=>GridView::FILTER_DATE,
		            'filterWidgetOptions' => ['pluginOptions' => ['autoclose' => true, 'startDate' => '01-01-1900', 'endDate' => '0', 'format' => strtolower(Yii::$app->formatter->dateFormat), 'orientation' => 'bottom']],
					
			  ],
           */
            ['class' => 'app\behaviours\ActionColumns'],
        ],
    ]); ?>
</div>
