<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use rmrevin\yii\fontawesome\FA;
use yii\widgets\Pjax;
use app\base\Common;

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

if(!isset($all))
    $layouttitle = '<b>Today\'s HIV Indeterminate IN</b>';
else
    $layouttitle = '';

?>
<div class="attandance-index">

  <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'layout' => '<div class="box"><div class="box-header with-border">'.$layouttitle.'{summary}</div><div class="box-body">{items}</div><div class="box-footer clearfix">{pager}</div></div>',
		//'panel' => ['type' => GridView::TYPE_PRIMARY,'heading' => $layouttitle,'afterOptions'=>['class'=>'grid_panel_remove']],
    	// 'filterModel' => $searchModel,
		'options'=>['style' => 'white-space:nowrap;'],                         
        'panel' => ['heading' => $layouttitle,'type' => GridView::TYPE_PRIMARY,'beforeOptions'=>['class'=>'grid_panel_remove'],'afterOptions'=>[  'class'=>'grid_panel_remove']], 
		'toolbar' => false,	
     		
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
			[
                'attribute' => 'pid',
                'label'=>'Client ID',
            ],
            [
                // 'attribute' => 'cd4.cd4_test_q3',
                'label'=>'Last HIV Test Date',
                'format' => 'date',
                'content'=> function($data) {
                	// print_r($data->registration->getResults("date"));
                    return $data->registration->getResults("date");
                	// print_r($data->registration);
                }
            ],
            [
                'attribute' => 'cd4.cd4_test_q4',
                'label'=>'HIV Result',
                'format' => 'html',
                'content'=> function($data) {
                    // print_r($data->registration->getResults("result"));
                    return $data->registration->getResults("result");
                    // if(isset($data->samples)) {
                    	// if($data->samples->lab_smple_result)
                    		// return $data->samples->results->lab_result_name;
                    	// else
                    		// return "-";
                    // }
                    // else
                        // return "-";
                }
            ],
            [
                'label'=>'Next HIV Test Due Date',
                'format' => 'html',
                'content'=> function($data) {
                	return $data->registration->getResults("nextinddate");
                //     if(isset($data->cd4))
                //         return $data->cd4->getNextDate();
                //     else
                //         return "-";
                }
            ],
        ],
    ]); ?>
</div>
