<!DOCTYPE html>
<?php $admin = 'Master'; $nama = 'Petunjuk Pemesanan';?>
<html lang="en">
<?php include("layout/meta.php");?>
	<body class="no-skin">
	<?php include("layout/navbar.php");?>
		<div class="main-container ace-save-state" id="main-container">
			<script type="text/javascript">
				try{ace.settings.loadState('main-container')}catch(e){}
				$(document).on("click", ".UploadButton", function () {
						var eventId = $(this).data('id');					
						$('#myModal').modal('show');
						$("#idlist").val(eventId);
				});
					$(document).on("click", ".UploadButtonEdit", function () {
						var eventId = $(this).data('id');						
						$('#idHolder').html( eventId );
						$('#myModal2').modal('show');
						var str = eventId;
						var res = str.split("*");
						var idlist = res[0];
						var namalist = res[1];
					    var deskripsi = res[2];
						var status = res[3];
						var depan = res[4];

						//$("#idedit").val(eventId);
						$("#idlist1").val(idlist);
						$("#namalist1").val(namalist);
						$("#deskripsi1").html(deskripsi);
						if(status ==1){
						$("#status1").prop('checked', true);
						}
						if(status ==0){
						$("#status1").prop('checked', false);						
						}
						if(depan ==1){
						$("#depan1").prop('checked', true);
						}
						if(depan ==0){
						$("#depan1").prop('checked', false);						
						}
				});				
			</script>
			<?php include("layout/sidebar.php");?>
			<div class="main-content">
			  <div class="main-content-inner">
				<div class="col-xs-12">
				<?php if(!empty($pesan)){ ?>
				<div class="alert alert-<?php echo $alert;?>" role="alert" style="text-align:center;">
				 <strong><?php echo validation_errors(); echo $pesan ;?></strong>
				</div><?php }?>					
					<h3 class="header smaller lighter blue"><?php echo $nama;?></h3>										
				  <div class="widget-box">
					<div class="widget-body">										
					<div class="table-header">
						<?php echo $admin.' <i class="ace-icon fa fa-angle-double-right"></i> '.$nama; ?>
					</div>     				
					<table id="tabel-data" class="table table-striped table-bordered  table-hover" width="100%" cellspacing="0">
						<thead>
							<tr>
								<th width="5%" style="text-align: center;">No</th>							
								<th width="20%" style="text-align: left;">Nama</th>								
								<th width="50%" style="text-align: center;">Link</th>								
								<th width="10%" style="text-align: center;">Aktif</th>								
								<th width="10%" style="text-align: center;">Depan</th>								
								<th width="10%" style="text-align: center;">Aksi</th>								
							</tr>
						</thead>
						<tbody>		
						<?php $no=0; foreach($infosewa->result() as $row){ $no++;
						$tes= $row->deskripsi;
						?>
							<tr>		
								<?php $attribute = array('role' => 'form', 'class' => 'form-horizontal' );
								echo form_open(base_url().'admin/icon/edit', $attribute); ?>								
								<td align="center"><input type="hidden" name="id" value="<?php echo $row->idlist;?>"><?php echo $no;?></td>							
								<td align="left"><?php echo $row->namalist;?></td>
								<td align="left"><?php echo $row->deskripsi;?></td>
								<td align="center"><?php if($row->status=='1'){ echo '<span class="label label-info arrowed-right arrowed-in">Ya</span>' ;}else{ echo '<span class="label label-danger arrowed-right arrowed-in">Tidak</span>' ; }?></td>
								<td align="center"><?php if($row->depan=='1'){ echo '<span class="label label-info arrowed-right arrowed-in">Ya</span>' ;}else{ echo '<span class="label label-danger arrowed-right arrowed-in">Tidak</span>' ; }?></td>
								<td align="center">
									<button  type="button"  class="btn-primary UploadButtonEdit" data-id="<?php echo cetak($row->idlist.'*'.$row->namalist.'*'.$row->deskripsi.'*'.$row->status.'*'.$row->depan);?>"  data-dismiss="modal" title="Detail"><i class="ace-icon fa fa-pencil "></i> </button>				
								</td>		
								<?php echo form_close();?>	
							</tr>
						<?php }?>	
						</tbody>
					</table>						
					</div>
				  </div>
				</div>
				<!-- /.span -->
			  </div>
			  <!-- /.main-content -->
			</div>
			<div id="myModal2" class="modal fade" role="dialog">
			  <div class="modal-dialog">
				<!-- Modal content-->
				<div class="modal-content">
				  <div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">&times;</button>
					<h4 class="modal-title">Upload</h4>
				  </div>
				  <div class="modal-body">
					<?php
					$attribute = array('role' => 'form', 'class' => 'form-horizontal','enctype'=>'multipart/form-data');
					echo form_open(base_url().'admin/infosewa/save', $attribute); 
					?>		
					<br />
					<input type="hidden" id="idlist1" name="idlist" />
					  <div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1">Nama</label>
						<div class="col-sm-10">
						  <input type="text" name="namalist" id="namalist1"   placeholder="deskripsi"  class="form-control" required />
						</div>
					  </div>			
					  <div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1">Deskripsi</label>
						<div class="col-sm-10">
						<textarea   name="deskripsi" class="ckeditor"  id="deskripsi1"  required><?php echo $tes;?></textarea>
						</div>
					  </div>	
					  <div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1">Status</label>
						<div class="col-sm-10">
							  <label class="radio-inline"><input type="radio" name="status" id="status1" value="1">Ya</label>
							  <label class="radio-inline"><input type="radio" name="status" id="status1" value="0">Tidak</label>						 
						</div>
					  </div>		
					  <div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1">Tampil Depan</label>
						<div class="col-sm-10">
							  <label class="radio-inline"><input type="radio" name="depan" id="depan1" value="1">Ya</label>
							  <label class="radio-inline"><input type="radio" name="depan" id="depan1" value="0">Tidak</label>						 
						</div>
					  </div>					  
					  <div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1">
						</label>
						<div class="col-sm-10">
						<button type="submit" class="btn btn-primary btn-sm btn-block" name="simpan" value="simpan"  tabindex="1">simpan</button>													
						</div>
					  </div>
					 <?php
					echo form_close();?>
				  </div>
				  <div class="modal-footer">
					<button type="button" class="btn btn-default btn-sm "  data-dismiss="modal">Close</button>
				  </div>
				</div>
			  </div>
			</div>

		<script src="<?php echo base_url();?>assets_v2/ckeditor/ckeditor.js"></script>					
			<?php include("layout/footer.php");?>
			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->
		<!-- basic scripts -->
			<?php include("layout/sc_footer.php");?>
	</body>
</html>