<div class="clearfix">
<div class="row">
  <div class="col-lg-12">
	
	<div class="navbar navbar-inverse">
		<div class="container">
			<div class="navbar-header">
				<a class="navbar-brand" href="#">Data Surat Masuk</a>
			</div>
		<div class="navbar-collapse collapse navbar-inverse-collapse" style="margin-right: -20px">
			<?php 
			if ($this->session->userdata('admin_level') == 1) {
			?>
			<ul class="nav navbar-nav">
				<li><a href="<?php echo base_URL(); ?>masuk/surat_masuk/add" class="btn-info"><i class="icon-plus-sign icon-white"> </i> Tambah Data</a></li>
			</ul>
			
			<?php 
			} else {
				echo "";
			}
			?>
			<ul class="nav navbar-nav navbar-right">
				<form class="navbar-form navbar-left" method="post" action="<?php echo base_URL(); ?>perkara/list_data/cari">
					<input type="text" class="form-control" name="q" style="width: 200px" placeholder="Kata kunci pencarian ..." required>
					<button type="submit" class="btn btn-danger"><i class="icon-search icon-white"> </i> Cari</button>
				</form>
			</ul>
		</div><!-- /.nav-collapse -->
		</div><!-- /.container -->
	</div><!-- /.navbar -->

  </div>
</div>

<?php echo $this->session->flashdata("k");?>


<table class="table table-bordered table-hover">
	<thead>
		<tr>
			<th width="10%">No. Reg./Kode</th>
			<th width="30%">Asal Surat</th>
			<th width="25%">Isi Ringkas, File</th>
			<th width="13%">Nomor, Tgl. Surat</th>
			<th width="25%">Aksi</th>
		</tr>
	</thead>
	
	<tbody>
		<?php 
		if (empty($data)) {
			echo "<tr><td colspan='5'  style='text-align: center; font-weight: bold'>--Data tidak ditemukan--</td></tr>";
		} else {
			$no 	= ($this->uri->segment(4) + 1);
			foreach ($data as $b) {
		?>
		<tr>
			<td><?php echo $b->nomor_perkara;?></td>
			<td><?php echo $b->nomor_urut_register."</br><font color =red>[Index : ".$b->nomor_indeks. "]</font>"; ?></td>
			<td><?php echo $b->nomor_surat."<br><b>File : </b><i><a href='".base_URL()."upload/surat_masuk/".$b->petitum_dok."' target='_blank'>".$b->petitum_dok."</a>"?></td>
			<td><?php echo $b->pihak1_text."<br><i>".tgl_jam_sql($b->tanggal_pendaftaran)."</i>"?></td>
			<td class="ctr">
				<?php  
				if ( $this->session->userdata('admin_level') == 1) {
				?>
				<div class="btn-group">
					<a href="<?php echo base_URL()?>index.php/masuk/surat_masuk/edt/<?php echo $b->perkara_id?>" class="btn btn-success btn-sm" title="Edit Data"><i class="icon-edit icon-white"> </i> Edt</a>
					<a href="<?php echo base_URL()?>disposisi/surat_disposisi/<?php echo $b->perkara_id?>" class="btn btn-default btn-sm"  title="Disposisi Surat Masuk"><i class="icon-trash icon-list"> </i> Disp</a>
					<a href="<?php echo base_URL()?>index.php/masuk/disposisi_cetak/<?php echo $b->perkara_id?>" class="btn btn-warning btn-sm" target="_blank" title="Cetak Disposisi"><i class="icon-print icon-white"> </i> Ctk</a>
					<a href="<?php echo base_URL()?>index.php/masuk/surat_masuk/del/<?php echo $b->perkara_id?>" class="btn btn-danger btn-sm" title="Hapus Data" onclick="return confirm('Anda Yakin..?')"><i class="icon-trash icon-remove">  </i> Del</a>			
					
				</div>	
				<?php  
				}elseif ( $this->session->userdata('admin_level') == "Tamu") {
					echo "-";
				?>
				
				
				<?php  
				}elseif ( $this->session->userdata('admin_level') == "Staf") {
				?>
				<div class="btn-group">
					<a href="<?php echo base_URL()?>index.php/masuk/surat_masuk/edt/<?php echo $b->perkara_id?>" class="btn btn-success btn-sm" title="Edit Data"><i class="icon-edit icon-white"> </i> Edit</a>
					<a href="<?php echo base_URL()?>disposisi/surat_disposisi/<?php echo $b->perkara_id?>" class="btn btn-default btn-sm"  title="Disposisi Surat Masuk"><i class="icon-trash icon-list"> </i> Disp</a>
					<a href="<?php echo base_URL()?>index.php/masuk/disposisi_cetak/<?php echo $b->perkara_id?>" class="btn btn-warning btn-sm" target="_blank" title="Cetak Disposisi"><i class="icon-print icon-white"> </i> Ctk</a>
			
					
				</div>	
				<?php  
				}elseif ($this->session->userdata('admin_level') == "Pimpinan") {
				?>
				<div class="btn-group">
					<a href="<?php echo base_URL()?>disposisi/surat_disposisi/<?php echo $b->perkara_id?>" class="btn btn-info btn-sm"  title="Disposisi Surat Masuk"><i class="icon-trash icon-list"> </i> Disposisi</a>
					
				</div>	
				<?php 
				} else {
				?>
				<div class="btn-group">
					<a href="<?php echo base_URL()?>index.php/masuk/disposisi_cetak/<?php echo $b->perkara_id?>" class="btn btn-info btn-sm" target="_blank" title="Cetak Disposisi"><i class="icon-print icon-white"> </i> Ctk</a>
				</div>	
				<?php 
				}
				?>
				
			</td>
		</tr>
		<?php 
			$no++;
			}
		}
		?>
	</tbody>
</table>
<center><ul class="pagination"><?php echo $pagi; ?></ul></center>
</div>
