<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
$obj=new my_class();
// ============
//$branchid = $_SESSION['LOGIN_BRANCH'];

?>
<style>
	.label-inverse {
		background-color:#D15B47!important;
}
</style>
<div class="row-fluid">
	
	<table id="sub_div_tbl" class="table table-striped table-bordered table-hover">
		<thead>
			<tr>
				<th style="text-align: center;">Sl</th>
				<th style="text-align: center;">Division Code</th>
				<th style="text-align: center;">Sub Division Name</th>
				
				<th style="text-align: center;">Responsible Person</th>
				<th style="text-align: center;">Contact No</th>
				<th style="text-align: center;">Observer Name</th>
				
				<th style="text-align: center;">Observer Contact</th>
				<th style="text-align: center;">Status</th>
				<th style="text-align: center;">Action</th>
			</tr>
		</thead>
		<tbody>
			<?php
			$sl=0;
		
			foreach($obj->View_All_By_Cond("AQUATIC.TBLGWH_SUBDIVISIONINFO@AQUATIC227","FLAG IN ('A','I') ORDER BY SUBDIVISIONNAME") as $value){
				$sl++;
				$sel_div_id = $value['DIVISIONCODE'];
				$division_info = $obj->Details_By_Cond("AQUATIC.TBLGWH_DIVISIONINFO@AQUATIC227","ID='$sel_div_id'");
				if($value['FLAG']=='A'){
					$status="<span class='label label-success'>Active</span>";
				} else if($value['FLAG']=='I'){
					$status="<span class='label label-warning'>Inactive</span>";
				}
				echo "<tr>";
					echo "<td style='text-align: center;'>".$sl."</td>";
					echo "<td>".$division_info['DIVISIONNAME']."</td>";
					echo "<td>".$value['SUBDIVISIONNAME']."</td>";
					echo "<td>".$value['RESPONSIBLEPERSON']."</td>";
				//	echo "<td>".$value['DESIGNATION']."</td>";
					echo "<td style='text-align: center;'>".$value['CONTACTNO']."</td>";
				//	echo "<td>".$value['ADDRESS']."</td>";
					echo "<td>".$value['OBSERVERNAME']."</td>";
					echo "<td style='text-align: center;'>".$value['OBSERVERCONTACT']."</td>";
				//	echo "<td>".$value['OBSERVERADDRESS']."</td>";
					echo "<td style='text-align: center;'>$status</td>";
				
					echo '<td style="text-align: right;" >';
					echo '<a class="label label-success" href="#sub_division_show_modal" data-toggle="modal" onclick="load_sub_div_det('.$value['ID'].')"><i class="fa fa-eye"></i> View</a>';
					// if($_SESSION['edit']=='Y'){
					// 	echo '&nbsp;<a class="label label-warning" href="#sub_division_edit_modal" data-toggle="modal" onclick="load_sub_div_edit_form('.$value['ID'].')"><i class="icon-edit"></i> Edit </a>';	
					// }
					// if($_SESSION['delete']=='Y'){
						echo '&nbsp;<a class="label label-inverse" onclick="delete_sub_division('.$value['ID'].')" ><i class="icon-trash"></i> Delete</a>';
					// }
					echo '</td>';
				echo "</tr>";
			}
			?>
		</tbody>
	</table>
</div>
<script type="text/javascript">
	var oTable2 = $('#sub_div_tbl').dataTable( {
	"aoColumns": [
	  { "bSortable": true },
	  null,null,null, null,null,null,null,
	  { "bSortable": true }
	],
	  "iDisplayLength": 50
	  });
</script>