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

     File:               fac_typeopdrfaq.asp
     Description:        Laat aan een FAQ meerdere opdrachttypen toevoegen
     Parameters:         faq_key: fac_faq_key waaraan de opdrachttypen gekoppeld moeten worden
     Context:
     Note:

k
*/ %>

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

<%
FCLTHeader.Requires({ plugins:["jQuery"]
                    , js: ["./fac_typeopdrfaq.js"]
                    });

var faq_key = getQParamInt("faq_key");

var this_faq = fac.func_enabled_faq(faq_key); // Wat heb ik zoal aan rechten op deze specifieke kennisbankitem.

user.auth_required_or_abort(this_faq.canChange);

var opdrtype_key = -1;
%>
  <html>
    <head>
<%    FCLTHeader.Generate(); %>
    </head>

    <body class="fclt-modal" id="mod_typeopdrfaq">
      <% MODAL_START(); %>
        <form name="u2" method="post" action="fac_typeopdrfaq_save.asp?faq_key=<%=faq_key%>">
        <% MODAL_BLOCK_START(); %>
          <input type="hidden" id="nrRows" name="nrRows" value="0">
<%
          // <!-- Toevoegen -->
          // Opdrachttype
          sql = "SELECT mld_typeopdr_key"
              + ", mld_typeopdr_omschrijving"
              + " FROM mld_typeopdr"
              + " ORDER BY 2";
          FCLTselector("opdrtype",
                       sql,
                       { initKey: opdrtype_key,
                         label: L("lcl_mld_typeopdr"),
                         multi: true
                       });
%>
          <tr>
            <td></td> <!-- jQuery 3.5 does not auto-convert xhtml (<td/>) to html (<td></td>) anymore -->
            <td>
              <div id="addtypeopdrfaqbuttons">
<%
              var buttons =  [ {title: L("lcl_add"), icon: "fa-plus", action: "fac_add()", id: "btn_faq_add_typeopdr", importance: 1  }];
              CreateButtons(buttons, { showIcons: true });
%>
              </div>
            </td>
          </tr>
          <tr>
            <td class="label" colspan="2">
              <label for="typeopdrfaqtable" style="white-space: nowrap"><%=L("lcl_faq_voor_typeopdr")%></label>
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <table id="typeopdrfaqtable" cellspacing=0 cellpadding=0 class="rstable no-floating">
                <thead>
                  <tr>
                    <th style='width:15px'></th>
                    <th><%=L("mld_typeopdr")%></th>
                  </tr>
                </thead>
                <tbody>
<%
                var sql = "SELECT f.mld_typeopdrfaq_key"
                        + "     , mto.mld_typeopdr_key"
                        + "     , " + lcl.xsqla("mto.mld_typeopdr_omschrijving", "mto.mld_typeopdr_key")
                        + "  FROM mld_typeopdrfaq f"
                        + "     , mld_typeopdr mto"
                        + " WHERE f.mld_typeopdr_key = mto.mld_typeopdr_key(+)"
                        + "   AND fac_faq_key = " + faq_key;


                oRs = Oracle.Execute(sql);
                var teller = 0;
                while (!oRs.eof)
                {
                  teller++;
%>
                  <script type="text/javascript">
                    CreateRow(<%=oRs("mld_typeopdr_key").value%>
                             ,'<%=safe.jsstring(oRs("mld_typeopdr_omschrijving").value)%>'
                             );

                  </script>
<%
                  oRs.MoveNext();
                }
%>
                </tbody>
              </table>
            </td>
          </tr>
<%
          MODAL_BLOCK_END();
          SIMPLE_BLOCK_START();
          var buttons1 =  [{title: L("lcl_submit"), icon: "fa-fclt-save",   action: "fac_submit()", importance: 1 }];
          CreateButtons(buttons1);
          SIMPLE_BLOCK_END();
          IFACE.FORM_END();
%>
        </form>
        <% MODAL_END(); %>
    </body>
  </html>
<%

%><% ASPPAGE_END(); %>
