<?php

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

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

$this->title = Yii::t('app', Common::getMenuname());
$this->params['breadcrumbs'][] = $this->title;
$this->params['menu'] = [
	['label' => FA::icon('plus fa-fw'), 'linkOptions' => ['class'=>'btn btn-default', 'title'=>'Create'], 'url' => ['create']],
];
   // print_r($dataProvider->getModels()[0]->linkage);
?>
<div class="reimbursementmaster-index">
  
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
		'panel' => ['type' => GridView::TYPE_PRIMARY,'heading' => '<b>Cohort Visit Reimbursements for Today</b>','afterOptions'=>['class'=>'grid_panel_remove']],			
		'beforeHeader'=>[
			[
				'columns'=>[
					['content'=>'', 'options'=>['colspan'=>3, 'class'=>'text-center']], 
					['content'=>'<h4 style=color:red;>ART book check</h4>', 'options'=>['colspan'=>2,'class'=>'text-left']],
					['content'=>'<h4 style=color:green;>Survey</h4>', 'options'=>['colspan'=>6, 'class'=>'text-right']],
				],
			]
		],
		'showHeader' => true,
		
		'columns' => [
            // ['class' => 'yii\grid\SerialColumn'],
			[
                'attribute' => 'participant_id',                
				'header' => 'Client ID',	                 				
				'headerOptions' => ['style'=>'color:black;'],
				'contentOptions' => ['style'=>'color:black;'],
				
            ],
            [
				'attribute' => 'record_date',
				'format' => 'date',
			],
		/*	[
							
                'header' => 'Visit Code',				
				'headerOptions' => ['style'=>'color:Teal;'],
               // 'contentOptions' => ['style'=>'color:black;font-weight:bold'],								
				'format' => 'raw',				
				'value'=> function ($model) {
					return $model->getVisitname($model->participant_id);
				}
			], */
			
			[
					'attribute' => 'visit',           
					'noWrap' => true,			
		            'value'=> function ($model) {
                     return $model->getVisits($model->visit);
					}
				
             
				],
			
			[
				'attribute' => 'cd4_test_part_id',
				'header' => 'CD4 Count',				
				'headerOptions' => ['style'=>'color:red;'],
				'format' => 'raw',				
				'value'=> function ($model) {
                    return (isset($model->linkage) && $model->linkage->hiv_linkage_q2a == 1) ? $model->getCd4($model->participant_id,$model->visit) : "N/R";
					// return $model->getCd4($model->participant_id,$model->visit);
				}
			],
			
			[
				'attribute' => 'hiv_visit_part_id',
				'header' => 'HIV Visit',				
				'headerOptions' => ['style'=>'color:red;'],
				'format' => 'raw',				
				'value'=> function ($model) {
                    return (isset($model->linkage) && $model->linkage->hiv_linkage_q2a == 1) ? $model->getHivvisit($model->participant_id,$model->visit) : "N/R";
					// return $model->getHivvisit($model->participant_id,$model->visit);
				}
			],
			
			[				
                'header' => 'Lab Repository Draw',				
				'headerOptions' => ['style'=>'color:Indigo;'],				
				'format' => 'raw',				
				'value'=> function ($model) {
					return $model->getLab($model->participant_id,$model->visit);
				}
			],
			[
				'header' => 'Contact Form',
				'headerOptions' => ['style'=>'color:OrangeRed;font-weight: bold'],
				'format' => 'raw',
				'value'=> function ($model) {
					return $model->getContact($model->participant_id,$model->visit);
				}
			],
			
			[
				'attribute' => 'demographics_part_id',
				'header' => 'DG',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
				'value'=> function ($model) {
                    return $model->getDg($model->participant_id,$model->visit);
              	}
			],
			[
				'attribute' => 'quality_of_life_part_id',
				'header' => 'QL',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
				'value'=> function ($model) {
                    return $model->getQl($model->participant_id,$model->visit);
              	}
			],
			[
				'attribute' => 'hiv_continuum_part_id',
				'header' => 'HIV',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
				'value'=> function ($model) {
                    return $model->getHivcon($model->participant_id,$model->visit);
              	}
			],
			[
				'attribute' => 'pre_art_beliefs_part_id',
				'header' => 'Pre ART',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
                // 'visible' => (isset($model->linkage) && $model->linkage->hiv_linkage_q5 == ""),
				'value'=> function ($model) {
                    return (isset($model->linkage) && $model->linkage->hiv_linkage_q5 == "") ? $model->getPreart($model->participant_id,$model->visit) : "N/R";
              	}
			],
			[
				'attribute' => 'post_art_beliefs_part_id',
				'header' => 'ART',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
                // 'visible' => (isset($model->linkage) && $model->linkage->hiv_linkage_q5 != ""),
				'value'=> function ($model) {
                    return (isset($model->linkage) && $model->linkage->hiv_linkage_q5 != "") ? $model->getPostart($model->participant_id,$model->visit) : "N/R";
              	}
			],
			[
				'attribute' => 'substance_use_part_id',
				'header' => 'SU',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
				'value'=> function ($model) {
                    return $model->getSu($model->participant_id,$model->visit);
              	}
			],
			[
				'attribute' => 'risk_behavior_part_id',
				'header' => 'RB',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
				'value'=> function ($model) {
                    return $model->getRb($model->participant_id,$model->visit);
              	}
			],
			[
				'attribute' => 'depression_part_id',
				'header' => 'PHQ',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
				'value'=> function ($model) {
                    return $model->getPhq($model->participant_id,$model->visit);
              	}
			],
			[
				'attribute' => 'health_care_utilization_part_id',
				'header' => 'HCU',
				'headerOptions' => ['style'=>'color:green;'],
                'format' => 'raw',
				'value'=> function ($model) {
                    return $model->getHcu($model->participant_id,$model->visit);
              	}
			],
			[
							
                'header' => 'Paid',				
				'headerOptions' => ['style'=>'color:blue;'],
                'contentOptions' => ['style'=>'color:black;font-weight:bold'],								
				'format' => 'raw',				
				'value'=> function ($model) {
					return $model->getPaymentstatus($model->participant_id,$model->visit);
				}
			],
			
			// [
			// 	'label' => 'ART Book Scan',
			// 	'format' => 'raw',
			// 	'value'=> function ($model) {
			// 		return $model->getArt($model->participant_id,$model->visit);
			// 	}
			// ],
			
			
        ],
    ]); ?>
</div>
