<?php

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

$HModel = new Hivcounseling();
/* @var $this yii\web\View */
/* @var $searchModel app\models\HivcounselingSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

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

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([      
        'dataProvider' => $dataProvider,
         'filterModel' => $searchModel,
		 
		  'rowOptions' => function ($model) {
        return ($model->record_date == $model->getMotIncdate())? ['class' => 'bg-blue'] : '';         
      },
	 
        'columns' => [
           [
            	'class' => 'yii\grid\SerialColumn',  
                 'contentOptions' => ['class' => 'col-md-1'],				
            ],

			// 'hiv_counseling_id',
		   //	'hiv_counseling_survey',
		    
			
           [
				'attribute' => 'hiv_counseling_part_id',
				// 'label' => 'HIV Visit Date',
				'contentOptions' => ['class' => 'col-md-2'],
			],			
             			
			
			[
					'attribute' => 'hiv_counseling_q1',
				    'label' => 'Client readiness stage',	
		            'contentOptions' => ['style' =>'min-width:100px;  max-width:100px;'],
					'contentOptions' => ['class' => 'col-md-3'],
					// 'contentOptions' => ['class' => 'col-md-1'],
	                'noWrap' => true,
		            'filterType'=>GridView::FILTER_SELECT2,
		            'filter'=>$HModel->q1, 
		            'filterInputOptions'=>['placeholder'=>''],
	                'value' => function($data) {						
	                   return $data->getReadiness();
	                }
				],
		//	'hiv_counseling_q1',
		//	'hiv_counseling_q2',
			// 'hiv_counseling_q3',
			// 'hiv_counseling_q4',
			// 'status',
			// 'create_time:datetime',
			// 'create_user',
			// 'update_time:datetime',
			// 'update_user',
			[
				'attribute' => 'record_date',
				'contentOptions' => ['class' => 'col-md-2'],
				'format' => 'date',
			],
			
			[
				'attribute' => 'motincvisit',	
                'visible' => isset(Yii::$app->request->queryParams['ajaxload']),				
				'label' => 'Earned Incentive',				
				'contentOptions' => ['class' => 'col-md-1'],
            ],
			
			[
				'attribute' => 'duedate',
				'label' => 'Next Due date',
				'value' => function($model) {						
	                   return $model->getDuedate($model->record_date);
	                },
				'contentOptions' => ['class' => 'col-md-2'],
				'format' => 'date',
			],
			

            [
	            	'class' => 'app\behaviours\ActionColumns',
	            	'visible' => !isset(Yii::$app->request->queryParams['ajaxload']),
					'contentOptions' => ['class' => 'nowrap'],
	            ],
        ],
    ]); ?>
</div>
