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

    File:               prs_perslid.asp
    Status:             100%%
    Description:        Wrapper for prs_show_perslid.asp/prs_edit_perslid.asp

    Parameters:         key (or prs_key), optional

    Context:
    Note:

*/ %>
<!--#include file="../Shared/common.inc" -->
<!--#include file="../Shared/iface.inc" -->
<%
  FCLTHeader.Requires({plugins:["suggest","jQuery"], js: ["jQuery-ui.js"]})
// jQuery-ui.js is nodig in het child formulier prs_perslidwerkplek_search_list

  var autfunction = "WEB_PRSUSE"; // stelling: als je MAN hebt moet je ook maar USE krijgen
  var authparams = user.checkAutorisation(autfunction);

  var authparamsBOF = user.checkAutorisation("WEB_PRSBOF", true);
  var canBOF = (authparamsBOF && authparamsBOF.ALGreadlevel < 9 && authparamsBOF.PRSreadlevel < 9);

  var prs_key = getQParamInt("key", -1);
  if (prs_key == -1)
    prs_key = getQParamInt("prs_key", -1);

  var naam = "";
  if (prs_key > 0)
  {
    var thisPrs = new Perslid(prs_key);  // voor de naam in de titel
    naam = thisPrs.naam();
  }
  transitParam = buildTransitParam(["prs_srtkey"]);
%>
<html>
<head>
<%
   FCLTHeader.Generate();
%>
  <script  type="text/javascript" >
      FcltMgr.setTitle("<%=safe.jsstring(naam)%>", {hot: false});
<%    if (prs_key == -1) { %>FcltMgr.startEdit(window);<% } %>
      function prsClose(params)
      {
          <% if (prs_key == -1)
             { %>
              if (params.cancel)
              {
                  FcltMgr.closeDetail(window, params );
                  return true;
              }
              if (!params.keepForm)
                  window.location.href = "prs_perslid.asp?verynew=1&key=" + params.prs_key + "<%=transitParam%>";
          <% } else { %>
              if (!params.keepForm)
                  $("#prsFrame")[0].src = "prs_show_perslid.asp?prs_key=<%=prs_key%>";

          <% } %>
      }
    </script>
</head>

  <body>
<%
    if (prs_key == -1)
        var page="prs_edit_perslid.asp?prs_key="+prs_key+transitParam; // Maak een nieuw
    else
        var page="prs_show_perslid.asp?prs_key="+prs_key+transitParam;

    // 1. De Persoongegevens
    IFRAMER("prsFrame", page, { FcltClose: "prsClose", initHeight: "250px" } );

    if (prs_key  > -1)
    {
      if (S("use_capacity_planning") == 1)
      {
        // 2. De inzetbaarheid
        page = "prs_inzetbaar_list.asp?embedded=1&prs_key=" + prs_key;
        IFRAMER("prsinzetbaar", page, { refreshOnClose: true, initHide: true } );
      }

      if (canBOF)
      { // 3. De bezetting
        page = "prs_perslidwerkplek_search_list.asp?embedded=1&prs_key=" + prs_key;
        IFRAMER("prsWPFrame", page, { refreshOnClose: true } );
      }

      // 4. De verplichtingen incl. geleende objecten
      page = "prs_obligations.asp?prs_key=" + prs_key;
      IFRAMER("prsVerplFrame", page, { refreshOnClose: true, initHide: true } );

    }
%>
  </body>
</html>
