<%@ language="javascript"%>
<% /*
     $Revision$
     $Id$

    File:               ins_state_history_add.asp
    Description:        Interface to add a new state to the history of a sensor
    Parameters:
    Context:            From ins_state_hisotry.asp
    Note:

*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->

<% FCLTHeader.Requires({ plugins:["jQuery"],
                         js: ["jquery.timepicker-table.js"],
                         css: ["timePicker-table.css"] });

var ins_key = getQParamInt("ins_key", "");

authparams = user.checkAutorisation("WEB_PRSSYS");
%>
<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script type="text/javascript">

      function doSubmit()
      {
        document.forms.u2.submit();
      }

      async function ins_submit()
      {
        document.activeElement.blur(); // trigger laatste onChanges
        if (!await validateForm("u2"))
          return false;
        document.forms.u2.submit();
      }

      function ins_cancel()
      {
        FcltMgr.closeDetail(window, { cancel: true } );
      }

      $(function()
      {
        $("#new_value").focus();
        FcltMgr.resized(window);
      });
    </script>
  </head>

  <body class="fclt-modal" target="hidFrame" id="mod_deel_state">
  <% MODAL_START(); %>
    <form name=u2 method=post action="ins_edit_deel_state_save.asp">
<%    MODAL_BLOCK_START("", L("lcl_ins_sensor_manual"), { icon: "fa-gauge-circle-plus" });
      RWFIELDTR("state", "fldshort", L("lcl_ins_sensor_value"), "", { required: true, maxlength: 128 });
%>
      <input type="hidden" id="ins_key" name="ins_key" value="<%=ins_key%>">
<%
      MODAL_BLOCK_END();
      var buttons =  [ {title: L("lcl_submit"), icon: "fa-fclt-save", action: "ins_submit()" }
                     , {title: L("lcl_cancel"), icon: "fa-fclt-cancel", action: "ins_cancel()" } ];
      SIMPLE_BLOCK_START();
        CreateButtons(buttons);
      SIMPLE_BLOCK_END();
IFACE.FORM_END();
%>
    </form>
    <% MODAL_END(); %>
    <iframe src="../Shared/empty.asp" frameborder="10" name="hidFrame" id="hidFrame" style="display:none"></iframe>
  </body>
</html>
<% ASPPAGE_END(); %>
