<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
?>

<?php if ($ac == '') { ?>

		 <div class='row'>
	 <div class='col-md-12'>
             <div class="card">
             <div class="card-header">
                    <div class='right '>
				    <a href="?pg=dh" class="btn btn-sm btn-success"><i class="fas fa-sync-alt"></i> Daftar Hadir</a>
					<a href="?pg=ba" class="btn btn-sm btn-danger"><i class="fas fa-sync-alt"></i> Berita Acara</a>
					</div>
					
					<h5 class='card-title'><i class="fas fa-sync-alt"></i> Upload Daftar Hadir Ujian</h5>
                </div>
				
			  <div class="card-body">
                    
						<div class="row">	
						<div class="col-md-6">	
						<div class="panel panel-default">							
                     <div class='box-body text-center'>
                    Cetak Daftar Hadir Peserta Ujian dalam Bentuk PDF<br>
                    Setelah di download Silahkan Upload Pada form disamping
                    </div>
                </div>
            </div>
        
       <div class="col-md-6">	
												
                     <div class='card-body'>
					 <form id="formBA" method="post" enctype="multipart/form-data">
					  <div class="form-group">
							<label class="bold">Kode Server</label>
                               <input type="text" name="param" class="form-control" value="<?= $setting['id_server'] ?>" readonly />
                              </div>
                               
								<div class="form-group">
							<label class="bold">Upload Berita Acara</label>							
                             <input type="file" name="upload_file[]" class="form-control" required />
                                </div>
                                     <p>
							 <div class="right">	
                                  <button type="submit" name="submit" class="btn btn-sm btn-success"><i class="fas fa-upload"></i>  Upload</button>
                                </div>
 
							   </form>
					 
							  </div>
						</div>
					</div>
				</div>
			</div>
				</div>
			<script>
	$('#formBA').submit(function(e) {
        e.preventDefault();
        var data = new FormData(this);
      
        $.ajax({
            type: 'POST',
            url: 'server/kirimdh.php',
            enctype: 'multipart/form-data',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
              iziToast.info(
            {
                title: 'Sukses!',
                message: 'Data sedang diprosess...',
				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 } ?>