<?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\Visitmaster;
/* @var $this yii\web\View */
/* @var $searchModel app\models\EvaluationincentiveSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

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

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
   <?= GridView::widget([
        'dataProvider' => $dataProvider,
         'filterModel' => $searchModel,
        'columns' => [
           ['class' => 'yii\grid\SerialColumn',
			'contentOptions' => ['style' =>'width:50px;  min-width:50px;'],],

			// 'evaluation_incentive_id',
		//	'evaluation_incentive_survey',
		//	'evaluation_incentive_part_id',
			//'evaluation_incentive_loc',
			// 'evaluation_incentive_q1',
			// 'evaluation_incentive_q2',
			// 'evaluation_incentive_q3',
			// 'evaluation_incentive_q4',
			// 'evaluation_incentive_q5',
			// 'evaluation_incentive_q6',
			// 'evaluation_incentive_q7',
			// 'evaluation_incentive_q8',
			// 'evaluation_incentive_q9',
			// 'evaluation_incentive_q10',
			// 'status',
			// 'create_time:datetime',
			// 'create_user',
			// 'update_time:datetime',
			// 'update_user',
			[
					'attribute' => 'evaluation_incentive_part_id',
					'contentOptions' => ['class' => 'col-md-2'],
			
			],
			
			[
					'attribute' => 'visit_code',
		            'label' => 'Visit',
		            'contentOptions' => ['class' => 'col-md-2'],
					'noWrap' => true,					
		            'filterType'=>GridView::FILTER_SELECT2,
		            'filter'=>ArrayHelper::map(Visitmaster::find()->where(['NOT', ['visit_interval' => null]])->andWhere(["status" => 1])->orderBy(['visit_code'=> SORT_DESC])->asArray()->all(), 'visit_code', 'visit_name'), 
		            'filterInputOptions'=>['placeholder'=>''],
	                'value' => function($data) {
                    return $data->getVisits($data->visit_code);
                },
				],
			[
					'attribute' => 'record_date',
					'format' => 'date',
					'contentOptions' => ['class' => 'col-md-3'],
					// 'contentOptions' => ['class' => 'col-md-1'],
		            '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>
