 <?php
	$idmapel=$_GET['id'];
		$nom = mysqli_fetch_array(mysqli_query($koneksi, "SELECT max(nomor) AS nomer FROM soal WHERE id_bank='$idmapel' "));
		$mapel = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM banksoal WHERE id_bank='$idmapel' "));
			?>
 <div class="row">
     <div class="col-md-6">
	 
                <div class="card">
            <div class="card-header">
			 <h5 class="card-title">IMPORT EXCEL MODEL 2 </h5>
			</div>
		 <div class="card-body">
			  <form id="form-import2" action='' method="POST" enctype="multipart/form-data">
                <div class='form-group'>
                    <label>File xlsx</label>
                    <input type="file" class="form-control" name="file"  placeholder="" aria-describedby="helpfile"  required>
                     <small id="helpfile" class="form-text text-muted">File harus .xlsx</small>
                       </div>
							<input type="hidden" name="idmapel" value="<?= $idmapel ?>" >
                           
                            <input type="hidden" name="nomer" value="<?= $nom['nomer'] ?>" >							
                       
                               <div class="form-group kanan">  
							   <a href="?pg=banksoal&ac=lihat&id=<?= $idmapel ?>" class="btn btn-dark"><i class="material-icons">arrow_back</i></a>		
                                  <a href="asesmen/cbtserver_ujian/FORMAT_SOAL_2.xlsx" class="btn  btn-success" data-bs-placement="top" data-bs-toggle="tooltip" title="Download Format soal"><i class='material-icons' >download</i> Format</a>
								<button type="submit" id="blockui-3" class="btn btn-primary" ><i class='material-icons'>upload</i> Upload</button>
                                   </div>
								   </form>
								
                        </div>
                    </div>
                </div>
           <div class="col-md-6">
                <div class="card">
            <div class="card-header">
			 <h5 class="card-title">IMPORT EXCEL MODEL 1 </h5>
			</div>
		 <div class="card-body">
			  <form id="form-import" action='' method="POST" enctype="multipart/form-data">
                <div class='form-group'>
                    <label>File xlsx</label>
                    <input type="file" class="form-control" name="file"  placeholder="" aria-describedby="helpfile" style="width:60%" required>
                     <small id="helpfile" class="form-text text-muted">File harus .xls</small>
                       </div>
							<input type="hidden" name="idmapel" value="<?= $idmapel ?>" >
                           
                            <input type="hidden" name="nomer" value="<?= $nom['nomer'] ?>" >							
                       
                               <div class="form-group">  
							   <a href="?pg=banksoal&ac=lihat&id=<?= $idmapel ?>" class="btn  btn-dark"><i class="material-icons">arrow_back</i></a>		
                                  <a href="asesmen/cbtserver_ujian/FORMAT_SOAL_1.xls" class="btn btn-success" data-bs-placement="top" data-bs-toggle="tooltip" title="Download Format soal"><i class='material-icons'>download</i> Format</a>
								<button type="submit" id="blockui-2" class="btn btn-primary" ><i class='material-icons'>upload</i> Upload</button>
                                   </div>
								   </form>
                        </div>
                    </div>
                </div>
             
             </div>
       <script>
    
    $('#form-import').on('submit', function(e) {
        e.preventDefault();
        $.ajax({
            type: 'post',
            url: 'asesmen/cbtserver_ujian/timpor.php',
            data: new FormData(this),
            processData: false,
            contentType: false,
            cache: false,
            success: function(data) {
                setTimeout(function() {
                    window.location.replace('?pg=banksoal&ac=lihat&id=<?= $idmapel ?>');
                }, 1500);


            }
        });
    });
   
</script>

	<script>
    
    $('#form-import2').on('submit', function(e) {
        e.preventDefault();
        $.ajax({
            type: 'post',
            url: 'asesmen/cbtserver_ujian/timpor2.php',
            data: new FormData(this),
            processData: false,
            contentType: false,
            cache: false,
            success: function(data) {

                setTimeout(function() {
                    window.location.replace('?pg=banksoal&ac=lihat&id=<?= $idmapel ?>');
                }, 2000);


            }
        });
    });
   
</script>

	

