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

    filename:     pitlist.php
    description:  list pits and associated manufacturers, models,
                  blower P/I/Ds, vent P/I/Ds and comments
    inputs:       none
    outputs:      pitId, add, update, calibrate, delete
    actions:      add, update, calibrate, delete
    redirections: pitlistprocess.php

********************************************************************************
-->
<html>
    <head>
        <style>
            table {
                border-collapse: collapse;
            }
            table, td, th {
                border: 1px solid black;
            }
        </style>
        <?php include 'head.html' ?>
        <script src = "navigation.js"></script>
    </head>
    <body>
        <?php include 'navigationmanagefoodspitsprobes.html' ?>
        <h3>PITS</h3>
        <div id="content">
            <?php
            include 'functions.php';
/*
            ... Get pits
*/
            $pits = getPits();
/*
            ... Display pit list
*/
            echo "<table>";
                echo"<tr>";
                    echo "<th>ID</th>";
                    echo "<th>Manufacturer</th>";
                    echo "<th>Model</th>";
                    echo "<th>Blower P</th>";
                    echo "<th>Blower I</th>";
                    echo "<th>Blower D</th>";
                    echo "<th>Vent P</th>";
                    echo "<th>Vent I</th>";
                    echo "<th>Vent D</th>";
                    echo "<th>Comments</th>";
                echo "</tr>";
                foreach ($pits as $pit) {
                    echo "<tr>";
                        echo "<th>" . $pit['pitId'] . "</th>";
                        echo "<th>" . $pit['manufacturer'] . "</th>";
                        echo "<th>" . $pit['model'] . "</th>";
                        echo "<th>" . $pit['blowerP'] . "</th>";
                        echo "<th>" . $pit['blowerI'] . "</th>";
                        echo "<th>" . $pit['blowerD'] . "</th>";
                        echo "<th>" . $pit['ventP'] . "</th>";
                        echo "<th>" . $pit['ventI'] . "</th>";
                        echo "<th>" . $pit['ventD'] . "</th>";
                        echo "<th>" . $pit['comments'] . "</th>";
                    echo "</tr>";
               }
               echo "</table>";
               echo '<form action="pitlistprocess.php" method="post">';
                   echo 'Pit <select name="pitId">';
                   foreach($pits as $pit) {
                       echo '<option value="' . $pit['pitId'] . '">' . $pit['manufacturer'] . ' ' . $pit['model'] . '</option>';
                   }
                   echo '</select>';
                   echo '<br>';
                        echo '<input type="submit" name="add" value="Add">';
                        echo '<input type="submit" name="update" value="Update"> ';
                        echo '<input type="submit" name="calibrate" value="Calibrate"> ';
                        echo '<input type="submit" name="delete" value="Delete"><br>';   
                echo '</form>';
            ?>
        </div>
    </body>
</html>