<?php 
$memo = memory_get_usage(true) . "\n"; 
$use = memory_get_usage(false) . "\n";
$df = disk_total_space("/");
$df_c = disk_free_space("/") 
?>
<?php if ($user['level'] == 'admin') : ?>

                 <div class='row'>
				<div class="col-md-3">
					 <div class="card widget widget-info-inline">
                                    <div class="card-header">
                                        <h5 class="card-title">Memory Usage<span class="badge badge-info badge-style-light">Premium</span></h5>
								   </div>
                                    <div class="card-body">
                                        <div class="widget-info-container">
                                            <p class="widget-info-text"><b style="color:red"><?= number_format($use) ?> Mb</b></p>
                                           <p class="widget-info-text">NEW SANDIK</p>
                                            <div class="widget-info-image" style="background: url('../dist/img/speed.svg')"></div>
                                        </div>
                                    </div>
                                </div>
                          
					<div class="card widget widget-info-inline">
                                    <div class="card-header">
                                        <h5 class="card-title">Free Memory<span class="badge badge-info badge-style-light">Premium</span></h5>
                                    </div>
                                    <div class="card-body">
                                        <div class="widget-info-container">
                                            <p class="widget-info-text"><b style="color:blue"><?= number_format($memo-$use)  ?> Mb</b></p>
                                            <p class="widget-info-text">NEW SANDIK</p>
                                            <div class="widget-info-image" style="background: url('../dist/img/speed.svg')"></div>
                                        </div>
                                    </div>
                                </div>
                              </div>
					 
					   
				<div class="col-md-3">
                           <div class="card widget widget-stats">
                                    <div class="card-body">
                                        <div class="widget-stats-container d-flex">
                                            <div class="widget-stats-icon widget-stats">
                                                <img src="../dist/img/php.png" width="75">
                                            </div>
                                            <div class="widget-stats-content flex-fill">
                                                <span class="widget-stats-title"><b style="color: blue;">PHP Versi</b></span>
                                                <span class="widget-stats-amount"> <?= phpversion(); ?></span>
                                        
                                            </div>
                                            
                                        </div>
                                    </div>
                                </div>
                                 
                                 <div class="card widget widget-stats">
                                    <div class="card-body">
                                        <div class="widget-stats-container d-flex">
                                            <div class="widget-stats-icon widget-stats-icon-primary">
                                                <i class="fa fa-database fa-2x"></i>
                                            </div>
                                            <div class="widget-stats-content flex-fill">
                                                <span class="widget-stats-title"><b style="color: blue;">Database</b></span>
                                                <span class="widget-stats-info"><h5> <?= mysqli_get_server_info($koneksi); ?></h5></span>
                                        
                                            </div>
                                           
                                        </div>
                                    </div>
                                </div>
							 <div class="card widget widget-info-inline">
                                    <div class="card-header">
                                        <h5 class="card-title">Used Space<span class="badge badge-danger badge-style-light"><?= $df-$df_c ?></span></h5>
								   </div>
                            </div>
						 </div>
                  <div class="col-md-3">  
				 <div class="card widget widget-stats">
                                    <div class="card-body">
                                        <div class="widget-stats-container d-flex">
                                            <div class="widget-stats-icon widget-stats-icon-primary">
                                               <img src="../dist/img/guru.png" width="45" class="success" alt="">
                                            </div>
                                            <div class="widget-stats-content flex-fill">
                                                <span class="widget-stats-info">Kepala Sekolah</span>
                                                <span class="widget-stats-info"><?= $setting['kepsek']; ?></span>
                                        
                                            </div>
                                            
                                        </div>
                                    </div>
                                </div>
				
				                   <div class="card widget widget-stats">
                                    <div class="card-body">
                                        <div class="widget-stats-container d-flex">
                                            <div class="widget-stats-icon widget-stats-icon-primary">
                                              <img src="../dist/img/telegram.png" width="45" alt="">
                                            </div>
                                            <div class="widget-stats-content flex-fill">
                                                <span class="widget-stats-info">Telegram</span>
                                                <span class="widget-stats-info"><a href="#" target="_blank" class="btn btn-sm btn-link"><b>Telegram Group</b></a></span>
                                        
                                            </div>
                                            </div>
                                        </div>
                                    </div>
									 <div class="card widget widget-info-inline">
                                    <div class="card-header">
                                        <h5 class="card-title">Free Space<span class="badge badge-info badge-style-light"><?= $df_c ?></span></h5>
								   </div>
                                </div>
				                </div>
				                <div class="col-xl-3">
                                <div class="card widget widget-info">
                                    <div class="card-body">
                                        <div class="widget-info-container">
                                            <div class="widget-info-image" style="background: url('../dist/img/logo65.png')"></div>
                                            <h6 class="widget-info-title">NEW SANDIK</h6>
                                            <p class="widget-info-text"><b>SISTEM APLIKASI PENDIDIK</b><br>Multi Jenjang REGULER & PKBM <small> Created By STBC</small></p>
                                           
                                        </div>
                                    </div>
                                </div>
                
            </div>
        </div>
    </div>
