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

     File:               mld_reopen.asp
     Description:        Heropenen van een melding. Opmerking moet ingevuld worden.
     Parameters:         mld_melding_key

     Context:
     Note:

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

FCLTHeader.Requires({ plugins: ["jQuery"] });

var mld_key = getQParamInt("mld_key");
var opmerk = getFParam("opmerk", "");

var result = {};
// Bepaal of de melding heropend kan of mag worden.
var this_mld = mld.func_enabled_melding(mld_key); // Wat heb ik zoal aan rechten op deze specifieke melding
var mld_info = mld.mld_melding_info(mld_key);
if (!this_mld.canReopen)
  user.anything_todo_or_abort(false);
lcl.set_dialect(mld_info.srtdisc_key, "MLD_SRTDISCIPLINE_KEY");
%>

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

    <script type="text/javascript">
        $(function()
        {
          $('textarea').resize(function () { FcltMgr.resized(window) } );
          $('textarea').autogrow();
        });

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

          $.post( $("form[name=reopenform]")[0].action,
                  $("[name=reopenform]").serialize(),
                  FcltCallbackClose,
                  "json",
                );
          return true; // disable button
        }

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

  <body class="fclt-modal" id="mod_reopenbody">
    <% MODAL_START(); %>
      <form id="reopenform" name="reopenform" action="mld_reopen_save.asp?mld_key=<%=mld_key%>" method="post">
<%
      MODAL_BLOCK_START("mldReopen", L("lcl_mld_reopen") + " " + mld_info.prefix + mld_key, { icon: "fa-times" });
        // Vakgroep
        ROFIELDTR("flddisc", L("lcl_vakgroup"), mld_info.prefix + "-" + mld_info.ins_discipline_omschrijving);
        // Stdmelding
        ROFIELDTR("fldstdm", L("lcl_complain"), mld_info.mld_stdmelding_omschrijving);

        RWTEXTAREATR("opmerk",
                     "fldtxt required",
                     L("lcl_mld_note"),
                     "",
                     {html: "rows='8'"});
        MODAL_BLOCK_END();

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