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

    File:        opdr_uren_search.asp (nieuw in 5.01)
    Description:   Toont zoekvelden voor urenlijsten van opdrachten/medewerkers
    Parameters:    {NADER UITWERKEN}
      urole        gebruikers rol (fe|fo|bo|mi) REQUIRED
    Context:       Vanuit portal, melding, of cnt_list, of..
    Note:          In principe kan voor elk veld een parameter worden gegeven (conventies hanteren!)
                   Note: Toevoegen gaat niet meer hier vandaan, dus er is heel wat verdwenen
*/ %>

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

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

/***** Get webform parameters *****/
var urole = getQParamSafe("urole", "fe");
// fe = mijn eigen urenlijsten
// fo = urenlijsten van medewerkers die MLDORD rechten hebben op disciplines waar ik WEB_UURFOF (lees ja/nee) op heb
//      (om in te voeren namens hun)
// bo = urenlijsten van medewerkers die MLDORD rechten hebben op disciplines waar ik WEB_UURBOF (lees ja/nee) op heb
//      (om evenueel te corrigeren en te fiatteren)

// PREFILL PARAMETERS:
var mld_key = getQParamInt("mld_key", -1);
var opdrnr = getQParam("opdrnr", "");
var date_to = getQParamDate("date_to", new Date);
var handler_key = getQParamInt("handler_key", urole == "fe"? user_key : -1); // Uitvoerende
var srtdisc_key = getQParamInt("srtdisc", -1); // optioneel. Dan krijgt BO er een vakgroep(team)selector bij

/***** End get webform parameters *****/
lcl.set_dialect(srtdisc_key, "MLD_SRTDISCIPLINE_KEY");

// So what authorization must we check?
var autfunction = { fe: "WEB_UURUSE", fo: "WEB_UURFOF", bo: "WEB_UURBOF"} [urole];
authparams = user.checkAutorisation(autfunction);

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

    <script type="text/javascript">
      var anysearch = false;
      function doSubmit()
      {
		    anysearch = true;
        document.forms.u2.submit();
      }
      function fcltontabshow()
      {
          if (anysearch)
              doSubmit();
      }
    </script>
  </head>

  <body id="searchbody">
    <form action="opdr_uren_search_list.asp?urole=<%=urole%>" method="post" name="u2" target="workFrame">
      <% SEARCH_PAGE_START({ header: L("lcl_filterblok") });
      SEARCH_BLOCK_START();
          if (srtdisc_key > 0 && urole != "fe") // 'team' selector
          {
              FCLTdisciplineselector("disc_key",
                                     "sgDisc",
                                     { label: L("lcl_vakgroup"),
                                       module: "MLDP",
                                       perslidKey: user_key,
                                       autfunctionKey: -1,
                                       srtdisc_key: srtdisc_key
                                     });
          }
          // <!-- Uitvoerende -->
          FCLTpersoonselector("handler",
                              "sgBehandelaar",
                              { perslidKey: handler_key,
                                label: L("lcl_handler"),
                                autlevel: authparams.PRSwritelevel,
                                readonly: (urole == "fe"),
                                filtercode: (urole=="bo"?"MLDORDBOF":"MLDORDFOF")
                              });

          if (urole != "fe")
            RWFIELDTR("opdrnr", "fldshort", L("lcl_mld_order_nr"), opdrnr, { trclass: "primsearch" });
SEARCH_BLOCK_END();
SEARCH_BLOCK_START();
            // <!-- Periode tot -->
            FCLTcalendar("date_to",
                         { label: L("lcl_period_to"),
                           datum: date_to
                         });
SEARCH_BLOCK_END();
SEARCH_BLOCK_START({wide: true}); %>
        <!-- Status checkboxen -->
        <tr>
          <td colspan="2">
            <div id="statusboxes">
              <label><%=L("lcl_opdr_statusfilters")%></label>&nbsp;
                <input type="checkbox" name="urenNot"  id="urenNot"  value="1" <%=(urole != "bo"? "CHECKED" : "")%>><label for="urenNot"><%=L("lcl_mld_uren_status_0")%></label>
                <input type="checkbox" name="urenNew"  id="urenNew"  value="1" <%=(urole != "bo"? "CHECKED" : "")%>><label for="urenNew"><%=L("lcl_mld_uren_status_1")%></label>
                <input type="checkbox" name="urenBusy" id="urenBusy" value="1" <%=(urole != "fe"? "CHECKED" : "")%>><label for="urenBusy"><%=L("lcl_mld_uren_status_2")%></label>
                <input type="checkbox" name="urenAfm"  id="urenAfm"  value="1" ><label for="urenAfm" ><%=L("lcl_mld_uren_status_3")%></label>
                <input type="checkbox" name="urenVer"  id="urenVer"  value="1" ><label for="urenVer" ><%=L("lcl_mld_uren_status_4")%></label>
            </div>
          </td>
        </tr>
<% SEARCH_BLOCK_END();

  var buttons =  [ {title: L("lcl_overview_list"), action: "doSubmit()", icon: "fa-clipboard-list" } ];
SIMPLE_BLOCK_START();
  CreateButtons(buttons, { entersubmit: true, showIcons: true });
SIMPLE_BLOCK_END();
SEARCH_PAGE_END(); %>
      </form>

    <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>
<% ASPPAGE_END(); %>
