<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
$obj = new my_class();
// ============
$branchid = $_SESSION['LOGIN_BRANCH'];
?>
<style>
	.left_th {
		text-align: right;
		width: 20%;
		padding-bottom: 10px;
		padding-left: 2px;
	}

	.left_select_th {
		text-align: right;
		width: 20%;
		padding-bottom: 5px;
		padding-left: 2px;
	}

	.right_th {
		text-align: right;
		width: 15%;
		padding-bottom: 10px;
		padding-left: 2px;
	}

	.right_select_th {
		text-align: right;
		width: 10%;
		padding-bottom: 5px;
		padding-left: 2px;
	}
</style>
<div class="row-fluid">
	<table border="0" style="width: 100%; border-collapse: collapse;">
		<tr>
			<th class="left_th">Well Id: <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="well_id" onkeyup="call_next_val_loader(event,'well_id','latitude')" />
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Well Data Type: <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				
				
				<select id="well_data_type" name="well_data_type" class="chosen-select" style="width: 100%;" >
					<option value="">---SELECT---</option>
				<?php
				$tbl = "HYDROLOGY.GWM_STATION_TYPE@HYDRO10";
				$col = "*";
				$cond = "ID IN ('4', '5')";

					foreach($obj->View_colmn_By_Cond($tbl,$col,$cond) as $value){
							echo "<option value='".$value['ID']."'>".$value['TYPE_NAME']."</option>";

					}
				?>
				</select>
			
			</td>

		</tr>
		<!-- <tr>
		<th class="left_th">Depth: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="depth" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'depth','unit')" />
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Tubewell No: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="tube_well_no" onkeyup="call_next_val_loader(event,'tube_well_no','upzila')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr> -->
		<tr>
		<th class="right_select_th">Sub-Division: <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<select id="sub_div" name="sub_div" class="chosen-select" style="width: 100%;" >
                    <option value="">---SELECT---</option>
                    <?php
                    $table_name = 'HYDROLOGY.GW_SUBDIVCODE_TBL@HYDRO10';
                    $columns = 'HYDSUBDIVCODE,SUBDIVISION_NAME';
                    $where_cond = '1=1 ORDER BY SUBDIVISION_NAME ASC';

                    foreach($obj->View_colmn_By_Cond($table_name,$columns,$where_cond) as $subdiv_list){
                        echo '<option value="'.$subdiv_list['HYDSUBDIVCODE'].'"> '.$subdiv_list['SUBDIVISION_NAME'].' ('.$subdiv_list['HYDSUBDIVCODE'].')</option>';
                        
                    }
                    ?>
                </select>
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="left_select_th">Upazila (District): <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<select id="upzila" name="upzila" class="chosen-select" style="width: 100%;" >
					<option value="">---SELECT---</option>
					<?php 
					$tbl = "HYDROLOGY.UPAZILA_TBL@HYDRO10 UPZ LEFT JOIN HYDROLOGY.DISTRICT_TBL@HYDRO10 DIST ON UPZ.DST_CODE=DIST.DISTRICT_NO";
					$col = "UPZ.UPZL_CODE,UPZ.UPZL_NAME,DIST.DISTRICT_NAME";
					$cond = "1=1 ORDER BY UPZ.UPZL_NAME ASC";

						foreach($obj->View_colmn_By_Cond($tbl,$col,$cond) as $value){
								echo "<option value='".$value['UPZL_CODE']."'>".$value['UPZL_NAME']." (".$value['DISTRICT_NAME'].")</option>";
		
						}
					?>
				</select>
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
			<th class="left_th">Start Date Time: <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<!-- <input type="text" style="width: 93%;" id="start_date" 
				onkeyup="call_next_val_loader(event,'start_date','pump_type')"/> -->
				<div class="controls">
					<div class="row-fluid input-prepend">
						<span class="add-on">
							<i class="icon-calendar"></i>
						</span>
						<input id="start_date" name="start_date"  class="date-picker" type="text" data-date-format="dd-mm-yyyy" placeholder="dd-mm-yyyy" style="width: 84%;" />
						<!-- <input type="datetime-local" id="start_date" name="start_date" data-date-format="dd-mm-yyyy HH:ii"> -->
					</div>
				</div>
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="left_th">End Date Time: <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<!-- <input type="text" style="width: 93%;" id="end_date" onkeyup="call_next_val_loader(event,'end_date','well_dia')" /> -->
				<div class="controls">
					<div class="row-fluid input-prepend">
						<span class="add-on">
							<i class="icon-calendar"></i>
						</span>
						
						<input id="end_date" name="end_date"   class="date-picker" type="text" data-date-format="dd-mm-yyyy" placeholder="dd-mm-yyyy" style="width: 84%;" />
						<!-- <input type="datetime-local" id="end_date" name="end_date" data-date-format="dd-mm-yyyy HH:ii">
						 -->
					</div>
				</div>
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
			<th class="left_th">Latitude: <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="latitude" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'latitude','longitude')" />
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="left_th">Longitude: <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="longitude" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'longitude','total_drilling_depth')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
			
		<th class="left_th">Total Drilling Depth (m): <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="total_drilling_depth" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'total_drilling_depth','grnd_elev')" />
			</td>
			
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="left_th">Ground Elevation:</th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" onkeypress="return isNumericInput(event)" id="grnd_elev" onkeyup="call_next_val_loader(event,'grnd_elev','purpose')" />
			</td>

			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>

		<th class="left_th">Purpose: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="purpose" onkeyup="call_next_val_loader(event,'purpose','jl_no')" />
			</td>
			
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">RL: </th>
			<td style="width: 28%;">
				<input onkeypress="return isNumericInput(event)" type="text" style="width: 93%;" id="rl" onkeyup="call_next_val_loader(event,'rl','housing_length')" />
			</td>

			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
		<th class="left_select_th">JL No: </th>
			<td style="width: 28%;">
				<input onkeypress="return isNumericInput(event)" type="text" style="width: 93%;" id="jl_no" onkeyup="call_next_val_loader(event,'jl_no','plot_no')" />
			</td>
			<td style="width: 4%; ">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Housing Length: </th>
			<td style="width: 28%;">
				<input onkeypress="return isNumericInput(event)" type="text" style="width: 93%;" id="housing_length" onkeyup="call_next_val_loader(event,'housing_length','housing_dia')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
		<th class="left_th"> Plot No: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="plot_no" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'plot_no','mouza')" />
			</td>
			
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Housing Dia: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="housing_dia" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'housing_dia','observe_well')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
		<th class="left_th">Mouza: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="mouza" onkeyup="call_next_val_loader(event,'mouza','village')" />
			</td>
			
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="left_th">Number of Obs. Well: <font color="#FF0000">*</font></th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" onkeypress="return isNumericInput(event)" id="observe_well" onkeyup="call_next_val_loader(event,'observe_well','strainer_from_to')" />
			</td>
			
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
		<th class="left_th">Village: </th>
			<td style="width: 28%;">
				<input  type="text" style="width: 93%;" id="village" onkeyup="call_next_val_loader(event,'village','pre_reg_no')" />
			</td>
			
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th"> Strainer From to: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="strainer_from_to" onkeyup="call_next_val_loader(event,'strainer_from_to','strainer_dia')" />
			</td>
			
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>

		<tr>
		<th class="left_th">Pre Reg. No: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="pre_reg_no" onkeyup="call_next_val_loader(event,'pre_reg_no','site')" />
			</td>
		
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Strainer Dia: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="strainer_dia" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'strainer_dia','strainer_lnth')" />
			</td>
			
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
		<th class="left_th">Location: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="site" onkeyup="call_next_val_loader(event,'site','hole_no')" />
			</td>
			
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Strainer Length:</th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="strainer_lnth" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'strainer_lnth','blindpipe_length')" />
			</td>
	
			
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>

		<tr>
		<th class="right_th">Hole Id: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="hole_no"  onkeyup="call_next_val_loader(event,'hole_no','sampling')" />
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Blindpipe Length: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="blindpipe_length" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'blindpipe_length','blindpipe_dia')" />
			</td>
			
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
			<th class="left_th">Method Of Sampling: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="sampling" onkeyup="call_next_val_loader(event,'sampling','geologist')" />
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Blindpipe Dia: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="blindpipe_dia" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'blindpipe_dia','bailplug_length')" />
			</td>
			
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
			<th class="left_th">Geologist: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="geologist" onkeyup="call_next_val_loader(event,'geologist','note')" />
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			
			<th class="right_th">Bailplug Length: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;"  onkeypress="return isNumericInput(event)" id="bailplug_length" onkeyup="call_next_val_loader(event,'bailplug_length','pump_type')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<!-- <tr>
			<th class="left_th">Total Drilling Depth: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="total_drilling_depth" onkeyup="call_next_val_loader(event,'total_drilling_depth','reducer_length')" />
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Reducer Length: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="reducer_length" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'reducer_length','note')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr> -->
		
		<tr>
		<th class="right_th">Remark: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="note" onkeyup="call_next_val_loader(event,'note','rl')" />
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Pump Type: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="pump_type" onkeyup="call_next_val_loader(event,'pump_type','reducer_length')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>

		<tr>
		<th class="right_th"> </th>
			<td style="width: 28%;">
				
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Reducer Length: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="reducer_length" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'reducer_length','well_dia')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>
		<tr>
		<th class="right_th"> </th>
			<td style="width: 28%;">
				
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Well Dia: </th>
			<td style="width: 28%;">
				<input type="text" style="width: 93%;" id="well_dia" onkeypress="return isNumericInput(event)" onkeyup="call_next_val_loader(event,'well_dia','unit')" />
			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>

		<tr>
		<th class="right_th"> </th>
			<td style="width: 28%;">
				
			</td>
			<td style="width: 4%;">&nbsp;&nbsp;&nbsp;</td>
			<th class="right_th">Unit: </th>
			<td style="width: 28%;">
				<!-- <input type="text" style="width: 93%;" id="unit" onkeyup="call_next_val_loader(event,'unit','well_id')" /> -->
				<select id="unit" name="unit" class="chosen-select" style="width: 100%;" >
					<option value="">---SELECT---</option>
					<option value="Feet">Feet</option>
					<option value="Meter">Meter</option>
					<option value="Inch">Inch</option>
					
				</select>


			</td>
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr>

	
		
		<!-- <tr>
			
		
			<td style="width: 10%;">&nbsp;&nbsp;&nbsp;</td>
		</tr> -->


	</table>
