<?php

use yii\web\View;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;
use app\base\Converter;
use yii\data\ActiveDataProvider;
use yii\db\Query;
use app\models\Hivarvreminderreport;
use kartik\widgets\DatePicker;
use kartik\grid\GridView;

$this->title = 'HIV ARV Reminder Report';
$this->params['breadcrumbs'][] = $this->title;

 $fromdate = $model->fromdate;
 $todate = $model->todate;
 
 if(empty($model->fromdate))
    $model->fromdate = date('d-m-Y');
if(empty($model->todate))
    $model->todate = date('d-m-Y');
/*<div class="col-md-12"><?= $this->render('ostweekrep', ['dataProvider' => $dataProvider, 'fromdate'=>$fromdate, 'todate'=>$todate]); ?></div>
 */
?>

<div class="drugdisprep-form">
    <h1><?= Html::encode($this->title) ?></h1>
    <div class="panel panel-default">
        <div class="panel-heading">
            
        </div>
        <div class="panel-body">
            <div class="row">
                <div class="col-lg-12">
                    <?php
                       $form = ActiveForm::begin(['options' => ['class' => 'form-horizontal']]);							
                        $template = [
							'labelOptions' => ['class' => 'form-label'],
							'template' => '<div class="col-sm-5">{label}{hint}</div><div class="col-sm-4">{input}{error}</div>',
						];
					
                    ?>               
							
									
					<?= $form->field($model, 'fromdate', $template)->widget(DatePicker::classname(), ['options' => ['placeholder' => $model->getAttributeLabel("fromdate")], 'pluginOptions' => ['autoclose' => true, 'startDate' => '0', 'endDate' => '+5y', 'format' => strtolower(Yii::$app->formatter->dateFormat)]]) ?>
					
                    <?= $form->field($model, 'todate', $template)->widget(DatePicker::classname(), ['options' => ['placeholder' => $model->getAttributeLabel("todate")], 'pluginOptions' => ['autoclose' => true, 'startDate' => '0', 'endDate' => '+5y', 'format' => strtolower(Yii::$app->formatter->dateFormat)]]) ?>
                      
                    <div class="form-group">
                        <div class="col-sm-offset-5 col-sm-7">
                            <?= Html::submitButton(Yii::t('app', 'Go'), ['class' =>'btn btn-success']) ?>
                           
                        </div>
                    </div>
					<div class="row">
					
      <?php ActiveForm::end(); ?>
	   
	   <?php // if(($model->load(Yii::$app->request->post())) ) : ?>
	    <?php if(isset($dataProvider)) : ?>        
<?= GridView::widget([
        'dataProvider' => $dataProvider,
		'formatter' => ['class' => 'yii\i18n\Formatter','nullDisplay' => '-', 'dateFormat' => 'dd-MM-Y','datetimeFormat' => 'dd-MM-Y hh:mm:ss'], 
        'options'=>['style' => 'white-space:nowrap;'],                         
        'panel' => ['type' => GridView::TYPE_PRIMARY,'heading' =>'<b>ARV Refill Reminder Report</b>','beforeOptions'=>['class'=>'grid_panel_remove'],'afterOptions'=>['class'=>'grid_panel_remove']], 
		'summary'=>'',
		'toolbar'=>false,
		  
		//'panel' => ['heading' =>'<b>OST Monthly Summary</b>'],
    	// 'filterModel' => $searchModel,
        // 'showOnEmpty' => true,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            [
                'attribute' => 'hiv_visit_part_id',
                'label' => 'Client ID'
            ],		
			[
                'attribute' => 'ost_master_q1',
                'label' => 'OST ID'
            ],	
			[
                'attribute' => 'link_idlinkage_q1',
                'label' => 'TI ID'
            ],	
			[
				'attribute' => 'Lastvisitdate',
				'label'=>'Last HIV Visit Date',
				'format' => 'date',
				
			],
			
			[
				'attribute' => 'arv_mstr_name',
				'label'=>'ARV',
				
			],
			
			[
				'attribute' => 'hiv_visit_q6',
				'label'=>'Last ARV Qty',
				
			],
			
			[
				'attribute' => 'NextDueDate',
				'label'=>'Next Due Date',
				'format' => 'date',
				
			],
			[
				'attribute' => 'contact_q3',
				'label'=>'Contact Number',		
				
			],
			[
           'attribute' => 'corfrm_q2',
           'label'=>' Contact Number When Registration',
            ],						
						 
        ],
    ]); ?>
	  <?php endif; ?>  
    </div>
                    
                </div>
                <!-- /.col-lg-6 (nested) -->
            </div>
            <!-- /.row (nested) -->
        </div>
        <!-- /.panel-body -->
    </div>
    <!-- /.panel -->
</div>