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

?>           
	
                   <div class="row">
                          <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title">SINKRON SERVER PUSAT</h5>
										
                                    </div>
                                    <div class="card-body">
									<?php

									$datax = http_request($setting['url_host'] . "/syncsiswa.php?token=" . $setting['token_api']);
									$r = json_decode($datax, TRUE);
									?>
									<?php if ($r <> null) { ?>
								   <button class="btn btn-success" type="button" disabled>
										<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
										TERHUBUNG SERVER
									</button>
									<?php } else { ?>
									<button class="btn btn-danger" type="button" disabled>
										<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
										TIDAK ADA KONEKSI
									</button>
									<p style='color:red'>Periksa kembali settingan anda</p>
									<?php } ?>
									
											</div>
										</div>
										
									</div>
									<?php if ($ac == '') : ?>
					       <div class="col-md-4">
                     
                                <div class="card widget widget-payment-request">
                                    <div class="card-header">
                                  
                                    </div>
                                    <div class="card-body">
                                        <div class="widget-payment-request-container">
                                            <div class="widget-payment-request-author">
                                                <div class="avatar m-r-sm">
                                                    <img src="../images/user.png" alt="">
                                                </div>
                                                <div class="widget-payment-request-author-info">
                                                    <span class="widget-payment-request-author-name"><?= strtoupper($user['nama']) ?></span>
                                                    <span class="widget-payment-request-author-about"><?= $setting['sekolah'] ?></span>
                                               
											   </div>
                                            </div>
											
									<div class="widget-payment-request-info m-t-md">
									 <div class="d-grid gap-2">
									<button class="btn btn-dark" type="button" disabled>
										
										 SINKRON DATA PUSAT
									</button>
											</div>
										<p>
									<form id='formlingkup' class="row g-1"> 
									 <div class="col-md-12">
								<label class="form-label bold">URL Pusat</label>
								<input type="text" name="url" value="<?= $setting['url_host'] ?>" class="form-control" required="true" autocomplete="off">
							     </div>	
                              <p>
									  
								           <div class="d-grid gap-2">
                                       
                                         <button type="submit" class="btn btn-primary flex-grow-1 m-l-xxs" id="blockui-2">Simpan</button>
                                          
                                            </div>
										</form>
										
										</div>
									 </div>
					            </div>
								</div>
							</div>
						</div>
					</div>
				</div>
							
							<script>
						$('#formlingkup').submit(function(e) {
								e.preventDefault();
								var data = new FormData(this);
								$.ajax({
									type: 'POST',
									 url: 'sinkron/tsinkron.php?pg=simpan',
									enctype: 'multipart/form-data',
									data: data,
									cache: false,
									contentType: false,
									processData: false,
									beforeSend: function() {},
									success: function(data) {
									   
										setTimeout(function() {
											window.location.reload();
										}, 1500);
									}
								})
								return false;
							});
							</script>
							
							
            
							   
					  <?php endif ?>
					  
					  
					  
					  	  
					  
					  
					