<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
    <script type="text/javascript">
    try {
        ace.settings.loadState('main-container')
    } catch (e) {}
    </script>
    <?php include('techsyn_sidebar.php'); ?>

    <!--breadcrumb-->

    <div class="main-content">
        <div class="main-content-inner">
            <div class="breadcrumbs ace-save-state" id="breadcrumbs">
                <ul class="breadcrumb">
                    <!-- <li class="active">Inventory</li> -->
                    <li class="active">Checklist</li>

                </ul>



                <!-- End of breadcrumb -->

            </div>
            <div class="page-content">
                <div id="flexigridDiv" class="table-responsiv">
                    <h4 style="font-size: 15px; text-align: center; font-weight: bold">Select Data For Check List
                    </h4>



                    <div class="container">

                        <form action="" style="text-align:center" method="post" name="vaccine_link_form"
                            id="vaccine_link_form" enctype="multipart/form-data">

                            <div class="form-group">
                                <label>Issue To <span style="color: red;margin-top: 20%;">*</span></label>
                                <select class="form-control" id="issue_type"
                                    style="text-align:center ;  width:50%;margin-left: 25%"
                                    onchange="$('#shift_div').show();" name="issue_type">
                                    <option disabled selected>Please select option</option>
                                    <?php  echo generateOptionWithWhereClause('ohc_type', "CONCAT(ohc_type_name)", 'ohc_type_id', '','','ohc_category','"OHC"'); ?>
                                    <!-- <option value="OHC"><?php  echo getTableFieldValue('ohc_type', "CONCAT(ohc_type_name)", 'ohc_type_id', $_SESSION['current_ohcttype']); ?> </option> -->
                                    <!-- <option value="AMB">Ambulance</option> -->
                                </select>
                                <!-- /.input group -->
                            </div>

                            <div class="form-group" id='shift_div' style="display: none;">
                                <label>Shift<span style="color: red;margin-top: 20%;">*</span></label>
                                <select class="form-control" id="shift"
                                    style="text-align:center ;  width:50%;margin-left: 25%"
                                    onchange="issue_type_option($('#issue_type').val());" name="shift">
                                    <option disabled selected>Please select option</option>
                                    <?php
                                                            $generate_option_sql = "select status_name,shift_status_id from shift_status where  status_name !='G'  and is_shift='Y'";
error_log($generate_option_sql);
                                                            $result_generate_option_sql = mysqli_query($conn, $generate_option_sql);

                                                            while ($row_generate_option_sql = mysqli_fetch_assoc($result_generate_option_sql)) {
                                                            ?>
                                    <option value="<?= $row_generate_option_sql['shift_status_id'] ?>">
                                        <?= $row_generate_option_sql['status_name'] ?></option>

                                    <?php
                                                            }
                                                            ?>
                                </select>
                                <!-- /.input group -->
                            </div>


                            <div id='ambulance_div' name="ambulance_div" style="display:none">
                                <label>Ambulance Location<span style="color: red;margin-top: 20%;">*</span></label>
                                <select style="text-align:center ;  width:50%;margin-left: 25%;" name="ambulance_number"
                                    id="ambulance_number" class="form-control" onchange="$('#forward').show();">

                                    <option value="" disabled selected>Please Select Ambulance</option>
                                    <?php  	$k = 0;
                                              $ohc_location = "SELECT id ,  CONCAT( ambulance_name , '  ( ' , ambulance_number , ' ) ') as amb FROM ambulance_details_new WHERE ohc_type_id = '$current_ohcttype' AND `status` = '0' ";
                                              error_log(" AMB".$_SESSION['current_ohcttype']);
                                           $result_ohc_location = @mysqli_query($conn, $ohc_location);
                                            while ($row_ohc_loaction = mysqli_fetch_assoc($result_ohc_location)){ ?>
                                    <option value="<?php  echo $row_ohc_loaction["id"] ?>"
                                        <?php  if($row_ohc_loaction["id"]==$_POST["inventory_type"]){?> <?php  }?>>
                                        <?php  echo  $row_ohc_loaction["amb"] ?>
                                    </option>
                                    <?php  }?>
                                </select>
                            </div>


                            <div id="ohc_type_div" style="display: none;">
                                <label>Location<span style="color: red;margin-top: 20%;">*</span></label>
                                <input class="form-control" id="ohc_number"
                                    style="text-align:center ;  width:50%;margin-left: 25%;"
                                    onchange="$('#forward').show();" name="ohc_number"
                                    value="<?= $_SESSION['current_ohcttype']?>">

                                </input>
                                <!-- /.input group -->
                            </div>
                            <br><br>


                            <div style="display:none " id='forward'>
                                <label>Item Categories<span style="color: red;margin-top: 20%;">*</span></label>
                                <select style="text-align:center ; width:50%;margin-left: 25%;"
                                    name="inventory_item_type2" id="inventory_item_type2" class="form-control">
                                    <option value="All" disabled selected>All</option>
                                    <!-- <option value="comm">Question's</option> -->
                                    <?php echo generateOption("tbl_categories","cat_name",'cat_id','',''); ?>
                                </select>

                                <button type="submit" id="submit" style="margin-top: 1%; width:8%"
                                    onclick="upload_temp()" class="btn btn-xs btn-primary">
                                    Next</button>

                            </div>

                        </form>
                    </div>








                </div>
            </div>


        </div>

    </div>

</div>


<?php include('techsyn_footer.php'); ?>
<style>
.outer-container {
    background: #F0F0F0;
    border: #e0dfdf 1px solid;
    padding: 40px 20px;
    border-radius: 2px;
}

.btn-submit {
    background: #333;
    border: #1d1d1d 1px solid;
    border-radius: 2px;
    color: #f0f0f0;
    cursor: pointer;
    padding: 5px 20px;
    font-size: 0.9em;
}

.tutorial-table {
    margin-top: 40px;
    font-size: 0.8em;
    border-collapse: collapse;
    width: 100%;
}

.tutorial-table th {
    background: #f0f0f0;
    border-bottom: 1px solid #dddddd;
    padding: 8px;
    text-align: left;
}

.tutorial-table td {
    background: #FFF;
    border-bottom: 1px solid #dddddd;
    padding: 8px;
    text-align: left;
}

option {
    font-size: small;
}

#response {
    padding: 10px;
    margin-top: 10px;
    border-radius: 2px;
    display: none;
}

.success {
    background: #c7efd9;
    border: #bbe2cd 1px solid;
}

.error {
    background: #fbcfcf;
    border: #f3c6c7 1px solid;
}

div#response.display-block {
    display: block;
}

.input-group-addon {
    height: 25px;
    width: 30px;
    padding: 0px 0px;
}
</style>
<script>
function issue_type_option(issue_type) {
    // if (issue_type == "OHC") {
        $('#forward').show();
        $("#ambulance_div").hide();
    // } else {
    //     $('#forward').show();
    //     $("#ambulance_div").show();
    // }

}

function upload_temp() {
    // document.forms['vaccine_link_form'].target = '_blank';
    document.forms['vaccine_link_form'].action = "inventory_checklist_details.php";
    document.forms['vaccine_link_form'].method = 'POST';
    document.forms['vaccine_link_form'].submit();
}
</script>