<?php

use yii\web\View;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\base\Converter;

use app\base\Common;
use kartik\widgets\DatePicker;
use kartik\grid\GridView;

$this->title = Yii::t('app', Common::getMenuname());
$this->params['breadcrumbs'][] = $this->title;

?>

<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(['enableAjaxValidation' => false, 'action' => ['index'], 'method' => 'get', '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>',
						];
						$fmt = strtolower(Yii::$app->formatter->dateFormat);
						$fmt = str_replace("dd-", "", $fmt);
                    ?>                  
                    <?= $form->field($model, 'month', $template)->widget(DatePicker::classname(), ['options' => ['placeholder' => $model->getAttributeLabel("month")], 'pluginOptions' => ['autoclose' => true, 'endDate' => '0', 'minViewMode' => 1, 'format' => $fmt]]) ?>
                    <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>
					<?php ActiveForm::end(); ?>

					<?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>$title</b>",'afterOptions'=>['class'=>'grid_panel_remove']], 
		//'toolbar'=>false,
		
    	// 'filterModel' => $searchModel,
        // 'showOnEmpty' => true,
        // 'emptyCell' => '-',		
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            
			[
				'attribute' => 'sum_ost_visit_q2',
				 'label'=>'2mg',
				
			],
			[
				'attribute' => 'sum_ost_visit_q3',
				'label'=>'0.4mg',
				
			],
			[
				'attribute' => 'sum_ost_visit_q4',
				'label'=>'0.2mg',
				
			],
			[
				'attribute' => 'sum_ost_visit_q5',
				 'label'=>'Total mg',
				
			],
			 
        ],
							
						]); ?>
					<?php endif; ?>
                </div>
                <!-- /.col-lg-6 (nested) -->
            </div>
            <!-- /.row (nested) -->
        </div>
        <!-- /.panel-body -->
    </div>
    <!-- /.panel -->
</div>