<?php

use yii\helpers\Html;
use kartik\form\ActiveForm;
use kartik\select2\Select2;
//use yii\grid\GridView;
use app\models\TKandidat;
use miloschuman\highcharts\Highcharts;
use kartik\grid\GridView;
use kartik\mpdf\Pdf;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVoting */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="hasil-voting-form">
	<div class="row">
		<center><h3 class="text-danger"><b>Rekapitulasi Pengguna Voting <?= $voting->nama_voting;?></b></h3></center>
		<p align="right">
			<?= Html::a('<span class="glyphicon glyphicon-step-backward"></span>Kembali', ['voting/index-pengguna-voting'], ['class' => 'btn btn-default']) ?>
		</p>
		<hr>
		<div class="col-lg-4 col-md-4 col-sm-4">
			<div class="alert alert-success" role="alert">
				<h4 class="text-danger">Total Pengguna Voting</h4>
				<h3><b><?= $count_total_pengguna;?></b> User</h3>
			</div>
		</div>
		<div class="col-lg-4 col-md-4 col-sm-4">
			<div class="alert alert-info" role="alert">
				<h4 class="text-danger">Pengguna Sudah Voting</h4>
				<h3><b><?= $count_sudah_voting;?></b> User</h3>
			</div>
		</div>
		<div class="col-lg-4 col-md-4 col-sm-4">
			<div class="alert alert-danger" role="alert">
				<h4 class="text-danger">Pengguna Belum Voting</h4>
				<h3><b><?= $count_belum_voting;?></b> User</h3>
			</div>
		</div>
	</div>
	<hr>
	<div class="row">
		<div class="col-lg-6 col-md-6 col-sm-6">
			<?php
                echo GridView::widget([
                    'dataProvider'=>$dataProvider,
                    //'filterModel'=>$searchModel,
                    /*'summary'=>'',*/
                    'showPageSummary'=>true,
                    'pjax'=>true,
                    'striped'=>true,
                    'hover'=>true,
                    'headerRowOptions' => ['class' => 'kartik-sheet-style'],
                    'responsive'=>true,
                    //'containerOptions' => ['style' => 'overflow: auto'],
                    'export'=>['fontAwesome'=>true,
                              'showConfirmAlert'=>false,
                              'label'=>'Download',
                              'header'=>'',
                              'options'=>[
                                'class' => 'btn btn-info',
                              ],

                            ],
                    'exportConfig'=>[
                        
                        GridView::PDF =>[
                                  'icon' => 'file-pdf-o',
                                  'iconOptions' => ['class' => 'text-success'],
                                  'filename' => 'Rekapitulasi_Pengguna_Sudah_Voting',
                                  'alertMsg' =>null,
                                  'options' => ['title' => 'Portable Document Format'],
                                  'mime' => 'application/pdf',
                                  'format' => Pdf::FORMAT_A4,
                                  'config' => [
                                      'methods' => [
                                          'SetHeader' => ['Dicetak dari: Aplikasi Online Voting ||Dicetak tanggal: ' . date("D/d-M-Y")],
                                          /*'SetHeader' =>'',*/
                                          'SetFooter' => ['||Halaman {PAGENO}'],
                                      ],                      
                                      'contentBefore'=>'',
                                      'contentAfter'=>'',
                                  ]
                                ],
                        GridView::EXCEL =>[
                                  'icon' => 'file-excel-o',
                                  'iconOptions' => ['class' => 'text-success'],
                                  'filename' => 'Rekapitulasi_Pengguna_Sudah_Voting',
                                  
                                ],
                    ],
                    'toolbar'=>['{toggleData}{export}'],
                    'panel'=>['type'=>'primary', 'heading'=>'REKAPITULASI PENGGUNA SUDAH VOTING'],
                    

                    'columns'=>[
                        [
                          'class'=>'yii\grid\SerialColumn',
                          
                          
                        ],

                        'user.nama_user',
                        'user.email',

                        [
                        	'header' => 'Status Voting',
                            'attribute' => 'id_user',
                            //'value' => 'id_user',
                            'format' => 'raw',
                            'value' => function ($model, $key, $index, $widget) { 
						        if ($model->status_voting == 1) {
                                    return '<b><span class="label label-primary">SUDAH MELAKUKAN VOTING</span></b>';
                                }else{
                                    return '<b><span class="label label-primary">BELUM MELAKUKAN VOTING</span></b>';
                                }
						    },
                            'contentOptions' => [
                              'class' => 'text-center',
                              //'style' => 'font-weight: bold;'
                            ],
                            'headerOptions' => [
                              'class' => 'text-center',
                            ],
                            
                           
                        ],

                        
                    ],
                ]);
            ?>	  
		</div>

  		<div class="col-lg-6 col-md-6 col-sm-6">
  			<?php
                echo GridView::widget([
                    'dataProvider'=>$dataProvider2,
                    //'filterModel'=>$searchModel,
                    /*'summary'=>'',*/
                    'showPageSummary'=>true,
                    'pjax'=>true,
                    'striped'=>true,
                    'hover'=>true,
                    'headerRowOptions' => ['class' => 'kartik-sheet-style'],
                    'responsive'=>true,
                    //'containerOptions' => ['style' => 'overflow: auto'],
                    'export'=>['fontAwesome'=>true,
                              'showConfirmAlert'=>false,
                              'label'=>'Download',
                              'header'=>'',
                              'options'=>[
                                'class' => 'btn btn-danger',
                              ],

                            ],
                    'exportConfig'=>[
                        
                        GridView::PDF =>[
                                  'icon' => 'file-pdf-o',
                                  'iconOptions' => ['class' => 'text-success'],
                                  'filename' => 'Rekapitulasi_Pengguna_Belum_Voting',
                                  'alertMsg' =>null,
                                  'options' => ['title' => 'Portable Document Format'],
                                  'mime' => 'application/pdf',
                                  'format' => Pdf::FORMAT_A4,
                                  'config' => [
                                      'methods' => [
                                          'SetHeader' => ['Dicetak dari: Aplikasi Online Voting ||Dicetak tanggal: ' . date("D/d-M-Y")],
                                          /*'SetHeader' =>'',*/
                                          'SetFooter' => ['||Halaman {PAGENO}'],
                                      ],                      
                                      'contentBefore'=>'',
                                      'contentAfter'=>'',
                                  ]
                                ],
                        GridView::EXCEL =>[
                                  'icon' => 'file-excel-o',
                                  'iconOptions' => ['class' => 'text-success'],
                                  'filename' => 'Rekapitulasi_Pengguna_Belum_Voting',
                                  
                                ],
                    ],
                    'toolbar'=>['{toggleData}{export}'],
                    'panel'=>['type'=>'danger', 'heading'=>'REKAPITULASI PENGGUNA BELUM VOTING'],
                    

                    'columns'=>[
                        [
                          'class'=>'yii\grid\SerialColumn',
                          
                          
                        ],

                        'nama_user',
                        'email',

                        [
                        	'header' => 'Status Voting',
                            'attribute' => 'id',
                            //'value' => 'id_user',
                            'format' => 'raw',
                            'value' => function ($model, $key, $index, $widget) { 
						        if ($model->id != NULL) {
                                    return '<b><span class="label label-danger">BELUM VOTING</span></b>';
                                }else{
                                    return '-';
                                }
						    },
                            'contentOptions' => [
                              'class' => 'text-center',
                              //'style' => 'font-weight: bold;'
                            ],
                            'headerOptions' => [
                              'class' => 'text-center',
                            ],
                            
                           
                        ],

                        
                    ],
                ]);
            ?>
  		</div>
  	</div>
</div>
