<?php

/* @var $this \yii\web\View */
/* @var $content string */

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use nota\assets\AppAsset;
use common\widgets\Alert;
use yii\helpers\Url;
use app\models\Kelasguru;
use app\models\Kelas;
use nota\models\Member;
use nota\models\Kodeakses;
use app\models\Usermember;
use nota\models\SessionnotaUser;
use app\models\Matapelajaran;
use app\models\Matapelajaranguru;
use yii\helpers\BaseInflector;
use yii\helpers\ArrayHelper;
use yii\bootstrap\ActiveForm;

?>
<?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">
    <meta name="google-site-verification" content="3BljA8gLyueYQexQz9aa6ayfc93cHySxFWTJFJ_ncdA" />
    <!--Fav and touch icons-->
    <link rel="icon" href="<?= Yii::$app->request->BaseUrl; ?>/icam/iuran_pemeliharaan_lingkungan.ico">
    <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="76x76" href="images/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="120x120" href="images/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="152x152" href="images/apple-touch-icon-152x152.png">
    
    <?php $this->registerCsrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
    <!-- CSS here -->
	<link rel="stylesheet" href="<?= Yii::$app->request->BaseUrl; ?>/icam/style.css">
</head>
<body>
<!-- Preloader 
    <div id="preloader">
        <div class="loader"></div>
    </div>
    /Preloader -->

    <!-- Header Area Start -->
    <header class="header-area">
        <div class="classy-nav-container breakpoint-off">
            <div class="container">
                <!-- Classy Menu -->
                <nav class="classy-navbar justify-content-between" id="conferNav">

                    <!-- Logo -->
                    <a class="" href="<?php echo Url::to(['/']); ?>" style="color: #ffffff; font-size: 21px;">
                    	<!--<img src="<?= Yii::$app->request->BaseUrl; ?>/icam/icon.png" alt="" width="100%">-->
                    	IURAN PEMELIHARAAN LINGKUNGAN
                    </a>

                    <!-- Navbar Toggler -->
                    <div class="classy-navbar-toggler">
                        <span class="navbarToggler"><span></span><span></span><span></span></span>
                    </div>

                    <!-- Menu -->
                    <div class="classy-menu">
                        <!-- Menu Close Button -->
                        <div class="classycloseIcon">
                            <div class="cross-wrap"><span class="top"></span><span class="bottom"></span></div>
                        </div>
                        <!-- Nav Start -->
                        <div class="classynav">
                            <ul id="nav">
                                <li class="active"><a href="<?php echo Url::to(['/']); ?>">Home</a></li>
                                <?php
                                if (Yii::$app->user->isGuest) {
	                    		// echo '<li><a href="'.Url::to(['site/index']).'">Tentang Aplikasi</a></li>';
								}
                                ?>
                                <?php
                                if (Yii::$app->user->isGuest) {
					            } else {
									if(Yii::$app->user->identity->id){
										
										echo '</li>
										<!-- <li><a href="'.Url::to(['site/index']).'">Tentang Aplikasi</a></li> -->
										<li><a class="" href="'.Url::to(['admin/dashboard']).'">MENU DASHBOARD IPL</a></li>
										';
									} else {
										$kelasku = Kelas::find()->where(['iId' => Yii::$app->user->identity->idKelas])->andWhere(['idSekolah' => Yii::$app->user->identity->idSekolah])->one();
										echo '<li><a href="'.Url::to(['kelas/detail', 'slug' => $kelasku->slug]).'">KELAS '.$kelasku->vKelas.'</a></li> ';
										
										//update online
										$time = date('YmdHis');
										$status = Member::find()->where(['id' => Yii::$app->user->identity->id])->one();
										$status->login_time = $time;
										$status->update();
										//echo Yii::$app->user->identity->login_time;
										echo '<li><a href="'.Url::to(['jadwal/index']).'">
										LAPORAN PEMBAYARAN
										</a></li>';
										echo '<li><a href="'.Url::to(['kelas/download/', 'slug' => Yii::$app->user->identity->slug]).'">DOWNLOAD NILAI</a></li>';
									}
								}
                                ?>
                                 
                            </ul>

                            <!-- Get Tickets Button -->	

							<?php
	                    	if (Yii::$app->user->isGuest) {
						        echo '
	                        	<a class="btn confer-btn mt-3 mt-lg-0 ml-3" href="'.Url::to(['site/login']).'"><i class="fa fa-user-circle"></i> LOGIN</a>';
						    } 
	                    	?>   
	                    	
                        </div>
                        <!-- Nav End -->
                    </div>
                </nav>
            </div>
        </div>
    </header>
    
    <!-- Header Area End -->	
	<?= $content ?>	
	<!-- Footer Area Start -->
    <footer class="footer-area bg-img bg-overlay-2 section-padding-20-0">
        <!-- Main Footer Area -->

        <!-- Copywrite Area -->
        <div class="container">
            <div class="copywrite-content">
                <div class="row">
                    <!-- Copywrite Text -->
                    <div class="col-12 col-md-6">
                        <div class="copywrite-text">
                            <p><!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright &copy; <script>document.write(new Date().getFullYear());</script>
