<?php
require_once '../config.php';

if (isset($_POST['layanan'])) {
	$post_layanan = $db->real_escape_string(e(@$_POST['layanan']));
	$cek_layanan = $db->query("SELECT * FROM layanan_pulsa WHERE id = '{$post_layanan}' AND status = 'Normal'");
	if (mysqli_num_rows($cek_layanan) == 1) {
		$data_layanan = mysqli_fetch_assoc($cek_layanan);
		if ($data_user['level'] === "Reseller") {
		    $harga = (int)$data_layanan['harga_reseller'];
		    } else if ($data_user['level'] === "Admin" || $data_user['level'] == "Vip") {
		    $harga = (int)$data_layanan['harga_premium'];
		} else {
		    $harga = (int)$data_layanan['harga'];
		}
	?>
			
       <div class="collapse-border" id="accordionExample2">
             <div class="card bg-dark shadow">
             
     <div class="card-header collapsed" id="heading202" data-toggle="collapse" role="button" data-target="#collapse202" aria-expanded="false" aria-controls="collapse202">
          <small class="text-smal"><b>- Tampilkan deskripsi layanan -</b></small></div>
<div id="collapse202" class="collapse" aria-labelledby="heading202" data-parent="#accordionExample2" style="">
     <div class="card-body">
          <p class="list-p"><?= $data_layanan['note']; ?></p>
          <div class="">Harga/1000: Rp <?= number_format($harga,0,',','.'); ?></div>
     <div class="">Min: <?= number_format($data_layanan['min'],0,',','.'); ?></div>
     <div class="">Max: <?= number_format($data_layanan['max'],0,',','.'); ?></div>
                            </div>
                       </div>
	         </div>
	   </div>
	<?php
	} else {
	?>
	<div class="alert alert-warning py-1 text-left">
                                            <b>Gagal : Silahkan Pilih Layanan</b>
                                        </div>
	<?php
	}
       } else {
?>
	<div class="alert alert-warning py-1 text-left">
                                            <b>Gagal : Terjadi Sesuatu</b>
                                        </div>
<?php
}


