<?php
session_start();
extract($_REQUEST);
include ("../../php_crud/my_class.php");
$obj = new my_class();

$current_mon_f_date = date("01-m-Y");
$current_mon_l_date = date("t-m-Y");
?>

<style>
    canvas {
        height: 300px !important;
    }

</style>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script src="module/ground_water_ex/js/station_availability.js" type="text/javascript"></script>
<style type="text/css">

</style>
<div class="table-header">
    <i class="fa fa-desktop"></i>Station Availability Search Form<span id="go_back_button"
        style="display:none;float:right;margin-right: 10px;">
        <button type="button" class="btn btn-yellow btn-small" onclick="go_back()"> <i class="fa fa-backward"></i> Go
            Back To List</button></span>
</div>
<div class="row-fluid"
    style="padding-bottom: 10px; background-color:#f5f5f5;-webkit-box-shadow: 0 8px 6px -6px black; -moz-box-shadow: 0 8px 6px -6px black; box-shadow: 0 8px 6px -6px black;">
    <div class="widget-body" style="border: none;  background-color: #f5f5f5;">
        <div class="widget-main padding-5">
            <div class="tab-content" style="overflow: visible; position: sticky; z-index: 999;">

                <!--Division wise-->
                <div class="span12">
                    <div class="span7">
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label" for="river"><b>Division Wise<font color="#FF0000"></font>
                                    </b></label>
                                <div class="controls" style="width: 100%">
                                    <select id="division" name="sub_div" style="height: 12px !important;"
                                        class="chosen-select" onchange="handleDivisionChange()">
                                        <option value="" selected="selected"></option>

                                        <?php
                                        $table_name = 'HYDROLOGY.DIVCODE_TBL@HYDRO10';
                                        $columns = 'HYDDIVCODE,DIVISION_NAME';
                                        $where_cond = "HYDDIVCODE LIKE 'GW%' ORDER BY DIVISION_NAME ASC";

                                        foreach ($obj->View_colmn_By_Cond($table_name, $columns, $where_cond) as $subdiv_list) {
                                            echo '<option value="' . $subdiv_list['HYDDIVCODE'] . '"> ' . $subdiv_list['HYDDIVCODE'] . ' (' . $subdiv_list['DIVISION_NAME'] . ')</option>';
                                        }
                                        ?>
                                        <option value="all">All</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--Division wise-->

                        <!--Sub-Division-->
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label" for="river"><b>Sub-Division Wise<font color="#FF0000">
                                        </font>
                                    </b></label>
                                <div class="controls" style="width: 100%">
                                    <select id="sub_div" name="sub_div" style="height: 12px !important;"
                                        class="chosen-select">
                                        <option value="" selected="selected"></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['HYDSUBDIVCODE'] . ' (' . $subdiv_list['SUBDIVISION_NAME'] . ')</option>';
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--Sub-Division-->
                        <!--District-->
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-level" for="district" style="padding-left: 5px;"><b>District</b>
                                    <font style="color:#FF0000"></font>
                                </label>
                                <div class="controls" style="width: 90%">
                                    <select name="district" id="district" class="chosen-select"
                                        onchange="load_upazila_by_district_id(this.value)">
                                        <option value=""></option>
                                        <?php
                                        $tbl_name = "HYDROLOGY.DISTRICT_TBL@HYDRO10";
                                        $cols = "DISTRICT_NO,DISTRICT_NAME";
                                        $where_cond = "DVS_CODE>0 ORDER BY DISTRICT_NAME ASC";
                                        foreach ($obj->View_colmn_By_Cond($tbl_name, $cols, $where_cond) as $district_list) {
                                            echo '<option value="' . $district_list['DISTRICT_NO'] . '">' . $district_list['DISTRICT_NAME'] . '</option>';
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--District-->

                        <!--Date Range-->
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label" for="form-field-1"><b>From Date<font color="#FF0000">
                                        </font>
                                    </b></label>
                                <div class="controls">
                                    <div class="row-fluid input-prepend">
                                        <span class="add-on">
                                            <i class="icon-calendar"></i>
                                        </span>
                                        <input id="from_date" name="from_date" class="date-picker" type="text"
                                            data-date-format="dd-mm-yyyy" placeholder="dd-mm-yyyy" style="width: 50%;"
                                            value="<?php echo $current_mon_f_date; ?>" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="span5" style="margin-left:-1%;">
                        <div class="span4">
                            <div class="control-group">
                                <label class="control-label" for="form-field-1"><b>To Date<font color="#FF0000"></font>
                                    </b></label>
                                <div class="controls">
                                    <div class="row-fluid input-prepend">
                                        <span class="add-on">
                                            <i class="icon-calendar"></i>
                                        </span>
                                        <input id="to_date" name="to_date" class="date-picker" type="text"
                                            data-date-format="dd-mm-yyyy" placeholder="dd-mm-yyyy" style="width: 50%;"
                                            value="<?php echo $current_mon_l_date; ?>" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--Date Range-->

                        <!--Show Button-->
                        <div class="span3">
                            <div class="control-group">
                                <div class="controls">
                                    <button type="button" class="btn btn-minier btn-success"
                                        onclick="summary_station_availabilit()"
                                        style="margin-top: 23px; margin-bottom:5px; padding: 4px !important;">
                                        <b style="font-size: 12px;"><i class="icon-search"></i>Show Summary</b>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="span2">
                            <div class="control-group">
                                <div class="controls">
                                    <button type="button" class="btn btn-minier btn-info"
                                        onclick="show_station_availabilit()"
                                        style="margin-top: 23px; margin-bottom:5px; padding: 4px !important; margin-left:-20%">
                                        <b style="font-size: 12px;"><i class="icon-search"></i>Show Details</b>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="span2">
                            <div class="control-group">
                                <div class="controls">
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-minier btn-purple dropdown-toggle"
                                            data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                                            style="margin-top: 23px; margin-bottom:5px; padding: 4px !important;">
                                            <b style="font-size: 12px;"><i class="icon-print"></i> Print Data</b>
                                            <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu">
                                            <li><a href="#" onclick="print_station_availabiliti_summary_data()">Summary
                                                    Data</a></li>
                                            <li><a href="#" onclick="print_station_availabiliti_data()">Show Details</a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>


                <!--Show Button-->
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $('.chosen-select').chosen({ allow_single_deselect: true });

    $(window).off('resize.chosen').on('resize.chosen', function () {
        $('.chosen-select').each(function () {
            var $this = $(this);
            $this.next().css({ 'width': '100%' });
        })
    }).trigger('resize.chosen');

    $(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>
<script type="text/javascript">
    $('.date-picker').datepicker().next().on(ace.click_event, function () {
        $(this).prev().focus();

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