Commit e046f1e0 by henny flora panjaitan

by daud

parent e5104d0e
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVoting */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="hasil-voting-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_voting')->textInput() ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'pilihan')->textInput() ?>
<?= $form->field($model, 'status_voting')->textInput() ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<head>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
</head>
<?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 yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVoting */
/* @var $form yii\widgets\ActiveForm */
$urlHasilVoting = Url::to(['hasil-voting/result-voting']);
?>
<hr>
<center><h3 class="text-danger"><b>Hasil Voting <?= $voting->nama_voting;?></b></h3></center>
<hr>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-danger">
<div class="panel-heading">
<center><h3 class="panel-title">Grafik Persentase Voting <?= $voting->nama_voting;?></h3></center>
</div>
<div class="panel-body">
<figure class="highcharts-figure" id="voting">
</figure>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-success">
<div class="panel-heading">
<center><h3 class="panel-title"><b>Jumlah Suara Kandidat <?= $voting->nama_voting;?></b></h3></center>
</div>
<div class="panel-body">
<table class="table">
<tr>
<td><b>KANDIDAT</b></td>
<td align="center"><b>JUMLAH SUARA</b></td>
</tr>
<?php
foreach ($hasil_voting as $key => $value) {
?>
<tr>
<td>
<?php
$kandidat = TKandidat::find()->where(['id_kandidat' => $value['pilihan']])->one();
echo $kandidat->nama_kandidat;
?>
</td>
<td align="center"><h4><span class="label label-primary"><?= $value['Jumlah_Voting']?></span></h4></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
</div>
<?php
$this->title = '';
$script = <<< JS
$(document).ready(function(){
txt = 'Hasil Voting '
$.ajax({
url: '{$urlHasilVoting}',
type: "GET",
data:{
id_voting: {$voting->id_voting},
},
contentType: "application/json",
dataType: 'json',
success: function(response){
Highcharts.chart('voting', {
credits: {
enabled: false
},
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: ''
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
accessibility: {
point: {
valueSuffix: '%'
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.2f} %'
}
}
},
series: [{
name: 'Persentase Voting',
colorByPoint: true,
data: response,
}]
});
},
});
});
JS;
$this->registerJs($script)
?>
\ No newline at end of file
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVotingSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="hasil-voting-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_voting') ?>
<?= $form->field($model, 'id_user') ?>
<?= $form->field($model, 'pilihan') ?>
<?= $form->field($model, 'status_voting') ?>
<?= $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'created_by') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'updated_by') ?>
<?php // echo $form->field($model, 'active') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVoting */
$this->title = 'Create Hasil Voting';
$this->params['breadcrumbs'][] = ['label' => 'Hasil Votings', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="hasil-voting-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<head>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
</head>
<?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 yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVoting */
/* @var $form yii\widgets\ActiveForm */
$urlHasilVoting = Url::to(['hasil-voting/result-voting']);
$urlFilterHasilVoting = Url::to(['hasil-voting/filter-hasil-voting']);
?>
<div class="hasil-voting-form">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
</div>
<div class="col-lg-2 col-md-2 col-sm-2" align="right">
<?= Html::a('<span class="glyphicon glyphicon-step-backward"></span>Kembali', ['voting/index-hasil-voting'], ['class' => 'btn btn-default']) ?>
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<?php
echo Select2::widget([
'name' => 'id_voting',
'data' => $arrayVoting,
'options' => [
'placeholder' => 'Filter Data Voting...',
'id'=>'hasilvoting'
],
'pluginOptions' => [
'allowClear' => false
],
]);
?>
</div>
</div>
<div id="filterhasilvoting">
<hr>
<center><h3 class="text-danger"><b>Hasil Voting <?= $voting->nama_voting;?></b></h3></center>
<hr>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-danger">
<div class="panel-heading">
<center><h3 class="panel-title">Grafik Persentase Voting <?= $voting->nama_voting;?></h3></center>
</div>
<div class="panel-body">
<figure class="highcharts-figure" id="voting">
</figure>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-success">
<div class="panel-heading">
<center><h3 class="panel-title"><b>Jumlah Suara Kandidat <?= $voting->nama_voting;?></b></h3></center>
</div>
<div class="panel-body">
<table class="table">
<tr>
<td><b>KANDIDAT</b></td>
<td align="center"><b>JUMLAH SUARA</b></td>
</tr>
<?php
foreach ($hasil_voting as $key => $value) {
?>
<tr>
<td>
<?php
$kandidat = TKandidat::find()->where(['id_kandidat' => $value['pilihan']])->one();
echo $kandidat->nama_kandidat;
?>
</td>
<td align="center"><h4><span class="label label-primary"><?= $value['Jumlah_Voting']?></span></h4></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
</div>
</div>
</div>
<?php
$this->title = '';
$script = <<< JS
$(document).ready(function(){
txt = 'Hasil Voting '
$.ajax({
url: '{$urlHasilVoting}',
type: "GET",
data:{
id_voting: {$voting->id_voting},
},
contentType: "application/json",
dataType: 'json',
success: function(response){
Highcharts.chart('voting', {
credits: {
enabled: false
},
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: ''
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
accessibility: {
point: {
valueSuffix: '%'
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.2f} %'
}
}
},
series: [{
name: 'Persentase Voting',
colorByPoint: true,
data: response,
}]
});
},
});
});
$("#hasilvoting").on("change",function(){
//$(".loading-image").show();
$.ajax({
url:"{$urlFilterHasilVoting}",
type: "GET",
data:"id_voting="+$(this).val(),
success:function(data){
$("#filterhasilvoting").html(data);
//$(".loading-image").hide();
},
error:function(xhr, ajaxOptions, throwError)
{
//$(".loading-image").hide();
alert("GAGAL LOAD DATA");
}
});
});
JS;
$this->registerJs($script)
?>
\ No newline at end of file
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\HasilVotingSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Hasil Votings';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="hasil-voting-index">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Create Hasil Voting', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id_voting',
'id_user',
'pilihan',
'status_voting',
'created_at',
//'created_by',
//'updated_at',
//'updated_by',
//'active',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>
<?php
use yii\helpers\Html;
use kartik\form\ActiveForm;
use kartik\select2\Select2;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVoting */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="hasil-voting-form">
<?php
if(!is_null($hasil_voting)){
?>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3">
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<center><h4>Voting <?= $voting->nama_voting;?></h4></center>
</div>
<div class="panel-body">
<h4>Terima Kasih Buat Partisipasi Anda Telah Melakukan Online Voting Pada <i class="text-danger"><?= $voting->nama_voting;?></i><br></h4>
</div>
</div>
</div>
</div>
<?php
}
else{
?>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3">
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<center><h4>Voting <?= $voting->nama_voting;?></h4></center>
</div>
<div class="panel-body">
<?php $form = ActiveForm::begin([
'id' => 'login-form',
'type' => ActiveForm::TYPE_VERTICAL,
'formConfig' => ['labelSpan' => 3, 'deviceSize' => ActiveForm::SIZE_SMALL]
]); ?>
<div class="form-group" align="justify">
<?php
echo $form->field($model, 'pilihan')->radioList($arrayPilihan,['separator' => "<br>" ])->label(false);
?>
</div>
<div class="form-group">
<center>
<?= Html::submitButton('SUBMIT VOTING', ['class' => 'btn btn-primary',
'data' => [
'confirm' => 'APAKAH ANDA SUDAH YAKIN DENGAN PILIHAN ANDA?',
'method' => 'post',
],])
?>
</center>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
<?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>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVoting */
$this->title = 'Update Hasil Voting: ' . $model->id_voting;
$this->params['breadcrumbs'][] = ['label' => 'Hasil Votings', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_voting, 'url' => ['view', 'id_voting' => $model->id_voting, 'id_user' => $model->id_user]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="hasil-voting-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\HasilVoting */
$this->title = $model->id_voting;
$this->params['breadcrumbs'][] = ['label' => 'Hasil Votings', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="hasil-voting-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id_voting' => $model->id_voting, 'id_user' => $model->id_user], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id_voting' => $model->id_voting, 'id_user' => $model->id_user], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_voting',
'id_user',
'pilihan',
'status_voting',
'created_at',
'created_by',
'updated_at',
'updated_by',
'active',
],
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\TKandidat */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="tkandidat-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'nama_kandidat')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<center>
<?= Html::submitButton('SIMPAN DATA KANDIDAT', ['class' => 'btn btn-success']) ?>
</center>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\TKandidatSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="tkandidat-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_kandidat') ?>
<?= $form->field($model, 'nama_kandidat') ?>
<?= $form->field($model, 'id_voting') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\TKandidat */
$this->title = 'Tambah Kandidat';
?>
<div class="tkandidat-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use yii\bootstrap\Modal;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel app\models\TKandidatSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Kandidat';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
Modal::begin([
'header' => '<center><h4>FORM DATA KANDIDAT</h4></center>',
'id' => 'modal-data',
'size' => 'modal-md',
'options' => [
'tabindex' => false,
],
]);
echo '<div id="content-modal-data"></div>';
Modal::end();
?>
<div class="tkandidat-index">
<center><h3><b class="text-danger">DATA KANDIDAT PADA VOTING</b></h3></center>
<p align="right">
<?= Html::a('<span class="glyphicon glyphicon-step-backward"></span>Kembali', ['voting/index'], ['class' => 'btn btn-default']) ?>
<?= Html::button('<span class="glyphicon glyphicon-plus"></span> TAMBAH DATA KANDIDAT', ['id' => 'modalButton', 'value' => \yii\helpers\Url::to(['kandidat/create','id_voting' =>$_GET['id_voting']]), 'class' => 'btn btn-success']) ?>
</p>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'nama_kandidat',
'voting.nama_voting',
[
'options' => [
'width' => '150px',
],
'header' => 'AKSI',
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'buttons' => [
'update' => function($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', '#', [
'class' => 'btn btn-warning',
'title' => 'EDIT DATA',
'id' => 'modalButton',
'onclick' => "
$.ajax({
url: '$url',
success:function(data){
$('#title').html('Detail Organisasi');
$('#content-modal-data').html(data);
$('#modal-data').modal('show');
},
error:function(xhr, ajaxOptions, throwError){
alert(xhr.responseText);
}
})
",
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Url::to(['kandidat/delete','id'=>$model->id_kandidat,'id_voting'=>$model->id_voting]), [
'class' => 'btn btn-danger',
'title' => 'HAPUS DATA',
'data-toggle' => 'tooltip',
'data-method' => 'post',
'data-confirm' => 'Apakah anda yakin ingin menghapus data ini?'
]);
},
]
],
],
]); ?>
</div>
<?php
$script = <<< JS
$(function () {
$('#modalButton').click(function () {
$('#modal-data').modal('show')
.find('#content-modal-data')
.load($(this).attr('value'));
});
});
JS;
$this->registerJs($script)
?>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\TKandidat */
$this->title = 'Update Kandidat';
?>
<div class="tkandidat-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\TKandidat */
$this->title = 'View Kandidat';
\yii\web\YiiAsset::register($this);
?>
<div class="tkandidat-view">
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'nama_kandidat',
],
]) ?>
</div>
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use app\widgets\Alert;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;
use hscstudio\mimin\components\Mimin;
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php $this->registerCsrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrap">
<?php
$user = Yii::$app->user->identity;
//$menuItems[] = ['label' => 'MENU', 'options' => ['class' => 'header']];
if (\Yii::$app->user->isGuest){
$menuItems[] = ['label' => 'HOME', 'url' => ['/site/index']];
$menuItems[] = ['label' => 'LOGIN', 'url' => ['/site/login']];
$menuItems[] = ['label' => 'DAFTAR', 'url' => ['/site/register']];
}
else{
$menuItems[] = ['label' => 'HOME', 'icon' => 'home', 'url' => ['site/index']];
$menuItems[] = ['label' => 'VOTING', 'icon' => 'home', 'url' => ['hasil-voting/online-voting']];
$menuItems[] =
['label' => 'DATA VOTING','icon'=>'th-large' ,'items' => [
['label' => 'MASTER DATA VOTING', 'icon' => 'asterisk', 'url' => ['/voting/index'],],
['label' => 'HASIL VOTING', 'icon' => 'bars', 'url' => ['/voting/index-hasil-voting'],],
['label' => 'REKAPITULASI VOTING USER', 'icon' => 'bars', 'url' => ['/voting/index-pengguna-voting'],],
],
];
$menuItems[] =
['label' => 'ACCESS CONTROL','icon'=>'th-large' ,'items' => [
['label' => 'ROLE', 'icon' => 'bars', 'url' => ['/mimin/role/index'],],
['label' => 'USER', 'icon' => 'drivers-license-o', 'url' => ['/mimin/user/index'],],
['label' => 'ROUTE', 'icon' => 'asterisk', 'url' => ['/mimin/route/index'],],
],
];
$menuItems[] = ['label' => 'Logout ('.Yii::$app->user->identity->username.')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post'],];
}
$menuItems = Mimin::filterMenu($menuItems);
?>
<?php
NavBar::begin([
'brandLabel' => '<b><i class="text-primary">Online Voting System</i></b>',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]);
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
]);
NavBar::end();
?>
<div class="container">
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
<?= Alert::widget() ?>
<?= $content ?>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-left">&copy; Developer Team of PSWII_06_<?= date('Y') ?></p>
<p class="pull-right">Web Programming Project</p>
</div>
</footer>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\SwitchInput;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\User */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'nama_user')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'password_hash')->passwordInput(['id'=>'new_password']) ?>
<?= Html::checkbox('reveal-password', false, ['id' => 'reveal-password']) ?> <?= Html::label('Show password', 'reveal-password') ?>
<div class="text-danger" align="center">
* Silahkan Isi Data Pengguna Dengan Baik dan Tidak Boleh Kosong.
</div>
<hr>
<div class="form-group">
<center><?= Html::submitButton($model->isNewRecord ? 'DAFTARKAN' : 'DAFTARKAN', ['class' => $model->isNewRecord ? 'btn btn-primary btn-lg' : 'btn btn-primary']) ?></center>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
$script = <<< JS
$(function () {
$('#reveal-password').change(function () {
$('#new_password').attr('type',this.checked?'text':'password');
//$('#repeat_password').attr('type',this.checked?'text':'password');
//$('#old_password').attr('type',this.checked?'text':'password');
});
});
JS;
$this->registerJs($script)
?>
\ No newline at end of file
<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
$this->title = 'About';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-about">
<h1><?= Html::encode($this->title) ?></h1>
<p>
This is the About page. You may modify the following file to customize its content:
</p>
<code><?= __FILE__ ?></code>
</div>
<?php
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\ContactForm */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
$this->title = 'Contact';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-contact">
<h1><?= Html::encode($this->title) ?></h1>
<?php if (Yii::$app->session->hasFlash('contactFormSubmitted')): ?>
<div class="alert alert-success">
Thank you for contacting us. We will respond to you as soon as possible.
</div>
<p>
Note that if you turn on the Yii debugger, you should be able
to view the mail message on the mail panel of the debugger.
<?php if (Yii::$app->mailer->useFileTransport): ?>
Because the application is in development mode, the email is not sent but saved as
a file under <code><?= Yii::getAlias(Yii::$app->mailer->fileTransportPath) ?></code>.
Please configure the <code>useFileTransport</code> property of the <code>mail</code>
application component to be false to enable email sending.
<?php endif; ?>
</p>
<?php else: ?>
<p>
If you have business inquiries or other questions, please fill out the following form to contact us.
Thank you.
</p>
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
<?= $form->field($model, 'name')->textInput(['autofocus' => true]) ?>
<?= $form->field($model, 'email') ?>
<?= $form->field($model, 'subject') ?>
<?= $form->field($model, 'body')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
]) ?>
<div class="form-group">
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php endif; ?>
</div>
<?php
/* @var $this yii\web\View */
/* @var $name string */
/* @var $message string */
/* @var $exception Exception */
use yii\helpers\Html;
$this->title = $name;
?>
<div class="site-error">
<h1><?= Html::encode($this->title) ?></h1>
<div class="alert alert-danger">
<?= nl2br(Html::encode($message)) ?>
</div>
<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>
</div>
<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\helpers\Url;
use yii\bootstrap;
$this->title = 'Online Voting System';
?>
<div class="site-index">
<div class="jumbotron">
<h1>SELAMAT DATANG DI APLIKASI ONLINE VOTING</h1>
</div>
</div>
<?php
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\LoginForm */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
$this->title = 'Login';
?>
<div class="site-login">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3">
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<center><h2>LOGIN PENGGUNA</h2></center>
<hr>
<p><center>Silahkan Masukkan Username dan Password Anda:</center></p>
<?php $form = ActiveForm::begin([
'id' => 'login-form',
'layout' => 'horizontal',
/*'fieldConfig' => [
'template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
'labelOptions' => ['class' => 'col-lg-1 control-label'],
],*/
]); ?>
<?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<?= $form->field($model, 'rememberMe')->checkbox([
'template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input} {label}</div>\n<div class=\"col-lg-8\">{error}</div>",
]) ?>
<div class="form-group">
<center>
<?= Html::submitButton('LOGIN', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
</center>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
<?php
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\ContactForm */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
$this->title = 'Tambah User Baru';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-signup">
<h1><?= Html::encode($this->title) ?></h1>
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(['id' => 'form-signup']); ?>
<?= $form->field($model, 'fullname')->textInput(['autofocus' => true]) ?>
<?= $form->field($model, 'role')->dropDownList([ 'Admin' => 'Admin', 'Mahasiswa' => 'Mahasiswa'], ['prompt' => 'Pilih Role']) ?>
<?= $form->field($model, 'username') ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<div class="form-group">
<?= Html::submitButton('Register', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\User */
$this->title = 'DAFTAR PENGGUNA';
/*$this->params['breadcrumbs'][] = $this->title;*/
?>
<div class="user-create">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3">
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<center><h2>FORM DAFTAR PENGGUNA BARU</h2></center>
<hr>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
</div>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\SwitchInput;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\User */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'nama_user')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->widget(SwitchInput::classname(), [
'pluginOptions' => [
'onText' => 'Active',
'offText' => 'Banned',
]
]) ?>
<?php if (!$model->isNewRecord) { ?>
<strong> Leave blank if not change password</strong>
<div class="ui divider"></div>
<?= $form->field($model, 'new_password') ?>
<?= $form->field($model, 'repeat_password') ?>
<?= $form->field($model, 'old_password') ?>
<?php } ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\UserSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'username') ?>
<?= $form->field($model, 'auth_key') ?>
<?= $form->field($model, 'password_hash') ?>
<?= $form->field($model, 'password_reset_token') ?>
<?php // echo $form->field($model, 'email') ?>
<?php // echo $form->field($model, 'status') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\User */
$this->title = 'Create User';
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\administrator\models\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Users';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create User', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
//'id',
'username',
//'auth_key',
//'password_hash',
//'password_reset_token',
'email:email',
[
'attribute' => 'roles',
'format' => 'raw',
'value' => function ($data) {
$roles = [];
foreach ($data->roles as $role) {
$roles[] = $role->item_name;
}
return Html::a(implode(', ', $roles), ['view', 'id' => $data->id]);
}
],
[
'attribute' => 'status',
'format' => 'raw',
'options' => [
'width' => '80px',
],
'value' => function ($data) {
if ($data->status == 10)
return "<span class='label label-primary'>" . 'Active' . "</span>";
else
return "<span class='label label-danger'>" . 'Banned' . "</span>";
}
],
[
'attribute' => 'created_at',
'format' => ['date', 'php:d M Y H:i:s'],
'options' => [
'width' => '120px',
],
],
[
'attribute' => 'updated_at',
'format' => ['date', 'php:d M Y H:i:s'],
'options' => [
'width' => '120px',
],
],
[
'options' => [
'width' => '80px',
],
'class' => 'yii\grid\ActionColumn'
],
],
]); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\User */
$this->title = 'Update User: ' . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="user-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use kartik\widgets\ActiveForm;
use kartik\widgets\Select2;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\User */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'username',
'auth_key',
'password_hash',
'password_reset_token',
'email:email',
'status',
'created_at',
'updated_at',
],
]) ?>
<?php $form = ActiveForm::begin([]); ?>
<?php
echo $form->field($authAssignment, 'item_name')->widget(Select2::classname(), [
'data' => $authItems,
'options' => [
'placeholder' => 'Select role ...',
],
'pluginOptions' => [
'allowClear' => true,
'multiple' => true,
],
])->label('Role'); ?>
<div class="form-group">
<?= Html::submitButton('Update', [
'class' => $authAssignment->isNewRecord ? 'btn btn-success' : 'btn btn-primary',
//'data-confirm'=>"Apakah anda yakin akan menyimpan data ini?",
]) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\date\DatePicker;
use yii\db\Expression;
use yii\behaviors\TimestampBehavior;
/* @var $this yii\web\View */
/* @var $model app\models\MVoting */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="mvoting-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'nama_voting')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'periode_awal')->widget(DatePicker::classname(),
[
'value' => date('d-M-Y', strtotime('+2 days')),
'options' => ['placeholder' => 'Tanggal Mulai Voting ...'],
'pluginOptions' => [
'format' => 'yyyy-m-d',
'todayHighlight' => true
]
]);
?>
<?= $form->field($model, 'periode_tutup')->widget(DatePicker::classname(),
[
'value' => date('d-M-Y', strtotime('+2 days')),
'options' => ['placeholder' => 'Tanggal Selesai Voting ...'],
'pluginOptions' => [
'format' => 'yyyy-m-d',
'todayHighlight' => true
]
]);
?>
<?= $form->field($model, 'status_aktif')->dropDownList([ 0 => 'TIDAK AKTIF', 1 => 'AKTIF']) ?>
<div class="form-group">
<center>
<?= Html::submitButton('SIMPAN DATA', ['class' => 'btn btn-success']) ?>
</center>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\MVotingSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="mvoting-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_voting') ?>
<?= $form->field($model, 'nama_voting') ?>
<?= $form->field($model, 'periode_awal') ?>
<?= $form->field($model, 'periode_tutup') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\MVoting */
$this->title = 'Create M Voting';
?>
<div class="mvoting-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use yii\bootstrap\Modal;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel app\models\MVotingSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Voting';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
Modal::begin([
'header' => '<center><h4>DATA VOTING</h4></center>',
'id' => 'modal-data',
'size' => 'modal-lg',
'options' => [
'tabindex' => false,
],
]);
echo '<div id="content-modal-data"></div>';
Modal::end();
?>
<div class="mvoting-index">
<center><h3><b class="text-danger">MASTER DATA VOTING</b></h3></center>
<p align="right">
<?= Html::button('<span class="glyphicon glyphicon-plus"></span> TAMBAH DATA VOTING', ['id' => 'modalButton', 'value' => \yii\helpers\Url::to(['create']), 'class' => 'btn btn-success']) ?>
</p>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'nama_voting',
'periode_awal',
'periode_tutup',
'status_aktif',
[
'attribute' => 'status_aktif',
'format' =>'raw',
'value' => function ($model){
if ($model->status_aktif==1) {
return '<b><span class="label label-primary">AKTIF</span></b>';
}else{
return '<b><span class="label label-danger">TIDAK AKTIF</span></b>';
}
}
],
/* [
'options' => [
'width' => '80px',
],
'class' => 'yii\grid\ActionColumn'
],*/
[
'options' => [
'width' => '150px',
],
'header' => 'AKSI',
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update} {delete}',
'buttons' => [
'view' => function($url, $model) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', '#', [
'class' => 'btn btn-info',
'title' => 'VIEW DATA',
'onclick' => "
$.ajax({
url: '$url',
success:function(data){
$('#title').html('Detail Organisasi');
$('#content-modal-data').html(data);
$('#modal-data').modal('show');
},
error:function(xhr, ajaxOptions, throwError){
alert(xhr.responseText);
}
})
",
]);
},
'update' => function($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', '#', [
'class' => 'btn btn-warning',
'title' => 'EDIT DATA',
'id' => 'modalButton',
'onclick' => "
$.ajax({
url: '$url',
success:function(data){
$('#title').html('Detail Organisasi');
$('#content-modal-data').html(data);
$('#modal-data').modal('show');
},
error:function(xhr, ajaxOptions, throwError){
alert(xhr.responseText);
}
})
",
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
'class' => 'btn btn-danger',
'title' => 'HAPUS DATA',
'data-toggle' => 'tooltip',
'data-method' => 'post',
'data-confirm' => 'Apakah anda yakin ingin menghapus data ini?'
]);
},
]
],
[
'header' => 'KANDIDAT',
'format' =>'raw',
'value' => function ($model){
if ($model->id_voting!=NULL) {
return Html::a('<span class="glyphicon glyphicon-list-alt"></span> LIHAT KANDIDAT VOTING',Url::to(['kandidat/index','id_voting'=>$model->id_voting]),['data-pjax' => 0, 'class' => 'btn btn-default btn-sm',
'title' => 'LIHAT KANDIDAT VOTING',]);
}else{
return "-";
}
}
],
],
]); ?>
</div>
<?php
$script = <<< JS
$(function () {
$('#modalButton').click(function () {
$('#modal-data').modal('show')
.find('#content-modal-data')
.load($(this).attr('value'));
});
});
JS;
$this->registerJs($script)
?>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use yii\bootstrap\Modal;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel app\models\MVotingSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'HASIL VOTING';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
Modal::begin([
'header' => '<center><h4>DATA VOTING</h4></center>',
'id' => 'modal-data',
'size' => 'modal-lg',
'options' => [
'tabindex' => false,
],
]);
echo '<div id="content-modal-data"></div>';
Modal::end();
?>
<div class="mvoting-index">
<center><h3><b class="text-danger">HASIL VOTING</b></h3></center>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'nama_voting',
//'periode_awal',
//'periode_tutup',
[
'attribute' => 'status_aktif',
'format' =>'raw',
'value' => function ($model){
if ($model->status_aktif==1) {
return '<b><span class="label label-primary">AKTIF</span></b>';
}else{
return '<b><span class="label label-danger">TIDAK AKTIF</span></b>';
}
}
],
[
'header' => 'HASIL VOTING',
'format' =>'raw',
'value' => function ($model){
if ($model->id_voting!=NULL) {
return Html::a('<span class="glyphicon glyphicon-stats"></span> LIHAT HASIL VOTING',Url::to(['hasil-voting/hasil-voting','id_voting'=>$model->id_voting]),['data-pjax' => 0, 'class' => 'btn btn-default btn-sm',
'title' => 'LIHAT HASIL VOTING',]);
}else{
return "-";
}
}
],
],
]); ?>
</div>
<?php
$script = <<< JS
$(function () {
$('#modalButton').click(function () {
$('#modal-data').modal('show')
.find('#content-modal-data')
.load($(this).attr('value'));
});
});
JS;
$this->registerJs($script)
?>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use yii\bootstrap\Modal;
use yii\helpers\Url;
use app\models\HasilVoting;
use app\models\User;
/* @var $this yii\web\View */
/* @var $searchModel app\models\MVotingSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'REKAPITULASI PENGGUNA VOTING';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
Modal::begin([
'header' => '<center><h4>DATA VOTING</h4></center>',
'id' => 'modal-data',
'size' => 'modal-lg',
'options' => [
'tabindex' => false,
],
]);
echo '<div id="content-modal-data"></div>';
Modal::end();
?>
<div class="mvoting-index">
<center><h3><b class="text-danger">REKAPITULASI PENGGUNA VOTING</b></h3></center>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'nama_voting',
//'periode_awal',
//'periode_tutup',
[
'header' => 'REKAPITULASI PENGGUNA',
'format' =>'raw',
'value' => function ($model){
if ($model->id_voting!=NULL) {
return Html::a('<span class="glyphicon glyphicon-user"></span> LIHAT REKAPITULASI PENGGUNA',Url::to(['hasil-voting/rekapitulasi-pengguna-voting','id_voting'=>$model->id_voting]),['data-pjax' => 0, 'class' => 'btn btn-default btn-sm',
'title' => 'LIHAT HASIL VOTING',]);
}else{
return "-";
}
}
],
],
]); ?>
</div>
<?php
$script = <<< JS
$(function () {
$('#modalButton').click(function () {
$('#modal-data').modal('show')
.find('#content-modal-data')
.load($(this).attr('value'));
});
});
JS;
$this->registerJs($script)
?>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\MVoting */
$this->title = 'Update Voting';
?>
<div class="mvoting-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\MVoting */
$this->title = 'View Data';
\yii\web\YiiAsset::register($this);
?>
<div class="mvoting-view">
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'nama_voting',
'periode_awal',
'periode_tutup',
],
]) ?>
</div>
<h2>Ini Adalah View Data</h2>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment