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

     File:           alg_ruimteresscope.asp
     Description:    Laat een ruimtes x res_catalogus kiezen bulk kiezen
     Parameters:     ruimte_keys: komma separated lijst met alg_ruimte_keys
     Context:
     Note:

k
*/ %>

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

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

user.checkAutorisation('WEB_RESMSU');

var ruimte_key_arr = getQParamIntArray("ruimte_keys");
%>
<html>
<head>
<%    FCLTHeader.Generate(); %>
    <script>
        function alg_submit(scopemode)
        {
            if ($('select#objcatmulti option:selected').length == 0)
                return;
            FcltMgr.confirm(L(scopemode == "A" ? "lcl_add" : "lcl_delete") + "\n" + L("lcl_R_U_sure"), function() {
                $('input#scopemode').val(scopemode);
                $.post($("form[name=u2]")[0].action, $("[name=u2]").serialize(), FcltCallbackClose, "json");;
            });
        }
    </script>
</head>

<body class="fclt-modal" id="mod_ruimteresscope">
<% MODAL_START(); %>
    <form name="u2" method="post" action="alg_ruimteresscope_save.asp?ruimte_keys=<%=ruimte_key_arr.join(",")%>">
    <% MODAL_BLOCK_START("alg_ruimteresscope", L("lcl_alg_geselecteerde_ruimten") + ": " + ruimte_key_arr.length, { icon: "fa-map-marker" }); %>
        <input type='hidden' name='scopemode' id='scopemode'>
<%       var sql = "SELECT rd.ins_discipline_key"
                + ", "+ lcl.xsql('rd.ins_discipline_omschrijving','rd.ins_discipline_key') +" omschrijving"
                + "  FROM res_v_aanwezigdiscipline rd"
                + " WHERE rd.ins_discipline_min_level = 2"
                + " ORDER BY ins_discipline_volgnr, 2";

        FCLTselector("objcatmulti",
                     sql,
                     {
                       label: L("lcl_res_objcat"),
                       size: 10,
                       multi: true,
                       startmulti: true
                     });
    MODAL_BLOCK_END();
    var buttons =  [ {title: L("lcl_add"),    action: "alg_submit('A')", importance: 1 },
                     {title: L("lcl_delete"), action: "alg_submit('D')", importance: 1 },
                     {title: L("lcl_cancel"), action: "gen_cancel()", importance: 3} ];
    SIMPLE_BLOCK_START();
        CreateButtons(buttons);
    SIMPLE_BLOCK_END();

    IFACE.FORM_END();
%>
      </form>
      <% MODAL_END(); %>
  </body>
</html>
<% ASPPAGE_END(); %>
