<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use rmrevin\yii\fontawesome\FA;
use yii\widgets\Pjax;
use app\models\Cd4;

$HModel = new Cd4();

/* @var $this yii\web\View */
/* @var $searchModel app\models\Cd4Search */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Cd4s');
$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="cd4-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:30px;  min-width:30px;']
			 ],

				// 'cd4_test_id',
				// 'cd4_test_survey',
				
				// 'cd4_test_q1',
				// 'cd4_test_q2',
				
				
				// 'cd4_test_q5',
				// 'cd4_test_q6',
				// 'status',
				// 'create_time:datetime',
				// 'create_user',
				// 'update_time:datetime',
				// 'update_user',
				[
		    'attribute' => 'cd4_test_part_id',			
			'contentOptions' => ['style' => 'width:160px;  min-width:100px;'],
		],
		
		[
					'attribute' => 'cd4_test_q1',
		            'label' => 'Visit',
		            'contentOptions' => ['style' =>'width:150px;  min-width:150px;'],
					// 'contentOptions' => ['class' => 'col-md-1'],
	                'noWrap' => true,
		            'filterType'=>GridView::FILTER_SELECT2,
		            'filter'=>$HModel->q1Dum, 
		            'filterInputOptions'=>['placeholder'=>''],
	                'value' => function($data) {						
	                   return $data->getVisits();
	                }
				],
				
		[
		    'attribute' => 'cd4_test_q4',			
			'contentOptions' => ['style' => 'width:150px;  min-width:100px;'],
		],
		[
					'attribute' => 'cd4_test_q3',
					'format' => 'date',
					'contentOptions' => ['style' =>'width:270px;  min-width:100px;'],
					// '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']],
				],

				[
					'attribute' => 'record_date',
					'format' => 'date',
					'contentOptions' => ['style' =>'width:270px;  min-width:100px;'],
					// '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',
	            	'visible' => !isset(Yii::$app->request->queryParams['ajaxload']),
	            ],
	        ],
	    ]); ?>
</div>