<?php
session_start();
include("../../php_crud/my_class.php");
$obj = new my_class();
extract($_REQUEST);
// print_r($_REQUEST);
// echo $well_id;
$get_discharge = $obj->Details_By_Cond("HYDROLOGY.PUMP_DISCH_TBL@HYDRO10", "WELL_ID='$e_disch_pt_well_id' AND TEST_TYPE='$e_disch_test_type_id'");
// $discharge = $get_discharge['DISCHARGE'];
// $total_depth_feet = round($total_depth_meters * 3.28084);

// // Calculate number of rows needed, each row representing 10 feet
// $num_rows = ceil($total_depth_feet / 10);
?>

<div class="form-group">
  <div style="display: inline-block; vertical-align: top; width: 40%; margin-top:30px; margin-left:30px;">
    <h5 style="margin-bottom: 30px; display: inline; margin-left: 30px;">Pump Test Discharge Information for: <?php echo $e_disch_pt_well_id; ?></h5>
    <span>
      <input type="hidden" name="delete_disch_pt_well_id" id="e_disch_pt_well_id" value="<?php echo $e_disch_pt_well_id; ?>" />
      <input type="hidden" name="delete_disch_test_type_id" id="e_disch_test_type_id" value="<?php echo $e_disch_test_type_id; ?>">
      <!-- <input type="hidden" id="excel_pump_test_id" value="<?php echo $pump_test_id; ?>">
      <input type="hidden" id="excel_excel_observation_id" value="<?php echo $well_observation_id; ?>"> -->
    </span>
  </div>
  <div style="display: inline-block; vertical-align: top; width: 30%; margin-left:40px;">
    <div class="form-group" style="margin-bottom: 0;">
      <label class="control-label" for="year"><b>Discharge<font color="#FF0000"></font></b></label>
      <div class="input-group">
        <!-- <input type="file" name="upload_excel" id="upload_excel" class="form-control input-large"> -->
        <input type="text" style="width: 100%; height: 14px !important; padding-left: 10px !important;" onkeypress="return isNumericInput(event)" id="e_discharge" name="e_discharge" value="<?php echo $get_discharge['DISCHARGE']; ?>" />
        <!-- <span class="input-group-btn">
          <button onclick="pump_test_discharge_data_save()" class="btn btn-minier btn-info" style="padding: 4px !important;" type="button">
            <i class="icon-key"></i> Upload
          </button>
        </span> -->
      </div>
    </div>

  </div>
</div>

<div class="row-fluid" style="margin-bottom:10px; margin-top:-16px!important;">
  <div class="control-group" style="float:right; margin-right:50px;">
    <div class="controls">
      <button id="pt_data_manu_ins_btn" type="button" style="margin-right: 5px; font-size: 13px;" class="btn btn-small btn-success" onclick="pump_test_discharge_data_update()"><i class="icon-save"></i><b>Save</b></button>
      <?php
      if ($_SESSION['delete'] == 'Y') {
        echo '<button id="pt_data_manu_delete_btn" type="button" style="margin-right: 2px; font-size: 13px;" class="btn btn-small btn-danger" onclick="discharge_pt_data_delete()"><i class="icon-trash"></i><b>Delete</b></button>';
      }
      ?>
    </div>
  </div>
</div>

<!-- <div style="margin-top: 30px;" id="pump_test_excel_data_show"></div> -->

<!-- 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 -->