<%@ LANGUAGE = JavaScript %>
<% /*
     $Revision$
     $Id$

    File:               kpn_mandate_search.asp
    Description:        Search filters for mandatate list
    Parameters:         autosearch, prs_key
    Context:
*/ %>

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

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

  var autosearch = getQParamInt("autosearch", -1);
  var prs_key     = getQParamInt("prs_key", -1);

  var authparams = user.checkAutorisation("WEB_FINMSU", true);
  if (authparams)
  {
    var filtercode = "A"; // Alles, mandateren
  }
  else
  {
    var authparams = user.checkAutorisation("WEB_FACMAN");
    var filtercode = "B"; // budgethouder, ondermandateren
  }

%>
<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script type="text/javascript">

        $(document).ready(function() {<% if (autosearch == 1) { %> document.forms.u2.submit();<%}%>});
    </script>
  </head>
  <body id="searchbody">
    <div id="search">
      <form name="u2" target="workFrame" action="kpn_mandate_search_list.asp" method="get">
<%    BLOCK_START("searchtable", L("lcl_filterblok"));%>
             <%
               FCLTkostenplaatsselector( "prs_kstpl",
                                         "prs_kstpl",
                                          user_key,
                                        {label: L("lcl_prs_dept_kosten"),
                                         filtercode: filtercode,
                                         whenEmpty: L("lcl_search_generic")
                                        });
               FCLTpersoonselector("sName_key", // requestor
                                    "sgPerson",
                                    { perslidKey: prs_key,
                                      label: L("lcl_prs_name"),
                                      autlevel: authparams.PRSreadlevel,
                                      trclass: "primsearch",
                                      whenEmpty: L("lcl_search_generic")  // want filter
                                    });
            %>
<%    BLOCK_END();
  var buttons =  [ {title: L("lcl_search"), action:"document.forms.u2.submit();" }];
  CreateButtons(buttons, { entersubmit: true });
%>
      </form>
    </div>

    <div id="result">
      <iframe width="100%" height="100%"
              src="../Shared/empty.asp"
              name="workFrame" id="workFrame"
              onload='FcltMgr.iframeLoaded(this)'
              frameborder="0" scrolling="no">
      </iframe>
    </div>
  </body>
</html>
