<?php
session_start();
include("../../php_crud/my_class.php");
$obj = new my_class();
extract($_GET);
$table_name="HYDROLOGY.UPAZILA_TBL@HYDRO10";
$cols="UPZL_CODE";
$where_cond="DST_CODE='$sel_district_id'";
$upazila_list = "";
// SELECT UPZL_CODE FROM UPAZILA_TBL WHERE DST_CODE='75'
foreach($obj->View_colmn_By_Cond($table_name,$cols,$where_cond) as $upazila_id){
    $upazila_list .=  "'".$upazila_id['UPZL_CODE']."',";
}
$upazila_list = substr($upazila_list,0,-1);
?>
<select name="gwt_daily_comp_old_id" id="gwt_daily_comp_old_id" class="chosen-select" onchange="load_daily_new_id_by_old_id(this.value)">					
    <?php
    $table_name="HYDROLOGY.GWM_TBL@HYDRO10";
    $cols="WELL_ID,OLD_ID ";
    $where_cond="UPAZILA_CODE IN ($upazila_list) AND ','||WELL_DATA_TYPE||','LIKE'%,'||'1'||',%' ORDER BY WELL_ID ASC";
    //SELECT WELL_ID,OLD_ID FROM GWM_TBL WHERE UPAZILA_CODE IN ('4745','4751')
     foreach($obj->View_colmn_By_Cond($table_name,$cols,$where_cond)as $old_id){
		echo' <option value="Select Old ID"></option>';
        echo '<option value="'.$old_id['WELL_ID'].'">'.$old_id['OLD_ID'].'</option>';
     }
    ?>
</select>

<script>
    $('.chosen-select').chosen({allow_single_deselect: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': '100%'});
		})
	}).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':'100%'});
		})
	});
</script>