<?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\HivcontinuumSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

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

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
   <?= GridView::widget([
        'dataProvider' => $dataProvider,
         'filterModel' => $searchModel,
        'columns' => [
         
			// 'hiv_continuum_id',
		//	'hiv_continuum_survey',
			
			//'hiv_continuum_loc',
			// 'hiv_continuum_q1',
			// 'hiv_continuum_q2',
			// 'hiv_continuum_q3',
			// 'hiv_continuum_q4',
			// 'hiv_continuum_q5',
			// 'hiv_continuum_q6',
			// 'hiv_continuum_q7',
			// 'hiv_continuum_q8',
			// 'hiv_continuum_q9',
			// 'hiv_continuum_q10',
			// 'status',
			// 'create_time:datetime',
			// 'create_user',
			// 'update_time:datetime',
			// 'update_user',
			['class' => 'yii\grid\SerialColumn',
			'contentOptions' => ['style' =>'width:50px;  min-width:50px;'],],
			
			[
					'attribute' =>'hiv_continuum_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>