</div>

<script>
	$('.chosen-select').chosen({
		allow_single_deselect: true,
		search_contains: true
	});
	//resize the chosen on window resize

	$(window)
		.off('resize.chosen')
		.on('resize.chosen', function() {
			$('.chosen-select').each(function() {
				var $this = $(this);
				$this.next().css({
					'width': '98%'
				});
			})
		}).trigger('resize.chosen');
	//resize chosen on sidebar collapse/expand
	$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
		if (event_name != 'sidebar_collapsed') return;
		$('.chosen-select').each(function() {
			var $this = $(this);
			$this.next().css({
				'width': '98%'
			});
		})
	});
</script>


<!-- Alphanumeric Checking -->
<script>
	let inputReset = false; // Track whether input should be reset

	function isNumericInput(event) {
		const key = event.keyCode || event.which;
		const keyChar = String.fromCharCode(key);

		const regex = /[0-9]|\.|\-/; // Alphanumeric pattern

		// Only allow alphanumeric input
		if (!regex.test(keyChar)) {
			event.preventDefault();
			return false;
		}

		const input = event.target;
		const currentValue = input.value;

		if (inputReset) {
			input.value = "";
			inputReset = false;
		}

		return true;
	}
</script>
<!-- Alphanumeric Checking -->


<!--Enter Checking start-->
<script>
	function call_next_val_loader(e, sel_col_id, next_col_id) {
		if (event.keyCode == 13 || event.keyCode == 'tab') {
			$("#" + next_col_id).select();
		}
	}
</script>
<!--Enter Checking end -->
<!--date picker start-->
<script type="text/javascript">
	$('.date-picker').datepicker().next().on(ace.click_event, function() {
		$(this).prev().focus();

	});
	$(".date-picker").attr("autocomplete", "off");
</script>
<!--date picker end-->
