<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use rmrevin\yii\fontawesome\FA;
use yii\widgets\Pjax;
use yii\helpers\ArrayHelper;
use app\models\Artcentre;
use app\models\Staff;
use app\models\Vll;

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

$this->title = Yii::t('app', 'Stafflocationmappings');
$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="locationmapping-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
		'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],					
			
			[
				'attribute' => 	'staffcode',							
                'value' => function($data) {
                    return $data->getStaffmaster($data->staffcode);
                },
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(Staff::find()->where(['status' =>1])->orderBy('staffcode')->asArray()->all(), 'staffcode', 'staffcode'), 
	            'filterInputOptions'=>['placeholder'=>''],	
                'contentOptions' => ['style' =>'width:125px;  min-width:125px;'],					
		   ],

            [
				'attribute' => 	'staffname',							
                'value' => function($data) {
                    return $data->getStaffname($data->staffname);
                },
				'value'=>'staffs.staffname',
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(Staff::find()->where(['status' =>1])->orderBy('staffname')->asArray()->all(), 'staffname', 'staffname'), 
	            'filterInputOptions'=>['placeholder'=>''],	
                'contentOptions' => ['style' =>'width:200px;  min-width:200px;'],					
		   ],
            
            [
				'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:125px;  min-width:125px;'],					
		   ],

            [
				'attribute' => 	'artcname',							
                'value' => function($data) {
                    return $data->getArtcname($data->artcname);
                },
				'value'=>'artcs.artcname',
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(Artcentre::find()->where(['status' =>1])->orderBy('artcname')->asArray()->all(), 'artcname', 'artcname'), 
	            'filterInputOptions'=>['placeholder'=>''],	
                'contentOptions' => ['style' =>'width:250px;  min-width:250px;'],					
		   ],
		   		  
           [
				'attribute' => 	'vllname',							
                'value' => function($data) {
                    return $data->getVllname($data->vllname);
                },
				'value'=>'vlls.name_vl_lab_linked',
	            'filterType'=>GridView::FILTER_SELECT2,
	            'filter'=>ArrayHelper::map(Vll::find()->where(['status' =>1])->orderBy('name_vl_lab_linked')->asArray()->all(), 'name_vl_lab_linked', 'name_vl_lab_linked'), 
	            'filterInputOptions'=>['placeholder'=>''],	
                'contentOptions' => ['style' =>'width:250px;  min-width:250px;'],					
		   ],		   
          /*
            [
					'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>
