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

     Status: 100%
*/
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="mld.inc" -->
<%
FCLTHeader.Requires({ plugins: ["suggest", "jQuery"] });
var mld_key = getQParamInt("mld_key");
var autfunction = "WEB_MLDMSU";

var this_mld = mld.func_enabled_melding(mld_key);
var mld_info = mld.mld_melding_info(mld_key);

lcl.set_dialect(mld_info.srtdisc_key, "MLD_SRTDISCIPLINE_KEY");
user.anything_todo_or_abort(mld_info.workflowRoot && user.has(autfunction) && S("mld_msu_can_stop_workflows"));
%>

<html>
  <head>
<%  FCLTHeader.Generate(); %>

    <script type="text/javascript">
        async function mld_cont()
        {
            document.activeElement.blur(); // trigger laatste onChanges

            // Standaard checks op verplichte velden, datum formaat, numeriek en float formaat, currency formaat.
            if (!await validateForm("cancelworkflowform"))
                return false;

            $.post( $("form[name=cancelworkflowform]")[0].action
                  , $("[name=cancelworkflowform]").serialize()
                  , mld_cont_callback
                  , "json");

            return true; // disable button
        }

        function mld_cont_callback(json, textStatus)
        {
            if (json.success)
                FcltCallbackClose(json);
            else
                iface.button.enable("btn_cont_submit");
        }

        function mld_cancel()
        {
            FcltMgr.closeDetail(window, { cancel: true } );
        }
    </script>
  </head>

  <body class="fclt-modal" id="mod_mldcancelworkflow">
  <% MODAL_START(); %>
    <form id="cancelworkflowform" name="cancelworkflowform" action="mld_cancelworkflow_save.asp?mld_key=<%=mld_key%>" method="post">
<%
      MODAL_BLOCK_START("mldCancelworkflow", "", { "icon": "fa-circle-stop" });
        RWTEXTAREATR("descr", "fldtxt required", L("lcl_mld_cancelworkflow_remark"), "", { html: "rows='8'" });
      MODAL_BLOCK_END();

      var buttons =  [ {title: L("lcl_mld_cancel_workflow"), icon: "fa-fclt-save", action: "mld_cont()", singlepress: true, id: "btn_cont_submit"  },
                       {title: L("lcl_cancel"),              icon: "fa-fclt-cancel",    action: "mld_cancel()" } ];
      SIMPLE_BLOCK_START();
        CreateButtons(buttons);
      SIMPLE_BLOCK_END();
      IFACE.FORM_END();
%>
    </form>
    <% MODAL_END(); %>
  </body>
</html>
<% ASPPAGE_END(); %>
