<?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\artinitiationincentmasterSearch */
/* @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'=>'Generate'], 'url' => ['generate']],
];
?>
<div class="artinitiationincentmaster-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' => [
            [
            	'checkboxOptions' => ['class' => 'checkbox-row'],
            	'visible' => isset(Yii::$app->request->queryParams['ajaxload']),
            	'class' => 'yii\grid\CheckboxColumn'
            ],
            [
            	'visible' => !isset(Yii::$app->request->queryParams['ajaxload']),
            	'class' => 'yii\grid\SerialColumn'
            ],

			// 'art_init_inc_id',
			/*[
				'enableSorting' => !isset(Yii::$app->request->queryParams['ajaxload']),
				'attribute' => 'art_init_inc_survey',
			],*/
			[
				'enableSorting' => !isset(Yii::$app->request->queryParams['ajaxload']),
				'attribute' => 'art_init_inc_part_id',
				'contentOptions' => ['class' => 'col-md-2'],
			],
			[
				'attribute' => 'scrdate',
				'label' => 'Screening Date',
				'contentOptions' => ['class' => 'col-md-2'],
				'format' => 'date',
			],
			[
				'enableSorting' => !isset(Yii::$app->request->queryParams['ajaxload']),
				'attribute' => 'art_init_inc_visitdate',
				'format' => 'date'
			],
			// 'art_init_inc_q1',
			[
				'enableSorting' => !isset(Yii::$app->request->queryParams['ajaxload']),
				'attribute' => 'art_init_inc_q2',
			],
			[
				'visible' => !isset(Yii::$app->request->queryParams['ajaxload']),
				'attribute' => 'art_init_inc_q3',
				'format' => 'date',
			],
			[
				'visible' => !isset(Yii::$app->request->queryParams['ajaxload']),
				'attribute' => 'art_init_inc_q4',
			],
			// 'status',
			// 'create_time:datetime',
			// 'create_user',
			// 'update_time:datetime',
			// 'update_user',
			// 'record_date',
			
			

            [
            	'class' => 'app\behaviours\ActionColumns',
            	'visible' => (!isset(Yii::$app->request->queryParams['ajaxload']) && !isset(Yii::$app->request->queryParams['ajaxlist'])),
            	'template' => '<div class="nowrap">{view} </div>',
				//'template' => '<div class="nowrap">{view} {update} {pdf}</div>',
            	'buttons' => [
	                'pdf' => function($url, $model, $key) {     // render your custom button
		                $options = array_merge([
		                    'title' => Yii::t('yii', 'PDF'),
		                    'target' => '_blank',
		                    'aria-label' => Yii::t('yii', 'PDF'),
		                    'data-pjax' => '0',
		                ]);
		               // if($model->art_init_inc_q1 == 1)
			           //    return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, $options);
	                }
	            ]
            ],
        ],
    ]); ?>
</div>