</div>
                
 <div class='row'>
 <div class="col-md-6">
       
    </div>
        
    
	 
                        <div class='col-md-6' >
						   <div class="card">
							 <div class="card-header">	
								  <h5 class='card-title'>
								  <i class="fas fa-trash"></i> Hapus Data Tabungan</h5></div>   
                                       <div class="card-body">         
												<div class='checkbox'>
												 <form id='formhapusdata' action='' method='post'>
                                                      <b>Pilih Data</b><br />
                                                    <label><input type='checkbox' name='data[]' value='penabung' /> Data Konsumen</label><br />
													<label><input type='checkbox' name='data[]' value='tabungan' /> Data Transaksi</label><br />
													
                                                </div>
                                            </div>
											<div class="card-body">  
                                            <div class="row mb-1">
													<label  class="col-md-4 col-form-label bold">Password Admin</label>
													<div class="col-sm-8">
													<div class="input-group">
                                                    <input type='password' name='password' class='form-control' required='true' />
                                                <span class="input-group-btn">
												 <button type='submit' name='submit3' class='btn btn-outline-danger'><i class='fa fa-trash'></i> Reset</button>
												</span>
												</div>
                                               </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
 
    $('#formhapusdata').submit(function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'pengaturan/crud_setting.php?pg=setting_clear',
            data: $(this).serialize(),
            success: function(data) {
                console.log(data);
                if (data == "ok") {
                     iziToast.info(
            {
                title: 'Sukses!',
                message: 'Data berhasil dihapus',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'
                    });
					setTimeout(function() {
                        window.location.reload();
                    }, 2000);
                } else {
                    iziToast.error({
                        title: 'Maaf!',
                        message: data,
                        position: 'topRight'
                    });
                }

            }
        });
        return false;
    });
	
</script>
	
       
	<script>
$('#hapus').on('click', '.hapus', function() {
        var id = $(this).data('id');
        console.log(id);
        Swal.fire({
				  title: 'Are you sure?',
				  text: "Hapus Pesan Terkirim!",
				  type: 'warning',
				  showCancelButton: true,
				  confirmButtonColor: '#3085d6',
				  cancelButtonColor: '#d33',
				  confirmButtonText: 'Yes, delete it!'	
        }).then((result) => {
            if (result.value) {
                $.ajax({
                   url: 'gateway/crud_kontak.php?pg=hapus_pesan',
                    method: "POST",
                    
                    success: function(data) {
						  iziToast.info(
            {
                 title: 'Sukses!',
                message: 'Data berhasil dihapus',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'				  
                });
                        setTimeout(function() {
                            window.location.reload();
                        }, 2000);
                    }
                });
            }
            return false;
        })

    });

</script>
<script>
$('#forminfowa').submit(function(e){
    e.preventDefault();
    var data = new FormData(this);
    
    $.ajax(
    {
        type: 'POST',
        url: 'sandik_admin/crud_admin.php?pg=ubahinfo',
        enctype: 'multipart/form-data',
        data: data,
        cache: false,
        contentType: false,
        processData: false,
        success: function(data)
        {
            
            iziToast.info(
            {
                title: 'Sukses!',
                message: 'Infomasi berhasil disimpan',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'
            });
            setTimeout(function()
            {
                window.location.reload();
            }, 2000);
            
        }
    });
    return false;
});
</script>
<script>
$('#formwa').submit(function(e){
    e.preventDefault();
    var data = new FormData(this);
    
    $.ajax(
    {
        type: 'POST',
        url: 'sandik_admin/crud_admin.php?pg=ubahwa',
        enctype: 'multipart/form-data',
        data: data,
        cache: false,
        contentType: false,
        processData: false,
        success: function(data)
        {
            
            iziToast.info(
            {
                title: 'Sukses!',
                message: 'Nomor WA Gateway berhasil disimpan',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'
            });
            setTimeout(function()
            {
                window.location.reload();
            }, 2000);
            
        }
    });
    return false;
});
</script>