</p>
                        </div>
                    </div>
                    <!-- Footer Menu -->
                    <div class="col-12 col-md-6">
                        <div class="footer-menu">
                            <ul class="nav">
                                <li><a href="<?php echo Url::to(['site/index']); ?>"><i class="zmdi zmdi-circle"></i> </a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </footer>
	<!-- Copywrite Area -->    <!-- Footer Area End -->

    <!-- **** All JS Files ***** -->
    <!-- jQuery 2.2.4 -->
    <script src="<?= Yii::$app->request->BaseUrl; ?>/icam/js/jquery.min.js"></script>
    <!-- Popper -->
    <script src="<?= Yii::$app->request->BaseUrl; ?>/icam/js/popper.min.js"></script>
    <!-- Bootstrap -->
    <script src="<?= Yii::$app->request->BaseUrl; ?>/icam/js/bootstrap.min.js"></script>
    <script src="<?= Yii::$app->request->BaseUrl; ?>/icam/js/bootstrap-datepicker.js"></script>
    <!-- All Plugins -->
    <script src="<?= Yii::$app->request->BaseUrl; ?>/icam/js/confer.bundle.js"></script>
    <!-- Active -->
    <script src="<?= Yii::$app->request->BaseUrl; ?>/icam/js/default-assets/active.js"></script>
    
    <!-- DATEPICEKR -->
    <link rel="stylesheet" href="<?= Yii::$app->request->BaseUrl; ?>/icam/bootstrap-datepicker3.css">
	<script type="text/javascript">
	 $(function(){
	  $(".datepicker").datepicker({
	      format: 'yyyy-mm-dd',
	      autoclose: true,
	      todayHighlight: true,
	  });
	 });
	</script>
	<script src="<?= Yii::$app->request->BaseUrl; ?>/icam/css/ckeditor/ckeditor.js"></script>
	
<script type="text/javascript">
    CKEDITOR.replace('ckeditor', {
	uiColor: '#3f4c6b'
    });
</script>
<script type="text/javascript">
        $("#btnPrint").live("click", function () {
            var divContents = $("#dvContainer").html();
            var printWindow = window.open('', '', 'height=400,width=800');
            printWindow.document.write('<html><head><title>DIV Contents</title>');
            printWindow.document.write('</head><body >');
            printWindow.document.write(divContents);
            printWindow.document.write('</body></html>');
            printWindow.document.close();
            printWindow.print();
        });
    </script>
</body>
</html>
<?php $this->endPage() ?>


<script type="text/javascript">
    $(window).on('load',function(){
        $('#myModal').modal({backdrop: 'static', keyboard: false}) 
    });
</script>

<div class="modal show" id="myModalnotif" role="dialog" style="display: none;">
    <div class="modal-dialog">    
      <div class="modal-content">
        <div class="modal-header">
          <h4 class="modal-title">Notifikasi1 !</h4>
          
        </div>
        <div class="modal-body">   
        	<div id="message">

          	<?= Yii::$app->session->getFlash('success');?>
          
      		</div>
        	
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>      
    </div>
  </div>
<link rel="stylesheet" href="<?= Yii::$app->request->BaseUrl; ?>/icam/css/dataTables.bootstrap.min.css" />
<script src="<?= Yii::$app->request->BaseUrl; ?>/icam/js/jquery.dataTables.min.js"></script>
<script>
	$(document).ready( function () {
    $('#datatables_w0').DataTable();
} );


</script>

<script type="text/javascript">
	$('.confirmation').on('click', function(){
		return confirm('Yakin akan menghapus data ini!');
	});
</script>

<script type="text/javascript">
	$('.yakin').on('click', function(){
		return confirm('Yakin akan mengupdate data ini!');
	});
</script>

<script>
function exportTableToExcel(tableID, filename = ''){
    var downloadLink;
    var dataType = 'application/vnd.ms-excel';
    var tableSelect = document.getElementById(tableID);
    var tableHTML = tableSelect.outerHTML.replace(/ /g, '%20');
    
    // Specify file name
    filename = filename?filename+'.xls':'excel_data.xls';
    
    // Create download link element
    downloadLink = document.createElement("a");
    
    document.body.appendChild(downloadLink);
    
    if(navigator.msSaveOrOpenBlob){
        var blob = new Blob(['\ufeff', tableHTML], {
            type: dataType
        });
        navigator.msSaveOrOpenBlob( blob, filename);
    }else{
        // Create a link to the file
        downloadLink.href = 'data:' + dataType + ', ' + tableHTML;
    
        // Setting the file name
        downloadLink.download = filename;
        
        //triggering the function
        downloadLink.click();
    }
}


$(document).ready(function() {
 $("#btnExport").click(function(e) {
 e.preventDefault();

//getting data from our table
 var data_type = 'data:application/vnd.ms-excel';
 var table_div = document.getElementById('tblDatas');
 var table_html = table_div.outerHTML.replace(/ /g, '%20');

var a = document.createElement('a');
 a.href = data_type + ', ' + table_html;
 a.download = 'exported_table_' + Math.floor((Math.random() * 9999999) + 1000000) + '.xls';
 a.click();
 });
});
</script>
