<hr class="thick-line" style="clear:both;">
<div id="left">
	<?php
	echo form_open(base_url().$page_url.'/search');
	$attributes = array('name' => 'search', 'id' => 'search-box', 'type' => 'text','size' => '50','placeholder'=>"  Ketik kata kunci  ");
	echo form_input($attributes);
	echo "<span>  </span>";
	$attributes = array('value' => 'Search', 'id' => 'search-btn1','class' => 'btn', 'type' => 'submit', 'onClick' => 'load()');
	echo form_submit($attributes);
	echo form_close('');
	?>
</div>
		<div id="left" style="margin-left:50px;">
			<input type="submit" value="Tambah Data" class="btn" onclick="popup_form('<?php echo base_url('manage_testing_dev/add');?>')">
		</div>
<div id="pages">
    <div id="selector"></div>
</div>
<div class="cssTable">
	<table id="tablePerkaraAll">
		<col  width="3%" />
        <col  width="10%" />
        <col  width="10%" />
        <col  width="30%" />
        <col  width="22%" />
        <col  width="10%" />
        <col  width="10%" />
        <col  width="10%" />
        <?php
				if($this->session->userdata('userid')<10){
				?>
        <col  width="5%" />
        <?php
				}
				?>
		<tbody>
			<tr>
				<td>No</td>
				<td onclick="sorting(1)">Tanggal</td>
				<td onclick="sorting(2)">Jenis Error</td>
				<td onclick="sorting(3)">Deskripsi Error</td>
				<td onclick="sorting(4)">Respond Message</td>
				<td onclick="sorting(5)">Dicoba Oleh</td>
				<td onclick="sorting(5)">Status</td>
				<td onclick="sorting(6)">Handled By</td>
				<?php
				if($this->session->userdata('userid')<10){
				?>
					<td>Link</td>
				<?php
				}
				?>
			</tr>
			<?php
				if($bugs_list!=''){
					if($bugs_list->num_rows>0){
						if($page_active<1){
							$con = 1;
						}else{
							$con = $page_active+1;
						}
						$modelClass =& get_instance();
						
						# set history URL REQUESTED, this will be used to back on previous page.
						# 
						$this->nativesession->set_flash_session('history', current_url());
		    			foreach ($bugs_list->result() as $row) {
		    				if($row->error_type==1){
			    					$errName='Aplikasi';
			    				}elseif ($row->error_type==2) {
			    					$errName='Bisnis Proses';
			    				}elseif ($row->error_type==3) {
			    					$errName='Template';
			    				}

			    				if($row->status==1){
			    					$status = 'Reported';
			    				}elseif($row->status==2){
			    					$status = 'Readed';
			    				}elseif($row->status==3){
			    					$status = 'On Progress';
			    				}elseif($row->status==4){
			    					$status = 'Done';
			    				}elseif($row->status==5){
			    					$status = 'Rejected';
			    				}else{
			    					$status = 'Reported';
			    				}
		    				echo "<tr bgcolor='#FF0000'>";
			    				echo '<td align="center">'.$con.'</td>';
			    				echo '<td align="center">'.$this->templatehelper->convertKeTglIndo($row->date).'</td>';
			    				
			    				echo '<td>'.$errName.'</td>';
			    				echo '<td>'.$row->error_msg.'</td>';
			    				echo '<td>'.$row->respond_msg.'</td>';
			    				echo '<td align="center">'.$row->try_by.'</td>';
			    				echo '<td align="center">'.$status.'</td>';
			    				echo '<td align="center">'.$row->handling_by.'</td>';
			    				if($this->session->userdata('userid')<10){
			    					echo '<td style="cursor:pointer;" align="center" onclick="popup_form(\'manage_testing_dev/update/'.base64_encode($modelClass->encrypt->encode($row->id)).'\')">[<a href="#">edit</a>]</td>';
		    					}
		    				echo "</tr>";
		    				$con++;
		    			}
			    	}else{
		    			echo "<tr><td colspan='8' align='center'>Data Tidak diTemukan</td></tr>";
		    		}
				}else{
					if($this->session->userdata('userid')<10){
		    			echo "<tr><td colspan='8' align='center'>Data Tidak diTemukan</td></tr>";
		    		}else{
		    			echo "<tr><td colspan='7' align='center'>Data Tidak diTemukan</td></tr>";
		    		}
		    	}
			?>
		</tbody>
	</table>
</div>
<div id="pages_bottom" style="width:100%;padding-left:5px;padding-top:5px;">
    <div id="selector_bottom"></div>
</div>
<div id="popup_hakim" class="popup">
	
</div>
<?php
$url = base_url().$page_url.'/sort/';
$keyword = (!empty($keyword))?'/'.$keyword : '';
?>
<script type="text/javascript">
	function sorting(col){
		window.open('<?php echo $url;?>'+col+'/<?php echo $enc; ?><?php echo $keyword; ?>','_self')
	}

</script>
