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

     File:          mld_stddienst.asp
     Description:   Voeg een dienstniveau toe aan de geselecteerde standardmeldingen.
     Parameters:    std_key    StandaardMelding array (keys)
     Context:       Vanuit overzicht meldingen via bulk-actie

*/
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/selector.inc" -->
<%
FCLTHeader.Requires({ plugins: ["jQuery"],
                      js: ["jQuery-ui.js"]
                    });
var std_key_arr = getQParamIntArray("std_key");

var TransitParam = buildTransitParam(["std_key"]);
var authparams = user.checkAutorisation("WEB_MLDMGT");

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

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

        async function mld_submit()
        {
          if (!await validateForm("stddienstform"))
            return false;

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

      </script>
  </head>

  <body class="fclt-modal" id="mod_mldstddienst">
    <% MODAL_START(); %>
    <form id="stddienstform" name="stddienstform" action="mld_stddienst_save.asp?x=x<%=TransitParam%>" method="post">
<%

      MODAL_BLOCK_START("mldClose", L("mld_dienstpakket"), { "icon": "fa-bell-concierge" });

        var sql = "SELECT mld_dienstniveau_key"
                + "     , mld_dienstniveau_omschr"
                + "  FROM mld_dienstniveau"
                + " ORDER BY 2";
        FCLTselector("dienst_key",
                     sql,
                     { label: L("lcl_mld_dienst_niveau"),
                       initKey: -1,
                       required: true,
                       emptyOption: ""
                     }
                    );

      MODAL_BLOCK_END();

      var buttons = [];
      buttons.push({title: L("lcl_submit"), icon: "fa-fclt-save", action: "mld_submit()", singlepress: true, id: "btn_save_submit"  })
      buttons.push({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(); %>
