<?php
if(count(get_included_files()) ==1) exit("Direct access not permitted.");
if(!$statuslogin) exit;
$mod = basename(__FILE__, '.php');
$page->tbJs($mod);
if(isset($_GET['id'])){
	$id=strip_tags(stripslashes($_GET['id']));
	$page->setJudul("Input Level Peserta Baru");
	$nama="";
	$idlevel="";
	$targetomset="";
	$targetpoint="";
	if($id>0){
		$page->setJudul("Edit Data Level Peserta");
		$query="SELECT * FROM tb_level_peserta WHERE id=?";
		$rs=$db->loadAssoc($query,array($id));
		if(isset($rs['id'])){
			$nama=$rs['nama'];
			$idlevel=$rs['id'];
			$targetomset=number_format($rs['target_omset'],0,',','.');
			$targetpoint=number_format($rs['target_point'],2,',','.');
		}else{
			exit;
		}
	}else{
		exit;
	}
	$page->addLoad("levelpeserta.edit($id)");
	?>
	
	<div class="box_main_konten">
		<h3>DETAIL LEVEL PESERTA</h3>
		<div class="group_form">
			<title>Kode Level</title>
			<div class="col10">
				<input id="idlevel" disabled="true" value="<?php echo $idlevel;?>" />
			</div>
		</div>
		<div class="group_form">
			<title>Nama Level</title>
			<div class="col10">
				<input id="nama" value="<?php echo $nama;?>" />
			</div>
		</div>
		<div class="group_form">
			<title>Target Omset</title>
			<div class="col10">
				<input id="targetomset" onkeyup="kudus.buatduitel(this)" value="<?php echo $targetomset;?>" />
			</div>
		</div>
		<div class="group_form">
			<title>Target Point</title>
			<div class="col10">
				<input id="targetpoint" onkeyup="kudus.buatduitel(this)" value="<?php echo $targetpoint;?>" />
			</div>
		</div>
		<div style="clear: both;"></div>
	</div>
	<div class="box_button_bawah">
		<div id="box_error_simpan" class="error"></div>
		<span class="btmerah btncancel" onclick="levelpeserta.kembali()">Kembali</span>&nbsp;&nbsp;<span onclick="levelpeserta.simpan()" class="bthijau btnsave">Simpan</span>
	</div>
	<?php
}else{
	$page->addLoad("levelpeserta.load()");
	$page->setJudul("Data Level Peserta");
	?>
	<div class="box_button_atas">
		Jumlah baris: <select id="jumlah_hal" class="slkecil" onchange="levelpeserta.loade()">
			<option value="30">30</option>
			<option value="50">50</option>
			<option value="100">100</option>
		</select> &nbsp;
		Hal: <select id="hal_ke" class="slkecil" onchange="levelpeserta.load()"><option value="1">1</option></select>
		&nbsp;<input placeholder="Default: Nama Level" onkeypress="levelpeserta.enter(event)" id="cari" class="in_cari" />
		&nbsp;&nbsp;<span id="btcari" class="btnone btncari" onclick="levelpeserta.loade()">Cari</span>
		&nbsp;&nbsp;<span class="btnone btncanggih" onclick="levelpeserta.caricanggih()">Cari Detail</span>
	</div>
	<div id="grid_levelpeserta"></div>
	<div id="loader_data_kategori" class="error"></div>
	
	<div id="btedit" style="display:none;">
		<span class="icon_edit" onclick="levelpeserta.buat(#{id})"></span>
	</div>
	<?php
}
?>
