<?php
	include("../../php_crud/my_class.php");
	$obj = new my_class();
	extract($_REQUEST);
	
	$well = $_REQUEST['well_id'];
	$rl_id = $_REQUEST['rl_id'];
	// $last_rec_date = $_REQUEST['last_rec_date'];
	//echo $well;
	$mon_yr = strtoupper(date('d-M-y', strtotime($last_rec_date)));

	// $mon_yr = date('m-Y', strtotime($last_rec_date));
	$row=$obj->load_auto_graph_from_raw($well,$mon_yr);
	// print_r($row);
?>

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

<div class="table-header">
	<i class="fa fa-list"></i> Ground Water Hydrology Water Level Record of Last 30 Days of Well: <?php echo $well;?></span>
</div>
<table id="ground_water_graph_tbl" class="table table-striped table-bordered table-hover">
    <thead> 
        <tr style="font-family: 'Open Sans';">
            <td style="text-align:center; font-size:13px;" class="table-header">Sl</td>
            <td style="text-align:center; font-size:13px;" class="table-header">Date</td>
            <td style="text-align:center; font-size:13px;" class="table-header">RL</td>
            <td style="text-align:center; font-size:13px;" class="table-header">Water Label for Measuring Point</td>
            <td style="text-align:center; font-size:13px;" class="table-header">Water Level (m)</td>
        </tr>
    </thead>
    <tbody>
		<?php 
		$sl = 0;
		foreach($row as $val){ 
			$sl++;
			$rl_value = !empty($rl_id) ? $rl_id : 0;
		?>
		<tr>
			<td><?php echo $sl; ?></td>
			<td style="text-align:center;"><?php echo $val['DATETIME'];?></td>
			<td style="text-align:center;"><?php echo $rl_value;?></td>
			<td style="text-align:center;"><?php echo number_format($val['VALUE'],3); ?></td>
			<td style="text-align:center;"><?php echo number_format(abs($rl_value - $val['VALUE']), 3); ?></td>

		</tr>

		<?php }
		?>
    </tbody>
</table>
<script type="text/javascript">			
$(document).ready(function() {
    $('#ground_water_graph_tbl').DataTable({
        "paging": true,
        "searching": true,
        "ordering": true,
        "info": true,
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
        "columnDefs": [
            { "orderable": false, "targets": [3, 4] } // যেগুলো sortable না করা লাগবে
        ]
    });
});

</script>

