<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use rmrevin\yii\fontawesome\FA;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel app\models\TbSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

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

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  <?= GridView::widget([
        'dataProvider' => $dataProvider,
         'filterModel' => $searchModel,
         'formatter' => ['class' => 'yii\i18n\Formatter','nullDisplay' => '-', 'dateFormat' => 'dd-MM-Y'],
	 'options'=>['style' => 'white-space:nowrap;'],
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

			// 'tb_test_id',
		//	'tb_test_survey',
			'tb_test_part_id',
			// 'tb_test_q1',
			// 'tb_test_q2',
			// 'tb_test_q3',
			// 'tb_test_q4',
			// 'tb_test_q5',
			// 'status',
			// 'create_time:datetime',
			// 'create_user',
			// 'update_time:datetime',
			// 'update_user',
			
			[
				'attribute' => 'tb_test_q5',
				'label' => ' Action taken for positive TB screen',
			],
			'record_date',
			/*
			[
				'attribute' => 'record_date',
				'format' => 'date',
			],
			*/
			[
				'attribute' => 'tb_test_q6',
				'label' => 'Lab Request No',
				'contentOptions' => ['class' => 'col-md-2'],
				
			],
			
			[
				'attribute' => 'labtbresult',
				'label' => 'Test Result',
				'contentOptions' => ['class' => 'col-md-2'],
				
				'value'=> function ($model) {
                        if($model->labtbresult == '')
                        {

                            return '';

                        } 
						elseif($model->labtbresult == '0')
                        {

                            return 'Negative';
						}
						elseif($model->labtbresult == '1')
                        {

                            return 'Positive';
						}
						elseif($model->labtbresult == '12')
                        {

                            return 'Equivocal';
						}						
						elseif($model->labtbresult == '97')
                        {

                            return 'Did not go to RNTCP';
						}
						elseif($model->labtbresult == '98')
                        {

                            return 'Unable to Provide Sputum';
						}
                       
                      },
				
				
			],

            ['class' => 'app\behaviours\ActionColumns'],
        ],
    ]); ?>
</div>
