<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
page_header('Sensor devices', 'set_devices');
?>

   <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;">Uuid:</td>
       <td align="left" colspan="5" style="vertical-align: top; padding: 3px;"><input id="dev_uuid" readonly /></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Description:</td>
       <td align="left" colspan="5" style="vertical-align: top; padding: 3px;"><input id="dev_description" /></td>
      </tr>
      <tr>
       <td colspan="6"><hr></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Device type:</td>
       <td colspan="2" style="padding: 3px;"><div style="float: left;" id="dev_type"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">I/O direction:</td>
       <td colspan="2" style="padding: 3px;"><div style="float: left;" id="dev_direction"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Device value:</td>
       <td colspan="2" style="padding: 3px;"><div style="float: left;" id="dev_value"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Value offset:</td>
       <td colspan="2" style="padding: 3px;"><div style="float: left;" id="dev_offset"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Address:</td>
       <td align="left" colspan="2" style="vertical-align: top; padding: 3px;"><input id="dev_address" /></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Subdevice:</td>
       <td colspan="2" style="padding: 3px;"><div style="float: left;" id="dev_subdevice"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Present:</td>
       <td colspan="2" style="padding: 3px;"><div style="float: left;" id="dev_present"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;" id="pin_pmpt">GPIO pin:</td>
       <td colspan="2" style="padding: 3px;"><div style="float: left;" id="dev_gpiopin"></div></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">In use:</td>
       <td colspan="2" style="padding: 3px;"><div style="float: left;" id="dev_inuse"></div></td>
       <td style="vertical-align: top; float: right; padding: 3px;">Last change:</td>
       <td align="left" colspan="2" style="vertical-align: top; padding: 3px;"><input id="dev_timestamp" readonly /></td>
      </tr>
      <tr>
       <td style="vertical-align: top; float: right; padding: 3px;">Comment:</td>
       <td align="left" colspan="5" style="vertical-align: top; padding: 3px;"><input id="dev_comment" /></td>
      </tr>
      <tr><td colspan="6"></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 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>
      Select a new device type and press "OK" to create a new device record.<br>
      Press "Cancel" to close without adding a new device.
     </div>
     <div>
      <div style="float: right; margin-top: 25px; margin-bottom: 10px;">
       <div style="float: left; margin-right: 15px" id="addType"></div>
       <input type="button" id="addOk" value="OK" style="margin-right: 15px" />
       <input type="button" id="addCancel" value="Cancel" style="margin-right: 65px" />
      </div>
     </div>
    </div>
   </div>

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