<script>
$('#example').on('click', '.hapus', function() {
        var id = $(this).data('id');
        console.log(id);
        Swal.fire({
				  title: 'Are you sure?',
				  text: "Hapus Akun WA Gateway!",
				  type: 'warning',
				  showCancelButton: true,
				  confirmButtonColor: '#3085d6',
				  cancelButtonColor: '#d33',
				  confirmButtonText: 'Yes, delete it!'	
        }).then((result) => {
            if (result.value) {
                $.ajax({
                   url: 'sandik_admin/crud_admin.php?pg=hapusakun',
                    method: "POST",
                    data: 'id=' + id,
                    success: function(data) {
						  iziToast.info(
            {
                 title: 'Sukses!',
                message: 'Data berhasil dihapus',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'				  
                });
                        setTimeout(function() {
                            window.location.reload();
                        }, 2000);
                    }
                });
            }
            return false;
        })

    });

</script>
<?php endif ?>
<?php if ($user['level'] == 'guru') : ?>

<div class="row">
<div class="col-md-8">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class='box-title'>
                    Informasi Jadwal
                </h4>
                <div class='box-tools pull-right' id="hapus">
               			
                </div>
            </div>
            <div class='box-body'>
                <div class='table-responsive'>
                        <table style="font-size: 12px" id='example1' class='table'>
                            <thead>
                                <tr>
                                    <th width='3px'>No</th>
									<th width='5%'>Tingkat</th>
									  <th width='5%'>Kelas</th>
                                    <th>Nama Mapel</th>  
                                     <th>Guru Mapel</th> 	
									 <th width='10%'>Hari</th>
                                      <th width='5%'>Dari</th>
                                        <th width='5%'>Sampai</th>									  
									
                                </tr>
                            </thead>
							
							<tbody>
							
                                <?php
								$harix=date('D');
								$no = 0;
								
								   $query = mysqli_query($koneksi, "select * from jadwal_mapel
								 JOIN users ON users.id_user=jadwal_mapel.guru WHERE  jadwal_mapel.guru='$_SESSION[id_user]' ");
								 
                            while ($mapel = mysqli_fetch_array($query)) {
							$hari=fetch($koneksi,'m_hari',['inggris' =>$mapel['hari']]);
                                $no++;
                            ?>
							 <tr>
                                    <td class="hidden-xs"><?= $no; ?></td>
									 <td><?= $mapel['tingkat'] ?></td>
									 <td><?= $mapel['kelas'] ?></td>
							        <td><?= $mapel['mapel'] ?></td>
									<td><?= $mapel['nama'] ?></td>
									<td><?= $hari['hari'] ?></td>					
									<td><?= $mapel['dari'] ?></td>
								   <td><?= $mapel['sampai'] ?></td>
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
            </div>
        </div>
    </div>
	</div>
	
	<div class="col-md-4" >
            <div class="panel panel-default">
                <div class="box-body">
				<h4 class='box-title'>Posko Sekolah</h4>
                            <h6>Internal Teknis</h6>
                    <div id='infoweb'>
					</div>
                    <ul class="list-group">
                        <li class="list-group-item"><img src="../dist/img/guru.png" width="45" class="success" alt="">
                             &nbsp;&nbsp;Kepala Sekolah</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#"><b><?php echo $setting['kepsek']; ?></b></a>
                    
                            </li>
                        <li class="list-group-item"><img src="../dist/img/telegram.png" width="45" alt="">
                        
                        &nbsp;&nbsp;Telegram</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" target="_blank"><b>Telegram Group</b></a>
                    </li>
                       
							</ul>
							<br>
						</div>
						</div>
						
            
        <?php endif ?>
		
        <?php
if ($ac == 'clearlog') {
    mysqli_query($koneksi, "TRUNCATE log_guru");
    jump('?');
}

if ($ac == 'clearpengumuman') {
    mysqli_query($koneksi, "TRUNCATE pengumuman");
    jump('?');
}
?>
     
				