<?php
	/* require '../db.php'; */ 
	include("../../php_crud/my_class.php");
	$obj = new my_class();
	session_start();
	
?>

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/css/all.css" rel="stylesheet" media="all" type="text/css" />

<table id="device_tbl" class="table table-striped table-bordered table-hover">
    <thead>
        <tr style="font-family: 'Open Sans';">
            <td class="table-header" style ="font-size:13px;width:3%!important;text-align:center;">Sl</td>
            <td class="table-header" style ="font-size:13px;width:33%!important;text-align:center;">Zone</td>
			<td class="table-header" style ="font-size:13px;width:30%!important;text-align:center; ">Status</td>
            <td class="table-header" style ="font-size:13px;width:34%!important;text-align:center;">Action</td>
        </tr>
    </thead>
    <tbody>
     <?php
    $table_name =  "AQUATIC.TBLGWH_ZONEINFO@AQUATIC227";
	$where_cond = " FLAG='A' OR FLAG='I' ORDER BY  ID ASC";
	
	// $row=$obj->View_all_data_row_column_By_Cond_aquatic("aquatic.$table_name",' * ',$where_cond);
	$row=$obj->View_all_data_row_column_By_Cond($table_name,' * ',$where_cond);
	$i = 1;
	foreach($row AS $index=>$val)
    {
		//print_r($val);
        echo "<tr>";  
            $id=$val['ID'];
            ?>              
            <td style="text-align:center"><?php echo $i;?></td>
            <td><?php echo $val['ZONENAME'];?></td>
            <td style="text-align:center"><?php if($val['FLAG']=='A') echo "<label class='label label-success'><i class='fa fa-check-circle'></i> Active</label>"; else echo "<label class='label label-danger' style=' background-color: #d15b47 !important'><i class='fa fa-times-circle'></i> Inactive</label>";?></td>
            <td style="text-align: right;">
				<?Php
					// if($_SESSION['edit']=='Y'){
						echo '<label class="label label-success" style="hover:cursor;" href="#modal_edit_zone" data-toggle="modal" onclick="load_edit_form('.$id.')"><i class="far fa-edit"></i> Edit </label>';
					// }
					// if($_SESSION['delete']=='Y'){
						echo '<label class="label label-danger" style="margin-left: 10px; background-color: #d15b47 !important" onclick="delete_zone('.$id.')"><i class="fas fa-trash-alt"></i> Delete </label>';
					// }
				?>
            </td>
            <?php           
        echo " </tr>";
		$i++;
    }
	?>
    </tbody>
</table>
<script type="text/javascript">			
	var oTable2 = $('#device_tbl').dataTable( {
	"aoColumns": [
	  { "bSortable": true },
	  null, null,
	  { "bSortable": true }
	],
		"iDisplayLength": 50 } );
</script>