<title>Input Banner</title>
<div id="pagetitle">INPUT BANNER</div>
<div id="batascontent" class="clearfix">
	<form action="?m=banner_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">
					<div id="gsettinglabel">Judul</div>
					<div id="gsettingedit">
						<input name="banner_judul" type="text" autocomplete="off" required />
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Deskripsi Pendek</div>
					<div id="gsettingedit">
						<textarea name="banner_desk" type="text"></textarea>
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Deskripsi Lengkap</div>
					<div id="gsettingedit">
						<textarea name="banner_deskripsi" id="content"></textarea>
						<script type="text/javascript">
							CKEDITOR_BASEPATH = 'ckeditor';
							var editor = CKEDITOR.replace('content', {
								filebrowserBrowseUrl: "apps/kcfinder/browse.php?type=files"
							});
						</script>
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Keterangan Lain</div>
					<div id="gsettingedit">
						<input name="banner_keterangan" type="text" autocomplete="off" />
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">External Link (Jika ada)</div>
					<div id="gsettingedit">
						<input name="banner_url" type="text" autocomplete="off" />
					</div>
				</div>
			</div>
			
			<div id="gsettingrite">
				<div id="gsettingtitles">ATTRIBUTE</div>
				<!-- KATEGORI -->
				<div id="gsetting" class="clearfix">
					<?php
						$sql = "SELECT bannerkat_id,bannerkat_nama FROM cmas_bannerkat";
						$getCombo = mysqli_query($koneksi, $sql) or die ('Query Gagal');
					?>
					<script type="text/javascript">
						$(function() {
							$("#KATID").change(function(){
								$("img#imgLoad").show();
								var bannerkat_id = $(this).val();
								
								$.ajax({
									type: "POST",
									dataType: "html",
									url: "libs/getBannerKat.php",
									data: "bannerkat_id="+bannerkat_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">Kategori</div>
					<div id="gsettingedit">
						<select name="bannerkat_id" id="KATID">
							<option value="">- Pilih -</option>
							<?php
								while($data = mysqli_fetch_array($getCombo)){
									echo '<option value="'.$data['bannerkat_id'].'">'.$data['bannerkat_nama'].'</option>';
								}
							?>
						</select>
						<select name="bannerkat_nama" id="KATNAME" style="display:none">
							<option value="">- Pilih -</option>
						</select>
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Status</div>
					<div id="gsettingedit">
						<select name="banner_status" required>
							<?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">Image Position</div>
					<div id="gsettingedit">
						<select name="banner_imagepos">
							<option value="none">none</option>
							<option value="top">top</option>
							<option value="right">right</option>
							<option value="bottom">bottom</option>
							<option value="left">left</option>
						</select>
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettinglabel">Upload</div>
					<div id="gsettingedit">
						<input name="banner_image" type="file" />
					</div>
				</div>
				<div id="gsetting" class="clearfix">
					<div id="gsettingimgbig">
						<?php if ($dt['banner_imageid'] == 0) { ?>
							<img src="assets/images/noimage.jpg" alt="<?php echo $dt['banner_judul']; ?>" title="<?php echo $dt['banner_judul']; ?>">
						<?php } else { ?>
							<img src="assets/images/banner/<?php echo $dt['banner_image']; ?>" alt="<?php echo $dt['banner_judul']; ?>" title="<?php echo $dt['banner_judul']; ?>">
							
							<a href="?m=banner_hapusfile&id=<?php echo $dt['banner_id']; ?>" onclick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN?');">
								<span><img src="assets/images/icons/icon_tidak.png" title="Hapus File"></span>
							</a>
						<?php } ?>
					</div>
				</div>
			</div>
		</div>
		<div id="tombolsubmit">
			<a href="?m=banner_index"><input name="Button" type="button" value="KEMBALI" class="myButton"/></a>
			<input name="submit" type="submit" value="SIMPAN" class="submitbutton"/>
		</div>
	</form>
</div>