<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="../resources/stylesheet.css"/>
    <title>{{device}} WebUI HMI</title>
    <meta charset="UTF-8">
    <script type="text/javascript">
    var xhttp = new XMLHttpRequest();
    document.addEventListener("keypress", function (e) { if(e.which == 13) callRfid() }); // Numerical code for "enter"
    function callButton(action)
    {
        sendRequest('Button='+action);
    }
    function callRfid(display)
    {
        tag = document.getElementById('rfidTag').value;
        sendRequest('rfidString='+tag+'&display='+display);
    }
    function setCpState(plugName)
    {
        cpState = document.getElementById('cpState').value;
        sendRequest('cpState='+cpState+'&plugName='+plugName);
    }
    function sendRequest(message)
    {
        xhttp.open("POST", "/debug", true);
        xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xhttp.send(message);
    }
    </script>
</head>
<body>
<div class="debug">
        <div class="hmi-clooney">
            <p>{{IFRAME}}</p>
            RFID (str): <input id="rfidTag" type="text" value="{{ID_TAG_WILDCARD}}">
            {{WEBRFID}}
            Debug: <a href="javascript:callButton('{{E_VIRT_DEBUG_KEY}}')" class="button-simple">&#x2315;</a>
            {{plc_controls}}
        </div>
</div>
</body>
</html>
