<!DOCTYPE html>
<!--
********************************************************************************

    name:         probecalibrate.php
    description:  calibrate specified probe
    inputs:       probeId
    outputs:      probeId and low/medium/high temperatures/resistances
    actions:      calibrate, cancel
    redirections: probecalibrateprocess.php

********************************************************************************
-->
<html>
    <head>
        <?php include 'head.html' ?>
        <script src = "navigation.js"></script>
    </head>
    <body>
        <?php include 'navigationmanagefoodspitsprobes.html' ?>
        <div id="content">
            <h3>CALIBRATE PROBE</h3>
            <?php
                include 'functions.php';
/*
                ... get probe ID
*/
                $probeId = $_GET["probeId"];
/*
                ... get probe parameters
*/
                $row = getProbe($probeId);
                $manufacturer = $row[manufacturer];
                $model = $row[model];
                $lowTemp = $row[lowTemp];
                $lowResistance = $row[lowResistance];
                $mediumTemp = $row[mediumTemp];
                $mediumResistance = $row[mediumResistance];
                $highTemp = $row[highTemp];
                $highResistance = $row[highResistance];
/*
                ... display probe parameters
*/
                echo "<table>";
                    echo "<tr>";
                        echo "<th>Manufacturer:</th>";
                        echo '<th>' . $manufacturer . '</th>';
                    echo "</tr>";
                    echo "<tr>";
                        echo "<th>Model:</th>";
                        echo '<th>' . $model . '</th>';
                    echo "</tr>";
                    echo "<tr>";
                echo "</table>";
                echo "<br>";
                echo '<form action="probecalibrateprocess.php?probeId=' . $probeId . '" method="post">';
                    echo "<table>";
                        echo "<tr>";
                            echo "<th>Range</th>";
                            echo "<th>Temperature (F)</th>";
                            echo "<th>Resistance (ohms)</th>";
                        echo "</tr>";
                        echo "<tr>";
                            echo "<th>Low</th>";
                            echo "<th>";
                                echo '<select name="lowTemp">';
                                    for($i = 0; $i <= 999; $i++) {
                                       if ($i == $lowTemp) {
                                           echo '<option value=' . $i . ' selected>' . $i . '</option>';
                                       } else {
                                           echo '<option value=' . $i . '>' . $i . '</option>';
                                       }
                                    }
                                echo '</select>'; 
                            echo "</th>";  
                            echo '<th><input type="text" name="lowResistance" value="' . $lowResistance . '"></th>';
                        echo "</tr>";
                        echo "<tr>";
                            echo "<th>Medium</th>";
                            echo "<th>";
                                echo '<select name="mediumTemp">';
                                    for($i = 0; $i <= 999; $i++) {
                                       if ($i == $mediumTemp) {
                                           echo '<option value=' . $i . ' selected>' . $i . '</option>';
                                       } else {
                                           echo '<option value=' . $i . '>' . $i . '</option>';
                                       }
                                    }
                                echo '</select>'; 
                            echo "</th>";  
                            echo '<th><input type="text" name="mediumResistance" value="' . $mediumResistance . '"></th>';
                        echo "</tr>";
                        echo "<tr>";
                            echo "<th>High</th>";
                            echo "<th>";
                                echo '<select name="highTemp">';
                                    for($i = 0; $i <= 999; $i++) {
                                       if ($i == $highTemp) {
                                           echo '<option value=' . $i . ' selected>' . $i . '</option>';
                                       } else {
                                           echo '<option value=' . $i . '>' . $i . '</option>';
                                       }
                                    }
                                echo '</select>'; 
                            echo "</th>";  
                            echo '<th><input type="text" name="highResistance" value="' . $highResistance . '"></th>';
                       echo "</tr>";
                   echo "</table>";
                   echo '<input type="submit" name="calibrate" value="Calibrate">';
                   echo '<input type="submit" name="cancel" value="Cancel"><br>';
                echo '</form>';

                mysqli_close($conn);
            ?>
        </div>
    </body>
</html>