<title>Input Admin</title>
<div id="pagetitle">INPUT ADMIN</div>
<div id="batascontent">
	<form action="?m=admin_simpan" method="post" enctype="multipart/form-data">
		<div id="wrapgsetting" class="clearfix">
			<div id="gsettingleft">
				<div id="gsettingtitles">GENERAL</div>
				<div id="gsetting" class="clearfix">
					<?php
						$sql = "SELECT admincat_id,admincat_nama FROM cmas_admincat";
						$getCombo = mysqli_query($koneksi, $sql) or die ('Query Gagal');
					?>
					<script type="text/javascript">
						$(function() {
							$("#KATID").change(function(){
								$("img#imgLoad").show();
								var admincat_id = $(this).val();
								
								$.ajax({
									type: "POST",
									dataType: "html",
									url: "libs/getAdminCat.php",
									data: "admincat_id="+admincat_id,
									success: function(msg){
										if(msg == ''){
											$("select#KATNAME").html('<option value="">- Pilih -</option>');
											}else{
											$("select#KATNAME").html(msg);                                                       
										}
										$("img#imgLoad").hide();
									}
								});                    
							});
						});
					</script>
					<div id="gsettinglabel">Level</div>
					<div id="gsettingedit">
						<select name="admincat_id" id="KATID">
							<option value="">- Pilih -</option>
							<?php
								while($data = mysqli_fetch_array($getCombo)){
									echo '<option value="'.$data['admincat_id'].'">'.$data['admincat_nama'].'</option>';
								}
							?>
						</select>
						<select name="admincat_nama" id="KATNAME" style="display:none">
							<option value="">- Pilih -</option>
						</select>
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Nama Lengkap</div>
					<div id="gsettingedit">
						<input name="admin_nama" type="text" autocomplete="off" required />
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Alamat Email</div>
					<div id="gsettingedit">
						<input name="admin_email" type="email" autocomplete="off" required />
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Username</div>
					<div id="gsettingedit">
						<input name="admin_username" type="text" autocomplete="off" required />
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Password</div>
					<div id="gsettingedit">
						<input name="admin_password" type="password" autocomplete="off" required />
					</div>
				</div>
			</div>
			<div id="gsettingrite">
				<div id="gsettingtitles">ATTRIBUTE</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Status</div>
					<div id="gsettingedit">
						<select name="admin_status">
							<?php $stdb=mysqli_query($koneksi, "SELECT * FROM cmas_status ORDER BY status_id ASC"); while($stdt=mysqli_fetch_array($stdb)) { ?>
								<option value="<?php echo $stdt['status_nama']; ?>"><?php echo $stdt['status_nama']; ?></option>
							<?php } ?>
						</select>
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Upload</div>
					<div id="gsettingimage">
						<input name="admin_image" type="file" />
					</div>
				</div>
			</div>
		</div>
		<div id="tombolsubmit">
			<a href="?m=admin_index"><input name="button" type="button" value="KEMBALI" class="myButton"/></a>
			<input name="submit" type="submit" value="SIMPAN" class="submitbutton"/>
		</div>
	</form>
</div>
