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

    File:               opdr_show_uren.asp
    Status:             2%
    Description:        Muteerscherm voor uren bij opdrachten
    Parameters:
                        opdr_uren_key, evt -1.
                        Deze key definieert eigenlijk slechts de week (en de user?)
    Context:
    Note:               Submit naar opdr_edit_uren_save.asp
*/ %>

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

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

/***** Get webform parameters *****/

var opdr_uren_key = getQParamInt("opdr_uren_key", -1);
var urole = getQParamSafe("urole", "fe");

var autfunction = { fe: "WEB_MLDORD", bo: "WEB_ORDBOF", fo: "WEB_ORDBOF", b2: ["WEB_EXTORD","WEB_ORDBO2"], mi: "WEB_MLDBAC"} [urole];
/***** End get webform parameters *****/

var authparams = user.checkAutorisation(autfunction);

var aday;
var medewerker_key = -1;
if (opdr_uren_key > 0)
{ // bestaande week
  sql = "SELECT mld_opdr_uren_datum, prs_perslid_key "
      + " FROM mld_opdr_uren u"
      + " WHERE mld_opdr_uren_key = " + opdr_uren_key;

  oRs = Oracle.Execute(sql);

  aday = new Date(oRs("mld_opdr_uren_datum").value);
  medewerker_key = oRs("prs_perslid_key").value;
  oRs.Close();

}
else
{ // nieuwe opdracht

    aday = new Date();  // vandaag
}

var startofweek = new Date(aday);
startofweek.setDate(startofweek.getDate() - aday.getDay() + 1);
var endofweek = new Date(startofweek);
endofweek.setDate(startofweek.getDate() + 6);

%>

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


    </script>
  </head>

  <body class="showmode">
<%
    IFRAMER_HEADER("Weekbrief");
%>

    <% SUBFRAME_START(); %>
      <form name="u2" method="post" action="opdr_edit_uren_save.asp?urole=<%=urole%>&opdr_uren_key=<%=opdr_uren_key%>" method="post">
<%
        BLOCK_START("urenX", L("lcl_opdr_info"), {icon: "fa-info-square"});
        ROFIELDTR("flddate", "Van", toDateString(startofweek));
        ROFIELDTR("flddate", "Tot", toDateString(endofweek));
        ROFIELDTR("fld", "Medewerker", new Perslid(medewerker_key).naam());
        ROFIELDTR("fldstatus", "Status", "tbd");

        BLOCK_END();
%>

      </form>
    <% SUBFRAME_END(); %>
  </body>
</html>
<% ASPPAGE_END(); %> 
