<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
?>
<div class='row'>
        <div class='col-md-6'>
            <div class="card">
             <div class="card-header">	
                  <h5 class='card-title'><i class="fas fa-paper-plane"></i> Pengaturan API WA</h5></div>    		
						<div class="card-body">
                       
					 <iframe width="100%" height="615" src="<?= $setting['url_api'] ?>/scan" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
					 </div>
                        </div>
					  </div>
						 <div class='col-md-6'>
            <div class="card">
             <div class="card-header">	
                  <h5 class='card-title'><i class="fas fa-paper-plane"></i> Pengaturan API WA</h5></div>    		
						<div class="card-body">
                       <form id="formpengaturan" class="form-horizontal" enctype='multipart/form-data'>
							<div class="box-body box-pane">
					      <div class="form-group-sm">
							<label>URL API</label>
							
							<div class="input-group">
						   <input type="text" name="url" value="<?= $setting['url_api']  ?>" class="form-control" required >
						    <span class="input-group-btn">
						   <button type='submit' name='submit' class='btn btn-outline-primary' style="margin-right:18px"><i class='fa fa-check-circle'></i>Simpan</button>
                          </span>
					        </div>    
							</div>
							
					 </div>
					  </form>
                        </div>
					 </div>
                        </div>
						  <script>
			   $('#formpengaturan').submit(function(e) {
					e.preventDefault();
					var data = new FormData(this);
				  
					$.ajax({
						type: 'POST',
						url: 'pengaturan/crud_setting.php?pg=setting_api',
						enctype: 'multipart/form-data',
						data: data,
						cache: false,
						contentType: false,
						processData: false,
						success: function(data) {
						 iziToast.info(
						{
							title: 'Sukses!',
							message: 'Data 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>