<?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="dist_tbl" class="table table-striped table-bordered table-hover">
		<thead>
			<tr>
				<td style="text-align: center;font-size:13px;" class="table-header">Sl</td>
				<td style="text-align: center;font-size:13px;" class="table-header">Division</td>
				<td style="text-align: center;font-size:13px;" class="table-header">Sub Division</td>
				
				<td style="text-align: center;font-size:13px;" class="table-header">District Code</td>
				<td style="text-align: center;font-size:13px;" class="table-header">District Name</td>
				<td style="text-align: center;font-size:13px;" class="table-header">Status</td>
				
				<td style="text-align: center;font-size:13px;" class="table-header">Action</td>
			</tr>
		</thead>
		<tbody>
			<?php
			$sl=0;
		
			foreach($obj->View_All_By_Cond("AQUATIC.TBLGWH_DISTRICTINFO@AQUATIC227","FLAG IN ('A','I') ORDER BY DISTRICTNAME") as $value){
				$sl++;
				$sel_div_id = $value['DIVISIONCODE'];
				$sel_sub_div_id = $value['SUBDIVISIONCODE'];
				$division_info = $obj->Details_By_Cond("AQUATIC.TBLGWH_DIVISIONINFO@AQUATIC227","ID='$sel_div_id'");
				$sub_division_info = $obj->Details_By_Cond("AQUATIC.TBLGWH_SUBDIVISIONINFO@AQUATIC227","ID='$sel_sub_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>".$sub_division_info['SUBDIVISIONNAME']."</td>";
					echo "<td>".$value['DISTRICTCODE']."</td>";
					echo "<td>".$value['DISTRICTNAME']."</td>";
					
					echo "<td style='text-align: center;'>$status</td>";
				
					echo '<td style="text-align:right;">';
					// if($_SESSION['edit']=='Y'){
						echo '&nbsp;<a class="label label-success" href="#district_edit_modal" data-toggle="modal" onclick="load_district_edit_form('.$value['ID'].')"><i class="icon-edit"></i> Edit </a>';	
					// }
					// if($_SESSION['delete']=='Y'){
						echo '&nbsp;<a class="label label-inverse" onclick="delete_district('.$value['ID'].')" ><i class="icon-trash"></i> Delete</a>';
					// }
					echo '</td>';
				echo "</tr>";
			}
			?>
		</tbody>
	</table>
</div>
<script type="text/javascript">
	var oTable2 = $('#dist_tbl').dataTable( {
	"aoColumns": [
	  { "bSortable": true },
	  null,null,null, null,null,
	  { "bSortable": true }
	],
	  "iDisplayLength": 50
	  });
</script>