<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
page_header('Fermenter units', 'set_fermenters');
?>

   <div id="jqxgrid"></div>
    <div style="margin-top: 30px;">
    <div id="cellbegineditevent"></div>
    <div style="margin-top: 10px;" id="cellendeditevent"></div>
   </div>

   <!-- Popup editor window. -->
   <div id="popupWindow">
    <div>Edit device</div>
    <div style="overflow: hidden;">
     <table style="width: 100%;">
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Unit:</td>
       <td align="left" style="vertical-align: top; padding: 3px;"><input id="alias" readonly /></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Uuid:</td>
       <td align="left" colspan="3" style="vertical-align: top; padding: 3px;"><input id="uuid" readonly /></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Mode:</td>
       <td align="left" style="vertical-align: top; padding: 3px;"><input id="mode" readonly /></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Beer Code:</td>
       <td align="left" style="vertical-align: top; padding: 3px;"><input id="product_code" readonly /></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Beer Name:</td>
       <td align="left" colspan="3" style="vertical-align: top; padding: 3px;"><input id="product_name" readonly /></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Stage:</td>
       <td align="left" style="vertical-align: top; padding: 3px;"><input id="stage" readonly /></td>
      </tr>
      <tr><td colspan="8"><hr></td></tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Air sensor:</td>
       <td style="padding: 3px;"><div style="float: left;" id="air_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="air_idx"></div></td>
       <td></td><td></td><td></td><td></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Beer sensor:</td>
       <td style="padding: 3px;"><div style="float: left;" id="beer_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="beer_idx"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Alternate:</td>
       <td colspan="3" style="padding: 3px;"><div style="float: left;" id="beer_address2"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Chiller sensor:</td>
       <td style="padding: 3px;"><div style="float: left;" id="chiller_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="chiller_idx"></div></td>
       <td></td><td></td><td></td><td></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Heater:</td>
       <td style="padding: 3px;"><div style="float: left;" id="heater_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="heater_idx"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">State:</td>
       <td style="padding: 3px;"><div style="float: left;" id="heater_state"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Delay:</td>
       <td style="padding: 3px;"><div style="float: left;" id="heater_delay"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Cooler:</td>
       <td style="padding: 3px;"><div style="float: left;" id="cooler_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="cooler_idx"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">State:</td>
       <td style="padding: 3px;"><div style="float: left;" id="cooler_state"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Delay:</td>
       <td style="padding: 3px;"><div style="float: left;" id="cooler_delay"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Fan:</td>
       <td style="padding: 3px;"><div style="float: left;" id="fan_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="fan_idx"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">State:</td>
       <td style="padding: 3px;"><div style="float: left;" id="fan_state"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Delay:</td>
       <td style="padding: 3px;"><div style="float: left;" id="fan_delay"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Light:</td>
       <td style="padding: 3px;"><div style="float: left;" id="light_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="light_idx"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">State:</td>
       <td style="padding: 3px;"><div style="float: left;" id="light_state"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Delay:</td>
       <td style="padding: 3px;"><div style="float: left;" id="light_delay"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Door:</td>
       <td style="padding: 3px;"><div style="float: left;" id="door_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="door_idx"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">State:</td>
       <td style="padding: 3px;"><div style="float: left;" id="door_state"></div></td>
       <td></td><td></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">PSU:</td>
       <td style="padding: 3px;"><div style="float: left;" id="psu_address"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Index:</td>
       <td style="padding: 3px;"><div style="float: left;" id="psu_idx"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">State:</td>
       <td style="padding: 3px;"><div style="float: left;" id="psu_state"></div></td>
       <td></td><td></td>
      </tr>
      <tr><td colspan="8"><hr></td></tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Heater PID:</td>
       <td style="padding: 3px;" colspan="3">
	<div style="float: left; margin-right: 15px" id="pidh_p"></div>
	<div style="float: left; margin-right: 15px" id="pidh_i"></div>
        <div style="float: left;" id="pidh_d"></div>
       </td>
       <td style="vertical-align: top; float: right; padding: 3px;">I Max:</td>
       <td style="padding: 3px;"><div style="float: left;" id="pidh_imax"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Idle range:</td>
       <td style="padding: 3px;"><div style="float: left;" id="pidh_idle"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Cooler PID:</td>
       <td style="padding: 3px;" colspan="3">
        <div style="float: left; margin-right: 15px" id="pidc_p"></div>
        <div style="float: left; margin-right: 15px" id="pidc_i"></div>
        <div style="float: left;" id="pidc_d"></div>
       </td>
       <td style="vertical-align: top; float: right; padding: 3px;">I Max:</td>
       <td style="padding: 3px;"><div style="float: left;" id="pidc_imax"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Idle range:</td>
       <td style="padding: 3px;"><div style="float: left;" id="pidc_idle"></div></td>
      </tr>

      <tr><td colspan="8">&nbsp;</td></tr>
      <tr>
       <td style="padding-top: 20px;" align="right"><input type="button" id="Delete" value="Delete" /></td>
       <td></td><td></td><td></td><td></td><td></td>
       <td style="padding-top: 20px;" align="right"><input style="margin-right: 5px;" type="button" id="Save" value="Save" /></td>
       <td style="padding-top: 20px;" align="left"><input id="Cancel" type="button" value="Cancel" /></td>
      </tr>
     </table>
    </div>
   </div>

   <div id="addWindow">
    <div>
     Add new device
    </div>
    <div>
     <div>
      Press "OK" to create a new fermenter unit record.<br>
      Press "Cancel" to close without adding a new unit.
     </div>
     <div>
      <div style="float: right; margin-top: 45px; margin-bottom: 10px;">
       <input type="button" id="addOk" value="OK" style="margin-right: 15px" />
       <input type="button" id="addCancel" value="Cancel" style="margin-right: 160px" />
      </div>
     </div>
    </div>
   </div>

<?php
confirm_delete();
page_footer();
?>
