<?php
defined("BASEPATH") or exit("No direct access allowed");
?>
<div class="card-header">
					
          <nav aria-label="breadcrumb">
                      <ol class="breadcrumb bg-warning text-white-all">
                        <li class="breadcrumb-item"><a href="#"><i class="fas fa-tachometer-alt"></i> Home</a></li>
                        <li class="breadcrumb-item"><a href="index.php?page=listgrup"><i class="far fa-file"></i> Grup</a></li>
                        <li class="breadcrumb-item active" aria-current="page"><i class="fas fa-list"></i> Setting Viralkan </li>
                      </ol>
                    </nav>
                    
        <div class="card-body">
            <div class="alert alert-primary alert-has-icon p-4">
            <div class="alert-icon"><i class="far fa-lightbulb"></i></div>
            <div class="alert-body">
            <div class="alert-title">Petunjuk:</div>
            1. Penjelasan terkait fitur ini. <a href="https://blog.biznis.top/2020/01/fitur-viralkan.html" target="_blank">KLIK DISINI</a><br>
            2. Jangan menginput link bonus anda dipesan auto, inputnya di halaman ini. <br>
            3. Pastikan Form Opt yang ada di Landing Page anda harus sama dengan Nomor Grup Viralkan.
            </div>
            </div>
        </div>             

    
 <?php 

if (isset($_POST['ubah'])){
          
            $id = $_POST['id'] ;
            $v1 = mysqli_real_escape_string($con,$_POST['v1']);
            $v2 = mysqli_real_escape_string($con,$_POST['v2']);
            $v3 = mysqli_real_escape_string($con,$_POST['v3']);
            $v4 = mysqli_real_escape_string($con,$_POST['v4']);
            $v5 = mysqli_real_escape_string($con,$_POST['v5']);

            mysqli_query($con,"update grup set v1='$v1',v2='$v2',v3='$v3',v4='$v4',v5='$v5' where id='".$_GET['id']."'");
            
               echo '
    		<div class="alert alert-success alert-dismissable" style="margin-top:20px">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                <h4><i class="icon glyphicon glyphicon-remove"></i> Data Setting Viralkan berhasil disimpan
                </div> 
                ';
               
               echo "
               <div class='container'>
                 <form class='form-horizontal' role='form' action='index.php?page=listgrup' method='POST'>
                   <button type='submit' class='btn btn-primary'><span class='glyphicon glyphicon-log-out'></span> Kembali</button>
                 </form>
               </div>
               
               <script>
        	        swal('Good Job','berhasil menyimpan data','success');
                </script>     
                
               " ;
             
}
?>
   
 <?php 
    
      $tampil=mysqli_fetch_row(mysqli_query($con,"select * from grup where id='".$_GET['id']."'"));
      
      

   ?>   

<div class="card-body">            

   
      <form action="" method="POST">
            <input type="hidden" name="id" value="<?php echo $tampil['id']; ?>">
     
      <form action="" method="POST">
        <p><label>Aktifkan Viralkan</label>
        
         <?php  
            $result = mysqli_query($con,"SELECT * FROM grup where id='".$_GET['id']."' ORDER BY id");
            while($row = mysqli_fetch_assoc($result)){
                if($row['v1']==0) {
                    $v1 = 'Tidak';
                }else{
                    $v1 = 'Ya';
                }     
            echo "<select name='v1' class='form-control'>
            <option value=$row[v1]>$v1</option>
            <option value='0'>Tidak</option>
            <option value='1'>Ya</option>
            </select> 
            ";
            } 
        ?>
        </p>
        <p><label>Aktifkan QRCode Link Share</label>
        
         <?php  
            $result = mysqli_query($con,"SELECT * FROM grup where id='".$_GET['id']."' ORDER BY id");
            while($row = mysqli_fetch_assoc($result)){
                if($row['v5']==0) {
                    $v5 = 'Tidak';
                }else{
                    $v5 = 'Ya';
                }     
            echo "<select name='v5' class='form-control'>
            <option value=$row[v5]>$v5</option>
            <option value='0'>Tidak</option>
            <option value='1'>Ya</option>
            </select> 
            ";
            } 
        ?>
        </p>
        <p><label>Alamat/Url Landing Page</label><input type="text" name="v2" class="form-control" placeholder="https://yantonaim.web.id/bonus" value="<?php echo $tampil[16]; ?>" required><i>Pastikan url Landing Page yang diinput memiliki Form Opt dengan Nomor Grup <?php echo $_GET['id']; ?></i></p><hr>
        <p>Pesan Email Bonus yang dijanjikan kepada prospek yang merefensikan. Tambahkan tag [nama], [email], dan [hp]</p>
	    <p><textarea class="ckeditor" name="v3"><?php If(!empty($tampil[17])) { echo $tampil[17]; }?></textarea>
	    <i>Pesan ini terkirim ke Prospek saat ada prospek lain yang mengisi Form Opt. Jangan input link bonus anda di pesan auto, inputnya di isian ini</i>
	    </p><hr>  
        <p>Keterangan pada Halaman Ucapan Terima kasih / Share</p>
	    <p><textarea class="ckeditor" name="v4"><?php If(!empty($tampil[18])) { echo $tampil[18]; }?></textarea>
	    <i>Input kalimat anda agar prospek mau mengshare informasi. Misal: Dengan anda mengshare informasi ini, maka anda mendapatkan bonus spesial dari kami.</i>
	    </p><hr>   
        
        <div class="form-group">
          <div class  ="col-sm-4">
            <button type="submit" class="btn btn-primary" name="ubah"><span class="glyphicon glyphicon-pencil"></span> Simpan Setting Viralkan </button>
          </div>
        </div>
      </form>
    
</div>
    